MAINT Decompose ChatWindow conversation workflows
@PeaceMaker-best ci sta già lavorando.
Dal 14/9/2026.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
Is your feature request related to a problem? Please describe.
frontend/src/components/Chat/ChatWindow.tsx has become the owner of several independent workflows in one component. It currently coordinates message loading and stale-fetch protection, per-conversation send locks, optimistic messages, attachments and conversions, conversation creation/switching, copy and branch operations, human-score updates, objective changes, export, Markdown preferences, and responsive panel state.
The concern is not line count by itself. Race-sensitive state is spread across React state, multiple refs, effects, and callbacks, so changing one workflow requires understanding unrelated behavior. The associated tests also have to render a large surface to verify small state transitions.
Describe the solution you'd like
Decompose the stateful workflows behind focused hooks or reducers while keeping ChatWindow as the composition and presentation boundary. Candidate boundaries include:
- conversation message loading, navigation, and stale-response suppression;
- message sending, optimistic state, per-conversation locking, attachments, and conversions;
- copy/new-conversation/branch-conversation/branch-attack operations;
- human-score and objective mutations;
- export state and duplicate-export prevention.
Keep state together when it participates in the same transition. Prefer an explicit reducer for multi-step conversation mutation state over moving individual useState calls into pass-through hooks. The extracted APIs should return typed state and commands with clear ownership.
Preserve the existing ChatWindow props, rendered UX, accessibility, request payloads, optimistic-message behavior, navigation behavior, and error handling. In particular, retain the current protections against stale conversation loads, duplicate sends/exports, navigation during an in-flight send, and mutation while an operation is locked.
Describe alternatives you've considered, if relevant
Extracting only JSX sections into presentational components would shorten the file but leave the hard part, asynchronous state ownership, unchanged. Creating one large useChatWindow hook would move rather than reduce the complexity. The goal is a few cohesive workflow boundaries, not maximal file splitting.
Additional context
This was identified during the September 14, 2026 maintainability audit. A repository issue search found no exact existing tracker.
Suggested regression coverage:
- switching conversations while a fetch is in flight;
- sending independently in two conversations;
- preserving optimistic messages when the active conversation changes during send;
- duplicate-send and duplicate-export prevention;
- copy to current/new conversation and both branch paths;
- mutation locking during score, objective, and conversation updates;
- attachment and converted-piece handling;
- narrow-screen panel behavior.
Definition of done:
- each extracted hook/reducer owns one cohesive workflow and has focused tests;
ChatWindowprimarily composes workflow state and renders children;- no public API, backend contract, accessibility, or user-visible behavior changes;
- frontend unit tests, type-check, lint, and formatting pass.
- Lingua principale
- Python
- Stelle
- 4.5k
- Fork
- 896
- Merge medio
- 3g 8h
- PR unite (30g)
- 191
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di microsoft/PyRIT
-
BUG HarmBench loader drops ContextString, so contextual behaviors are sent without their context Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
Tutte le issue di microsoft/PyRIT
Issue simili
-
agent-ready documentation needs-triage
Difficoltà 1/5 1-3 ore Idoneità per principianti 88/100
-
documentation
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 91/100
-
workflow-status page template still says reusable workflows are "triggered only by workflow_call:" Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
-
instance instance add
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
searxng/searx-instances#939 · 1 commento ·
-
area-deployment area-integrations triage:bot-seen
Difficoltà 2/5 Mezza giornata Idoneità per principianti 86/100