Repository navigation
FIX: Do not restore completed sends as unsent drafts - #3888
Open
Vishal Punjabi (vshalpnjabi) wants to merge 6 commits into
Open
Vishal Punjabi (vshalpnjabi) wants to merge 6 commits into
Vishal Punjabi (vshalpnjabi) wants to merge 6 commits into
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Pending-send reconciliation and navigation can erase unsent draft edits, lose converter configuration, and restore an accepted prompt as resendable.
3 open issues
What changed in this PR
This PR addresses #3737 by reconciling preserved Chat drafts with saved history, preventing completed sends from reappearing as unsent prompts. Conversation-switch draft isolation (#3734) remains out of scope.
Changes:
- Records accepted submission IDs in draft handoff snapshots.
- Clears restored prompt content when its text matches saved user history.
- Adds utility and ChatWindow regression tests for navigation during a send.
| File | Description |
|---|---|
frontend/src/utils/chatDraft.ts |
Adds accepted-draft history matching. |
frontend/src/types/index.ts |
Adds the optional accepted submission ID to drafts. |
frontend/src/hooks/useChatDraftHandoff.test.tsx |
Tests accepted-draft matching conditions. |
frontend/src/components/Chat/ChatWindow.tsx |
Records accepted sends and reconciles restored drafts. |
frontend/src/components/Chat/ChatWindow.test.tsx |
Tests leaving Chat during a send and returning after completion. |
Review effort: Balanced
Author
|
@microsoft-github-policy-service agree |
Track accepted submission IDs on the draft handoff snapshot and reconcile them with saved history on return so a send that finished while the user was on Datasets is not restored as unsent.
…leted send Carry the accepted submission only while the composer is unchanged since the send, including across repeated visits before the prompt reaches history. Clearing a completed send now keeps the converter pipelines, as a normal completion does.
cursor
Bot
force-pushed
the
cursor/fix-completed-send-draft-restore-37d2
branch
from
November 6, 2026 08:43
f8b7992 to
2db9a8d
Compare
Author
|
Roman Lutz (@romanlutz) Conflicts with main are resolved and the branch is up to date. Copilot’s three notes were addressed in f8b7992 with replies on each thread. Ready for a look when you have a minute — thanks! |
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
Fixes #3737.
If a send was accepted and you left Chat before it finished (for example by going to Datasets), the composer came back on return with the same prompt and Send enabled, even though the prompt was already in saved history.
Now, when Chat unmounts during an accepted send, the draft handoff snapshot also stores that send's submission ID, as long as the composer hasn't changed since the send. The ID is carried across later visits until the prompt shows up in history or the draft is edited. On return, if the snapshot has an accepted submission ID and saved history already has a user message with that prompt, the composer is cleared instead of restored. The system prompt, objective, temperature, scorer and converter pipelines are kept; text, attachments and converter working state are cleared, the same as after a normal completed send. Drafts without an accepted send, and drafts edited after the send (including added attachments or edited converter output), are restored as before. Nothing is resent automatically.
The match is on prompt text, so if the same text was sent earlier in the conversation, it also counts as saved.
This doesn't touch #3734 (carrying a draft across conversation switches).
Tests and Documentation
ChatWindowtests: (1) the issue's flow: unmount Chat during the send, remount after history has the prompt and reply; (2) an attachment added after a failed status read is kept; (3) the converter pipeline is kept; (4) leaving and returning twice while the send is in flight doesn't restore the prompt. Each fails without the fix and passes with it.historyContainsAcceptedDraftinuseChatDraftHandoff.test.tsx.npm run lint,npx tsc --noEmitandnpm run buildpass.npm run test:coverage: 4123 of 4145 passed. The 22 failures were timeouts in 12 suites while the machine was overloaded. Re-run on their own, those 12 suites passed (516/516).chat.spec.tsandrouting.spec.ts: 33 passed. I didn't run the seeded or backend specs.No docs changes needed.