feat(sessions): Add steer and queue messaging modes#2663
Conversation
|
React Doctor found 1 issue in 1 file · 1 warning. 1 warning
Reviewed by React Doctor for commit |
There was a problem hiding this comment.
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.
Prompt To Fix All With AIFix 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 |
53945a7 to
758d935
Compare
758d935 to
5534cf3
Compare
There was a problem hiding this comment.
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.
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

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
mod+sshortcut and a "Default messaging mode" setting in General settingspriority: "next")steerthrough the agent prompt router, schema and workspace-serverHow did you test this?
Manually
Automatic notifications