Repository navigation
MAINT Extract copy and branch workflows from ChatWindow into useConversationCopy - #3812
Open
Julio César Suástegui (juliosuas) wants to merge 1 commit into
Open
Julio César Suástegui (juliosuas) wants to merge 1 commit into
Julio César Suástegui (juliosuas) wants to merge 1 commit into
Conversation
9 of 25 tasks
…rsationCopy Move copy-to-conversation, copy-to-new-attack, use-in-technique and branch orchestration, plus the in-flight copy lock and branch disabled reasons, into a focused hook. ChatWindow keeps the composer, recovery and navigation state and passes them in. Shared prompt-restore helpers move to utils/promptRestore. Part of microsoft#2652.
Julio César Suástegui (juliosuas)
force-pushed
the
maint/2652-copy-branch-workflow
branch
from
November 3, 2026 03:40
82069c7 to
ff3869f
Compare
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified for the extraction of copy and branch workflows into a dedicated hook.
No open issues 🎉
What changed in this PR
Continues #2652’s ChatWindow decomposition by extracting copy and branch workflows into useConversationCopy. Send/recovery orchestration remains in ChatWindow, with existing behavior intended to stay unchanged.
Changes:
- Moves copy/branch orchestration, lock checks, navigation, and error handling into a focused hook.
- Extracts shared prompt-restoration and conversation-signature helpers.
- Adds 10 hook tests covering copy destinations, locking, navigation guards, recovery delegation, and errors.
| File | Description |
|---|---|
frontend/src/utils/promptRestore.ts |
Extracts converter-restoration and conversation-signature helpers. |
frontend/src/hooks/useConversationCopy.ts |
Encapsulates copy and branch workflows behind typed commands. |
frontend/src/hooks/useConversationCopy.test.ts |
Adds focused workflow and guard coverage. |
frontend/src/components/Chat/ChatWindow.tsx |
Composes the new hook instead of inlining copy/branch logic. |
Review effort: Balanced
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Related to #2652. Extracts the copy/branch orchestration from
ChatWindowinto a focused hook. This is the remaining copy/new-conversation/branch part of the issue; loading landed in #3310 and score/objective/export landed in #3369. Send/recovery orchestration is not touched here.frontend/src/hooks/useConversationCopy.ts: new hook owning copy to new conversation, branch conversation and branch attack, including lock checks, navigation and error handling. Returns typed state and commands.frontend/src/utils/promptRestore.ts: small helper for restoring the prompt/attachments from a copied message.ChatWindow.tsx: now composesuseConversationCopyinstead of inlining these workflows. Props, rendered UX, request payloads and navigation behavior are unchanged.Compatibility checked against open #3670: no conflicts in either merge order, and the combined suite passes (360/360) with both applied.
Tests and Documentation
useConversationCopy.test.tswith 10 cases covering copy, branch conversation, branch attack, lock handling and error paths.tsc: 0 errors. Lint: 0 errors.