Keep the draft when opening the agents view - #1372
Open
snimu wants to merge 2 commits into
Open
Conversation
…iew and restore it on session reopen
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.
What this does
You can now open the agents view while you have an unsent draft in the prompt box. The draft is saved automatically and put back into the editor when you return to that session, with a short "Restored stashed prompt" notice.
Previously, both ways into the agents view (the subagents line under the prompt and the full view) refused with "Send, stash, or clear your draft before opening agents", forcing you to deal with the draft first.
Why
The refusal existed to protect drafts from being lost when the chat view is swapped out. But the protection it asked you to do by hand — stashing — already exists as a mechanism the app manages itself. There was no reason to make it the user's problem.
How it works
Cleanup
The two refusal checks and their message are removed; the test asserting the refusal now asserts the new behavior. The manual stash action stays, since it is useful on its own.
Changes
Lines changed: source +19/−9 (net +10 — the refusal checks went away, the restore-on-open path is new), tests +108/−3, changelog +1/−0.
Checks
npm run checkclean; all touched test files pass, with new tests for the round-trip, manual-stash collision, and no-restore-when-not-flagged cases.Note
Low Risk
Localized interactive-mode UX around prompt stash and agents-view navigation, with broad test coverage and no auth or data-path changes.
Overview
Opening the full or scoped agents view no longer blocks on an unsent prompt draft. The old "Send, stash, or clear your draft before opening agents" checks are removed from
requestAgentsView,openScopedAgentsView, and the agents-view return path.On handoff,
stashDraftForAgentsViewsnapshots the editor (text, images, paste state) into per-session prompt stash withrestoreOnOpen: true, skipping whitespace-only drafts. An existing manual stash is queued behind the auto-stash instead of being overwritten. When the session opens again,restorePromptStashOnOpen(called fromrun()afterinit) puts the draft back into an empty editor; manual stashes without that flag are not auto-restored.Reviewed by Cursor Bugbot for commit 0941ea0. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Keep draft when opening the agents view by auto-stashing and restoring it on reopen
restoreOnOpenmarker and restored into the editor when the session reopens.Macroscope summarized 0941ea0.