feat(web): optionally auto-send the next stashed prompt when a turn ends - #5156
feat(web): optionally auto-send the next stashed prompt when a turn ends#5156Bil0000 wants to merge 1 commit into
Conversation
The prompt stash is a parking spot: prompts written while an agent is busy sit there until they are restored by hand. This adds an opt-in setting (Settings -> General -> "Stashed prompts", off by default) that drains the stash automatically instead — when the open thread finishes a turn, the oldest entry is restored into the composer and sent, so follow-ups go out in the order they were stashed, one per turn. The trigger is edge-triggered on the turn settling rather than level- triggered on an idle thread, so a stash that is merely sitting in an idle thread — or one that predates switching the setting on — stays put. It also holds back when the turn was interrupted or failed (the session settles as "disconnected" rather than "ready"), when the user has their own content in the composer, and when an approval, a plan question, or a plan follow-up owns the composer.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ApprovabilityVerdict: Needs human review This PR adds a new user-facing feature that automatically sends stashed prompts when a chat turn ends. New features introducing automated behavior changes warrant human review, especially from a first-time contributor to these files. You can customize Macroscope's approvability policy. Learn more. |
What
Adds an opt-in setting that drains the prompt stash automatically: when the open thread finishes a turn, the oldest stashed prompt is restored into the composer and sent.
Settings → General → "Stashed prompts", off by default — the stash stays a parking spot unless you ask for a queue.
Motivation: the stash already exists for prompts you write while an agent is busy (⌘S), but every one of them has to be restored by hand afterwards. With this on, follow-ups go out in the order they were stashed, one per turn.
How
autoSendStashedPromptsjoinsClientSettings(per-client, like the stash itself, which lives inlocalStorage), defaulting tofalse.shouldAutoSendStashedPrompt(apps/web/src/components/chat/composerStashAutoSend.ts) is the whole decision, kept pure and unit-tested rather than buried in the composer.ChatComposerevaluates it on every render pass and, when it passes, restores the oldest entry through the existingrestoreStashEntrypath and submits.The trigger is edge-triggered on the turn settling, not level-triggered on an idle thread. A stash sitting in a thread that is already idle — or one that predates switching the setting on — stays put; otherwise merely opening a thread would fire off a prompt. It also holds back when:
disconnected, notready) — carrying on from where you hit stop is the opposite of what you asked for;The send is deliberately deferred by one commit:
restoreStashEntrywrites through the draft store, and the image refonSendreads is only synced from it in an effect, so sending in the same pass would ship the prompt without its attachments.Testing
composerStashAutoSend.test.ts— 8 cases over the predicate (each hold-back branch, plus the happy path).settings.test.ts— the default stays off and the patch carries an opt-in.pnpm fmt:check,typecheck(contracts/web/desktop),lint(no new findings), contracts + touched web suites.Notes
Note
Add auto-send for stashed prompts when a chat turn ends
autoSendStashedPromptsboolean setting (defaultfalse) toClientSettingsSchemaand exposes a toggle in the General settings panel under 'Stashed prompts'.ChatComposerdetects the transition from a working to idle thread state and automatically restores and sends the oldest stashed prompt, provided the composer is empty and sending is not blocked.shouldAutoSendStashedPromptwith full unit test coverage.Macroscope summarized 0d0d81b.