Repository navigation
Preserve queued command and card order through recovery - #36430
Conversation
Released clients read the v1 name with an unfinished queue UI; they never see v2 and keep sending immediately.
The follow-up choice is now a Queue / Steer setting saved under nativeChatFollowUpBehavior, Steer by default; the old nativeChatQueueFollowUps switch, which every install saved as true while queueing was dark, is retired on load. Every reader goes through native-chat-follow-up-behavior. While the agent works, Enter follows the setting and Cmd/Ctrl+Enter sends the draft the other way; the alternate flips the setting before the queue's own rules (a waiting command still queues, prompts no one here can answer still send now) and never applies while Stopping. Cmd/Ctrl+Shift+Enter steers the head card only and leaves the draft. An idle agent's card reads Send, and the card menu no longer offers "Turn off queueing".
While the agent works on a host that queues, holding Send opens a Queue / Steer sheet; a choice other than the host's setting sends the alternate, resolved against the chat as it is when it lands, by the desktop's rule. Release and dismiss send nothing. The phone reads the host's new follow-up setting (absent reads as Steer), and an idle agent's card reads Send.
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review.
|
There was a problem hiding this comment.
Actionable comments posted: 4

Review info
-
Run configuration-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
0ce198e8-d24f-437b-ba4b-efec20f458d0
Files selected for processing: 97-
mobile/src/components/composer-input/ComposerSendButton.tsxmobile/src/i18n/locales/de.jsonmobile/src/i18n/locales/en.jsonmobile/src/i18n/locales/es.jsonmobile/src/i18n/locales/fr.jsonmobile/src/i18n/locales/ja.jsonmobile/src/i18n/locales/ko.jsonmobile/src/i18n/locales/pt.jsonmobile/src/i18n/locales/ru.jsonmobile/src/i18n/locales/tr.jsonmobile/src/i18n/locales/zh-Hant.jsonmobile/src/i18n/locales/zh.jsonmobile/src/session/MobileNativeChatOverlay.tsxmobile/src/session/MobileNativeChatView.tsxmobile/src/session/MobileQueuedMessageCardRow.tsxmobile/src/session/mobile-native-chat-controller-contract.tsmobile/src/session/mobile-structured-agent-session-contract.tsmobile/src/session/mobile-structured-agent-session-send.tsmobile/src/session/native-chat/composer/MobileNativeChatComposer.structured.test.tsmobile/src/session/native-chat/composer/MobileNativeChatComposer.tsxmobile/src/session/native-chat/composer/MobileNativeChatSendButton.tsxmobile/src/session/native-chat/composer/mobile-native-chat-draft-inputs.tsmobile/src/session/native-chat/composer/use-mobile-native-chat-composer-tray.tsmobile/src/session/native-chat/composer/use-mobile-native-chat-image-attachments.tsmobile/src/session/native-chat/input/MobileNativeChatQueuedMessages.tsxmobile/src/session/native-chat/mobile-native-chat-send.tsmobile/src/session/use-mobile-native-chat-controller.tsmobile/src/session/use-mobile-native-chat-queue-follow-ups.tsmobile/src/session/use-mobile-session-image-attachments.tsmobile/src/session/use-mobile-structured-agent-session-queued.test.tsxmobile/src/session/use-mobile-structured-agent-session.tsmobile/src/session/use-mobile-structured-native-chat-send-bridge.tsmobile/src/session/use-mobile-structured-send-with-outcome.tsmobile/src/session/use-mobile-structured-turn-indicator.tsmobile/src/transport/settings-read-operations.tssrc/main/persistence/applying-settings/persistence-settings-ui-defaults.test.tssrc/main/persistence/applying-settings/terminal-settings-migrations.tssrc/main/runtime/rpc/methods/structured-agent-session-queued-edit.test.tssrc/main/runtime/rpc/methods/structured-agent-session-queued-methods.tssrc/main/runtime/runtime-client-settings-shape.tssrc/main/runtime/runtime-client-settings.tssrc/main/runtime/runtime-store-contract.tssrc/main/runtime/structured-agent-session-codex-turn-end-settlement.test.tssrc/renderer/src/components/native-chat/NativeChatAgentMessageRow.test.tsxsrc/renderer/src/components/native-chat/NativeChatComposerPane.tsxsrc/renderer/src/components/native-chat/NativeChatQueuedMessageCard.tsxsrc/renderer/src/components/native-chat/NativeChatQueuedMessageComposer.raw-task.test.tsxsrc/renderer/src/components/native-chat/NativeChatQueuedMessageList.arrival.test.tsxsrc/renderer/src/components/native-chat/NativeChatQueuedMessageList.inline-edit.test.tsxsrc/renderer/src/components/native-chat/NativeChatQueuedMessageList.test.tsxsrc/renderer/src/components/native-chat/NativeChatQueuedMessageList.tsxsrc/renderer/src/components/native-chat/NativeChatStructuredSession.stopping.test.tsxsrc/renderer/src/components/native-chat/NativeChatStructuredSession.test-harness.tsxsrc/renderer/src/components/native-chat/NativeChatStructuredSession.test.tsxsrc/renderer/src/components/native-chat/NativeChatStructuredSession.tsxsrc/renderer/src/components/native-chat/native-chat-composer-types.tssrc/renderer/src/components/native-chat/native-chat-structured-composer-dispatch.tssrc/renderer/src/components/native-chat/native-chat-structured-stop-controls.tssrc/renderer/src/components/native-chat/native-chat-submission-navigation.test.tsxsrc/renderer/src/components/native-chat/structured-agent-session-queue-request.test.tssrc/renderer/src/components/native-chat/structured-agent-session-queue-request.tssrc/renderer/src/components/native-chat/structured-agent-session-send-slot.tssrc/renderer/src/components/native-chat/structured-agent-session-view-contract.tssrc/renderer/src/components/native-chat/use-native-chat-composer-edit-session.tssrc/renderer/src/components/native-chat/use-native-chat-composer-keydown.steer.test.tsxsrc/renderer/src/components/native-chat/use-native-chat-composer-keydown.tssrc/renderer/src/components/native-chat/use-native-chat-composer-submit.tssrc/renderer/src/components/native-chat/use-native-chat-structured-composer-send.tssrc/renderer/src/components/native-chat/use-structured-agent-session-queued-messages.test.tsxsrc/renderer/src/components/native-chat/use-structured-agent-session-queued-messages.tssrc/renderer/src/components/native-chat/use-structured-agent-session-sends.tssrc/renderer/src/components/native-chat/use-structured-agent-session.queued-gating.test.tsxsrc/renderer/src/components/native-chat/use-structured-agent-session.tssrc/renderer/src/components/native-chat/use-structured-native-chat-submit-reveal.test.tssrc/renderer/src/components/native-chat/use-structured-native-chat-submit-reveal.tssrc/renderer/src/components/settings/ChatBehaviorSetting.test.tsxsrc/renderer/src/components/settings/ChatBehaviorSetting.tsxsrc/renderer/src/components/settings/chat-behavior-search.tssrc/renderer/src/i18n/locales/de.jsonsrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/i18n/locales/es.jsonsrc/renderer/src/i18n/locales/fr.jsonsrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.jsonsrc/renderer/src/i18n/locales/pt.jsonsrc/renderer/src/i18n/locales/ru.jsonsrc/renderer/src/i18n/locales/tr.jsonsrc/renderer/src/i18n/locales/zh-Hant.jsonsrc/renderer/src/i18n/locales/zh.jsonsrc/shared/agent-session-runtime-capabilities.tssrc/shared/agent-session-wire.tssrc/shared/default-global-settings.tssrc/shared/global-settings-types.tssrc/shared/native-chat-follow-up-behavior.tssrc/shared/rpc-contract/structured-agent-session-params.tssrc/shared/structured-agent-session-queued-cards.test.tssrc/shared/structured-agent-session-queued-cards.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.
-
|
A client with an old queue snapshot could send past a waiting Reviewed and QA-tested head: The review repaired order/recovery ownership, complete-cohort restoration before cleanup, transactional rollback and original receipt handling. Production fixtures cover stale-direct command order, original body/options/images, Stop and uncertain outcomes, replacement/reopen, format conversion and failure rollback. Performance contracts measure bounded operations on larger corpora, not whole-app latency. The final two-file repair ran all 29 tests successfully without changing production. The final common-pattern comparison and readiness source review carry across those test-only commits. Real Claude and Codex runs used previous-build saved conversations and terminal histories, then the normal UI through actual replies. Saved card IDs/order and known history carried; edited and explicit sends delivered the selected text once. Both agents completed queued Limits and carried concerns:
For Brennan's reviewFull-window screenshots from the admitted QA round follow. The prior build is pinned main
Claude targeted compact completion (Codex compact result is visible in the Stop result above):
Two places for human judgment:
Readiness tracking is resolved: the carried phone-only-preference deferral remains Temporary and is tracked in STA-13101. |















Problem
A later send can run ahead of a waiting
/compactwhen its client has an old queue snapshot. Stop, restart and history replacement can also expose gaps in how waiting cards retain their order and original delivery identity. The stale-client case is tracked in STA-13076.What changes for users
This follows the queue controls shipped in #36588. This PR keeps waiting commands and their earlier messages ahead of later sends, including a direct steer from a client that has not seen the command yet.
Editing or removing an earlier card does not let a later input jump the work already running. Delivery, Stop, restart, rewind and history replacement preserve each message's identity, original receipt and required queue order. A send whose outcome is uncertain is not automatically repeated. Stop keeps its existing cancellation and preparation behavior.
How it works
The host chooses the next input from the current saved queue before handing it to the agent. Each input retains its own place and source evidence; recovery preserves the earlier work it still owes while respecting cards the user moved. History replacement carries those relationships and original acceptance receipts into the new history. Current card state controls whether delivery may proceed. No new saved send mode or Stop state is added.
Dependency and compatibility
#36588 is merged into main. This follow-up keeps its queue controls and default.
The switch advertises
agent-session.queued-messages.v2; older paired hosts retain their existing launch and send paths, with no minimum host version. The current older-phone adapter remains unchanged; the deferred choice below remains separate from this ordering fix.Differences from the common pattern
The control/default and phone labels below carry forward the approved behavior already shipped in #36588; this follow-up changes ordering and recovery.
Verification
Reviewed head:
89feff1f29e584d053bf85f5034da688b75c70c2. Main is merged, the PR is out of draft, and all executed head checks passed: 35 successful checks and 17 skipped. All twelve unit shards, static analysis/typecheck, both package jobs and wire compatibility passed. Skipped checks are not execution evidence.Production fixtures cover stale-client command order, original IDs and acceptance receipts, attachments, Stop/uncertain outcomes, replacement/reopen, conversion and rollback. Performance contracts bound operations on larger corpora; they do not claim whole-app latency. The final two-file test-contract repair passed all 29 tests without changing production.
Previous-build state was carried through graceful upgrade and normal delivery with real Claude and Codex. Both completed queued compact before later text, Stop/header Resume, edit/explicit Send, idle Rewind with a context-aware reply, and terminal-history adoption with a real continuation. Saved IDs/order and known history survived; named replies arrived once. Full-window screenshots are in the review status comment.
Draft survival remains unverified because the QA renderer origin changed; the old draft bytes are preserved. Rewind with waiting cards remains disabled by unchanged main code; the app run covered the supported idle action, while production fixtures cover retained-cohort replacement. Existing restart pause labels and explicit-send release behavior are unchanged.
The exact held-arrow browser case was run once on this head in the admitted QA checkout with required mobile dependencies: 1 passed, 9 filtered out. The historical main-path failure did not reproduce; its cause remains unknown. No delay, tolerance or timing repair was added. Historical failed job.
A historical agent-failure checkpoint observed zero callbacks where it expected one. Its cause remains unknown and the observation is unrefuted. One bounded source investigation/probe did not establish a PR-caused user-visible defect; its passing checkpoints do not explain the historical failure. Historical failed job.
The Windows compiler-parity check initially timed out without output. One failed-only retry on the same source passed all twenty parity entries with unchanged deadlines and checks; the original timeout cause remains unknown. Successful retry.
The unchanged optimistic-reorder shortcut can send the former head during a queue preview. This separate main bug is tracked in STA-13165; it is not repaired here.