Skip to content

Keep the draft when opening the agents view - #1372

Open
snimu wants to merge 2 commits into
mainfrom
feat/agents-view-draft-autostash
Open

Keep the draft when opening the agents view#1372
snimu wants to merge 2 commits into
mainfrom
feat/agents-view-draft-autostash

Conversation

@snimu

@snimu snimu commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

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

  • When you head to the agents view with a draft, the draft (including text, images, and paste state) is saved into the same per-session stash that the manual stash feature uses, marked to be restored automatically.
  • When you come back to that session, the draft is placed back into the editor if it is empty.
  • If you had already stashed something manually, it is kept — the automatic one lines up in front of it instead of overwriting it.
  • Pressing left inside a non-empty draft still moves the cursor; nothing about typing changed.

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 check clean; all touched test files pass, with new tests for the round-trip, manual-stash collision, and no-restore-when-not-flagged cases.
  • Went through three review rounds; the first two caught real edge cases (whitespace-only drafts, one uncovered entrance, a double-save on rapid re-entry) that the final version handles.
  • Validated end-to-end in a real terminal session: type a draft, open the subagents view, come back — the draft is intact; same for the full agents view and across both entrances.

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, stashDraftForAgentsView snapshots the editor (text, images, paste state) into per-session prompt stash with restoreOnOpen: 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 from run() after init) 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

  • Previously, opening the agents view (full or scoped) was blocked when the editor contained a draft. Now the draft is auto-stashed with a restoreOnOpen marker and restored into the editor when the session reopens.
  • Any existing manual stash is preserved by moving it into the queued stashes behind the auto-stash.
  • Whitespace-only drafts are ignored and not stashed.
  • Behavioral Change: the guards blocking agents-view navigation while a draft exists are removed; users can now always open the agents view.

Macroscope summarized 0941ea0.

Comment thread packages/coding-agent/src/modes/interactive/interactive-mode.ts Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant