Skip to content

feat(sessions): Add steer and queue messaging modes#2663

Merged
charlesvien merged 3 commits into
mainfrom
feat/steer-queue-messaging
Jun 17, 2026
Merged

feat(sessions): Add steer and queue messaging modes#2663
charlesvien merged 3 commits into
mainfrom
feat/steer-queue-messaging

Conversation

@charlesvien

@charlesvien charlesvien commented Jun 14, 2026

Copy link
Copy Markdown
Member

Problem

Messages sent while the agent was working could only queue until the turn finished, so there was no way to steer a run already in progress.

Closes #1056

Changes

  • Add a Steer/Queue toggle to the composer, a mod+s shortcut and a "Default messaging mode" setting in General settings
  • Steer Claude local turns natively by folding the message into the running turn at the next tool boundary (priority: "next")
  • Fall back to interrupt-and-resend for Codex and cloud sessions
  • Persist a per-task mode override layered over the global default
  • Skip turn-state bookkeeping for steer messages so the running turn keeps its prompt lifecycle
  • Thread steer through the agent prompt router, schema and workspace-server

How did you test this?

Manually

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

@github-actions

github-actions Bot commented Jun 14, 2026

Copy link
Copy Markdown

React Doctor found 1 issue in 1 file · 1 warning.

1 warning

src/features/sessions/components/SessionView.tsx

Reviewed by React Doctor for commit 5534cf3.

@charlesvien charlesvien added the Stamphog This will request an autostamp by stamphog on small changes label Jun 14, 2026

@stamphog stamphog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Complex feature touching agent mid-turn injection, session lifecycle state, and API contracts with zero reviews. The implementation looks architecturally sound, but the behavioral changes to core agent message handling warrant a human reviewer sign-off before auto-approval.

@stamphog stamphog Bot removed the Stamphog This will request an autostamp by stamphog on small changes label Jun 14, 2026
@greptile-apps

greptile-apps Bot commented Jun 14, 2026

Copy link
Copy Markdown
Contributor
Prompt To Fix All With AI
Fix the following 2 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 2
packages/ui/src/features/sessions/hooks/useToggleMessagingMode.ts:29-35
**Queued messages silently dropped on flush error**

`void sessionService.sendPrompt(...)` discards any rejection, so if the session becomes unavailable mid-flush (session ends, network drop, `addDirectoryDialog` open) the messages are permanently lost with no user feedback. The messages were already dequeued before the sends, so there is no recovery path. Wrapping each call in a try/catch — or collecting the promises and surfacing a toast on failure — would prevent silent data loss.

### Issue 2 of 2
packages/ui/src/features/sessions/messagingModeStore.ts:14-27
**`modesByTaskId` grows indefinitely**

Every `setMode` call adds an entry keyed by `taskId` and the store is persisted to disk. There is no eviction — a user with many historical tasks will accumulate stale entries that are never read again. Adding a `clearMode(taskId)` action and calling it when a task is deleted (or sessions are cleaned up) would keep the persisted payload bounded.

Reviews (1): Last reviewed commit: "add steer and queue messaging modes" | Re-trigger Greptile

Comment thread packages/ui/src/features/sessions/hooks/useToggleMessagingMode.ts Outdated
Comment thread packages/ui/src/features/sessions/messagingModeStore.ts
@charlesvien charlesvien force-pushed the feat/steer-queue-messaging branch from 53945a7 to 758d935 Compare June 16, 2026 07:26
@charlesvien charlesvien force-pushed the feat/steer-queue-messaging branch from 758d935 to 5534cf3 Compare June 16, 2026 22:52

Copy link
Copy Markdown
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@charlesvien charlesvien added the Stamphog This will request an autostamp by stamphog on small changes label Jun 17, 2026

@stamphog stamphog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The steer/queue implementation looks technically correct, but this is a T1d-complex feature (444 lines, 20 files) touching core agent mid-turn injection behavior, session lifecycle state (currentPromptId / isPromptPending bookkeeping), and API contracts across five packages — with zero human reviews on the current head. Both existing reviews are bot comments on an older commit.

@stamphog stamphog Bot removed the Stamphog This will request an autostamp by stamphog on small changes label Jun 17, 2026
@charlesvien charlesvien merged commit ba79f92 into main Jun 17, 2026
27 checks passed
@charlesvien charlesvien deleted the feat/steer-queue-messaging branch June 17, 2026 18:46
Gilbert09 added a commit that referenced this pull request Jun 18, 2026
Adds a per-task messaging mode toggle — Steer vs Queue — controlling what
happens when the user sends a message while a session turn is still running.

- Queue (default): messages are held locally while a turn is running and
  flushed as a single combined prompt (in order) when the turn ends.
- Steer: interrupts the running turn and resends immediately. Mobile is
  cloud-only with no native mid-turn inject, so steer maps to
  interrupt-and-resend via the existing cloud cancel command.

New state:
- messagingModeStore: persisted per-task override + global default (Queue).
- messageQueueStore: in-memory buffer with combine/drain/prepend primitives.

The composer gains a touch-friendly toggle pill showing the current mode and
the queued count; settings gains a global default. Sends emit a "Prompt sent"
analytics event carrying is_steer.

Generated-By: PostHog Code
Task-Id: 148dc71c-a24a-4b9a-a9e6-04586e782678
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.

Implement mid-turn message injection

2 participants