Skip to content

feat(web): optionally auto-send the next stashed prompt when a turn ends - #5156

Open
Bil0000 wants to merge 1 commit into
pingdotgg:mainfrom
Bil0000:t3code/stash-auto-send-setting
Open

feat(web): optionally auto-send the next stashed prompt when a turn ends#5156
Bil0000 wants to merge 1 commit into
pingdotgg:mainfrom
Bil0000:t3code/stash-auto-send-setting

Conversation

@Bil0000

@Bil0000 Bil0000 commented Jul 31, 2026

Copy link
Copy Markdown

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

  • autoSendStashedPrompts joins ClientSettings (per-client, like the stash itself, which lives in localStorage), defaulting to false.
  • shouldAutoSendStashedPrompt (apps/web/src/components/chat/composerStashAutoSend.ts) is the whole decision, kept pure and unit-tested rather than buried in the composer.
  • ChatComposer evaluates it on every render pass and, when it passes, restores the oldest entry through the existing restoreStashEntry path 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:

  • the turn was interrupted or failed (the session settles as disconnected, not ready) — carrying on from where you hit stop is the opposite of what you asked for;
  • you have your own content in the composer — yours wins;
  • an approval, a plan question, or a plan follow-up owns the composer, i.e. anything you could not send by hand right now.

The send is deliberately deferred by one commit: restoreStashEntry writes through the draft store, and the image ref onSend reads 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.
  • End-to-end against a local dev instance with real Claude turns, driven headlessly: stashed a prompt mid-turn → with the setting off it survived the finished turn unsent → enabled the setting → on the next turn ending, the stashed prompt was sent on its own and the stash emptied.
  • pnpm fmt:check, typecheck (contracts/web/desktop), lint (no new findings), contracts + touched web suites.

Notes

  • The stash is global while the auto-send fires in the thread whose composer is mounted, so entries drain into the thread you are looking at. Deliberate: nothing is ever sent into a thread you are not watching.
  • Nothing in the stash menu advertises that auto-send is armed. Happy to add a hint there if reviewers want the discoverability.

Note

Add auto-send for stashed prompts when a chat turn ends

  • Adds a new autoSendStashedPrompts boolean setting (default false) to ClientSettingsSchema and exposes a toggle in the General settings panel under 'Stashed prompts'.
  • When enabled, ChatComposer detects 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.
  • The auto-send decision is extracted into a pure function shouldAutoSendStashedPrompt with full unit test coverage.
  • 'Stashed prompts' is added to settings search and to the restore-defaults flow.

Macroscope summarized 0d0d81b.

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.
@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7ea00690-089e-432e-bb5c-066187c0128a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Jul 31, 2026
@Bil0000
Bil0000 marked this pull request as ready for review July 31, 2026 23:51
@macroscopeapp

macroscopeapp Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant