You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(mobile): follow desktop's queued-message rules in structured chats - #33980
Stacked on #33977: review the commits after 8494f24.
ELI5
Messages queued in a structured chat now follow desktop's rules on the phone. Turning off "Queue follow-ups" works from the phone. An edit to a queued card is no longer lost when the agent picks the card up. /clear and /compact wait for the same things they wait for on desktop.
Before: the phone had its own copy of the card projection, steer rule and a separate queue reducer, and an image-only queued draft showed a blank card.
Now: the projection, steer, pause, command-waiting and returned-caption rules and the image label live once in src/shared/structured-agent-session-queued-cards.ts (plus native-chat-image-label.ts).
Image-only cards show the image name or "N images", like desktop.
The phone's queue reducer is deleted; it reads the queue from the shared reducer.
Queue follow-ups (agent-sessions Linux support #1). Before: with the setting off, a mid-turn send from the phone still waited as a queued card. Now: both apps use structuredAgentSessionQueueEnabled, and the host's settings.get projection includes nativeChatQueueFollowUps, so with it off the phone sends straight into the running turn like desktop.
Queued edit hand-off (native-chat Fix PTY listener leak, use local restty with selection support #5 / agent-sessions Add Shift+Enter to insert newline in terminal #3). Before: if the card left the queue, Save came back gone or changed, or you switched chats, the phone closed the editor and dropped your text. Now: unsaved text moves into the chat box with desktop's notice ("This message was already sent or removed. Your edit is in the chat box."). queuedEditStanding and the notice copy moved into src/shared/queued-message-edit.ts.
Before: the phone held these only while a prompt was open or the agent was working.
Now: structuredConversationCommandHold and the failure text moved to src/shared/structured-conversation-command-hold.ts. The phone also holds for background tasks, a send still going out, a queued /compact ahead, and a command already running.
A start failure that a row already shows isn't repeated, and errors name the agent.
The phone keeps a small per-chat map of in-flight sends for this.
Why
Desktop logic wins in the mobile/desktop parity audit. The phone ignored a user setting, lost typed edits, and fired commands desktop would hold. One shared rule set fixes all of this.
Linked Issue
Part of the mobile/desktop parity audit
Visual Proof
No device captures for this fleet. The change adopts desktop's existing behavior from these files:
Automated tests added/updated, or explained why not below
Desktop queued-card tests moved with the rule.
The host settings projection has a new spec.
Mobile tests that pinned the deleted copies are removed: the feed reducer test and six caption tests.
Focused root native-chat, shared and runtime-settings tests pass, as do mobile src/session and settings-read-operations tests.
AI Disclosure
Review
Codex review, 3 rounds.
Round 1: an edit could land in the wrong chat after a tab switch (fixed), and a type error from widening the queue type (fixed).
Round 2: the send hold leaked across chats (fixed), and the setting could go stale (now re-read per chat).
Round 3: a published null queue now reads as empty, matching the removed phone reducer.
Rejected: a stale setting while staying in one chat. The phone has no settings stream, so the value is read on connect and chat open.
Agent skill upstream boundary
Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.
Notes
Mobile behavior removed (desktop wins):
Unsaved queued-edit text is no longer dropped; it moves to the chat box.
The editor no longer stays open with a "changed" notice when the card changed before editing began; it closes as on desktop.
After a lost Save reply where the card already holds the edit, the editor closes.
A command counts as accepted only when the host reports it completed with no error.
A second command while one runs shows "agent still working" instead of a silent rejection.
Desktop: no behavior change. The pendingWork notice moved to the shared key writeNotice.pendingWork, with translations moved in all 7 locales.
Deferred features (new phone UI): a Queue follow-ups toggle on the phone, the "Sending…" queued card, and image edits in the phone's queued editor.
Compatibility:
Host change: settings.get also returns nativeChatQueueFollowUps. A missing field (old host) means on, which is the old phone behavior. An old phone ignores the field.
default-global-settings.ts is unchanged.
Folder workspaces, SSH and all host OSes are unaffected.
Checklist
This PR is small and focused
I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
Before/after screenshots or videos attached for UI changes, or N/A with reason
Self-reviewed for correctness, security, and performance
Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)
This pull request moves native-chat logic from mobile and renderer modules into shared helpers. It adds shared handling for pending sends, session-option labels and caching, model discovery, command holds, tool views, image labels, and queued-edit state. Mobile and renderer code now call those helpers for copy text, tool output, diff display, queue cards, and availability checks. Mobile structured option writes now use tracked picks and turn-aware reads. Queue-follow-up settings now flow from runtime settings into send behavior. Many tests were updated or removed with the moved logic.
Priority: Pending latest changes
Merge Risk: Moderate · up to 08168
The change moves native-chat behavior into shared helpers. Its static-analysis check currently fails on a duplicate import that is a trivial fix, and it must pass before merge. Two smaller issues remain: a queued or pending message bubble can linger on a phone whose clock is skewed from the host, and image-only labels may show untranslated English text.
Pre-merge checks: 3 · 2
Failed checks: 2 warnings
Check name
Status
Explanation
Resolution
Docstring Coverage
Docstring coverage is 20.65% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within surv…
Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check
The description explains the scope, user impact, rationale, testing, compatibility, review history, and checklist status. It does not provide an actual linked issue, and the visual-proof section does …
Add the actual issue reference under Linked Issue, such as Fixes #12345 or the applicable existing issue. Add before/after screenshots or a video for the changed mobile behavior; if visual proof is genuinely impossible, write exactly `N/A…
Passed checks: 3 passed
Check name
Status
Explanation
Title check
The title "fix(mobile): follow desktop's queued-message rules in structured chats" matches the main change. The diff moves queued-card projection, queue follow-up enablement, queued-edit hand-off, and…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title "fix(mobile): follow desktop's queued-message rules in structured chats" matches the main change. The diff moves queued-card projection, queue follow-up enablement, queued-edit hand-off, and /clear and /compact holds onto shared logic that desktop and mobile both use. The title is specific, concise, and under 72 characters.
Full details: Docstring Coverage
Explanation
Docstring coverage is 20.65% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 92 functions across 86 files. (8 skipped: 8 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
Full details: Description check
Explanation
The description explains the scope, user impact, rationale, testing, compatibility, review history, and checklist status. It does not provide an actual linked issue, and the visual-proof section does not include the required before/after captures or the exact N/A statement with a valid reason for this behavior/UI change.
Resolution
Add the actual issue reference under Linked Issue, such as Fixes #12345 or the applicable existing issue. Add before/after screenshots or a video for the changed mobile behavior; if visual proof is genuinely impossible, write exactly N/A and briefly explain why.
Finishing Touches: 💡 3
📝 Generate docstrings: 💡
Commit to this branch
Create a new PR
⚔️ Resolve merge conflicts: 💡
Resolve merge conflict in branch mobile-chat-queue-rules
🛠️ Fix failing CI checks: 💡
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Functional Correctness · Quick win
Route the 'Image' fallback through NativeChatImageLabelCopy.
nativeChatImageLabel accepts a copy object so that desktop can pass translated words. The fallback for a block with no alt and no path is still a hardcoded English 'Image'. A block with only a url takes that branch. Desktop then shows an untranslated label in localized chats. Add an image entry to NativeChatImageLabelCopy and to NATIVE_CHAT_IMAGE_LABEL_ENGLISH. Then update the renderer's translated copy.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Functional Correctness · Quick win
Supported by static analysis
Script executed:
#!/bin/bash# Find production callers of captureSendOrigin and check whether they pass a host-aligned sentAt.
rg -nP --type=ts -C3 '\bcaptureSendOrigin\s*\(' mobile/src -g '!**/*.test.*'# Inspect how the shared boundary compares timestamps.
fd -t f 'native-chat-pending-occurrence.ts|native-chat-pending-sends.ts' src/shared --exec rg -nP -C6 'afterMessageTimestamp|messagesAfterPendingBoundary|sentAt' {}
Repository: stablyai/orca
Length of output: 7431
Script executed:
#!/bin/bashset -e
printf'%s\n''--- use-mobile-native-chat-message-send.ts ---'
nl -ba mobile/src/session/use-mobile-native-chat-message-send.ts | sed -n '1,125p'printf'%s\n''--- use-mobile-structured-native-chat-send-bridge.ts ---'
nl -ba mobile/src/session/use-mobile-structured-native-chat-send-bridge.ts | sed -n '1,95p'printf'%s\n''--- captureSendOrigin definitions and related types ---'
rg -n -F --glob '*.ts' --glob '*.tsx' -C8 'function captureSendOrigin' mobile/src src/shared ||true
rg -n -F --glob '*.ts' --glob '*.tsx' -C6 'captureSendOrigin' mobile/src/session src/shared
printf'%s\n''--- changed drafts boundary and send-origin use ---'
nl -ba mobile/src/session/native-chat/composer/use-mobile-native-chat-drafts.ts | sed -n '1,220p'printf'%s\n''--- timestamp producers in the explicit caller ---'
rg -n -F --glob '*.ts' --glob '*.tsx' -e 'sentAt' -e 'Date.now' mobile/src/session/use-mobile-native-chat-message-send.ts mobile/src/session/use-mobile-structured-native-chat-send-bridge.ts
Do not use the phone clock as a host-transcript boundary.
When the structured-chat bridge sends with no transcript tail and the transcript is not settled, captureSendOrigin stores no host timestamp and defaults sentAt to Date.now(). messagesAfterPendingBoundary then filters host rows with message.timestamp >= sentAt. A host echo with a lower timestamp can remain unmatched, so the pending bubble can persist.
Use a host-aligned boundary, or defer matching until an authoritative transcript boundary is available.
The reason will be displayed to describe this comment to others. Learn more.
Major · Maintainability & Code Quality · Quick win
Combine the snapshot imports to unblock static analysis.
Line 20 and the following import read from the same module. Oxlint reports this duplicate import, and --deny-warnings fails the static-analysis job. Add buildNativeChatSessionOptionSnapshot to the following import and remove the separate import. (raw.githubusercontent.com)
Tools
GitHub Actions: PR 33980 | source 83225c4 | workflow 83225c4 | unit full / 17_static analysis and typecheck.txt
[error] 20-20: Command node node_modules/oxlint/bin/oxlint --type-aware --config config/oxlint-code-quality-type-aware.json src config tests --deny-warnings failed because Oxlint reported: "Modules should not be imported multiple times in the same file". The warning was treated as an error by --deny-warnings.
GitHub Actions: PR 33980 | source 83225c4 | workflow 83225c4 | unit full / static analysis and typecheck
[error] 20-20: Oxlint reported that modules should not be imported multiple times in the same file. The check ran with --deny-warnings and failed with exit code 1.
…hed ones
Uses desktop's rule: rows before the send no longer retire an echo, a send that
never lands no longer lets later glued sends retire, and an unmatched echo sits
below later turns.
The phone keeps one option surface per chat, so a pick that lands after leaving
and returning shows there, and a picker command only switches the chat it came
from. Discovered models merge with the seed catalog as on desktop, so Grok keeps
its effort picker. A Claude model switch the phone cannot confirm is never
saved as a launch default.
A tab that runs another agent drops its kept option surfaces, report markers
and cached record, so a fresh session shows its own model. A pick that lands
after the phone moved to another chat is not saved as a launch default.
A write that lands after its tab started another agent no longer publishes the
old agent's record, and a changed OMP switch capability rebuilds the chat's
surface from the cache instead of reviving an older one.
Desktop translation pieces use literal English defaults so the localization gate can read them, the selected-choice lookup is shared once, and the phone keeps one option surface per tab with the agent change detected from the cached record.
…mobile
Desktop and the phone now track picks per option through one shared book: a
repeat of an option on its way waits, other options go together, a lost reply
is not a pick done, and a stale reply only commits its own option. The phone
also re-reads options each turn and after the provider starts, and shows picks
at once while the host is still starting the provider.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #33977: review the commits after 8494f24.
ELI5
Messages queued in a structured chat now follow desktop's rules on the phone. Turning off "Queue follow-ups" works from the phone. An edit to a queued card is no longer lost when the agent picks the card up.
/clearand/compactwait for the same things they wait for on desktop.What Changed
src/shared/structured-agent-session-queued-cards.ts(plusnative-chat-image-label.ts).structuredAgentSessionQueueEnabled, and the host'ssettings.getprojection includesnativeChatQueueFollowUps, so with it off the phone sends straight into the running turn like desktop.queuedEditStandingand the notice copy moved intosrc/shared/queued-message-edit.ts./clearand/compactholds (agent-sessions Improve terminal font rendering, per-pane zoom, and UI zoom #7).structuredConversationCommandHoldand the failure text moved tosrc/shared/structured-conversation-command-hold.ts. The phone also holds for background tasks, a send still going out, a queued/compactahead, and a command already running.Why
Desktop logic wins in the mobile/desktop parity audit. The phone ignored a user setting, lost typed edits, and fired commands desktop would hold. One shared rule set fixes all of this.
Linked Issue
Part of the mobile/desktop parity audit
Visual Proof
No device captures for this fleet. The change adopts desktop's existing behavior from these files:
structured-agent-session-queued-cards.tsuse-structured-agent-session.ts(queue enable)use-structured-agent-session-queued-edit.ts(hand-off)structured-conversation-command-send.ts(holds)Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Desktop queued-card tests moved with the rule.
The host settings projection has a new spec.
Mobile tests that pinned the deleted copies are removed: the feed reducer test and six caption tests.
Focused root native-chat, shared and runtime-settings tests pass, as do mobile
src/sessionandsettings-read-operationstests.AI Disclosure
Review
Codex review, 3 rounds.
nullqueue now reads as empty, matching the removed phone reducer.Agent skill upstream boundary
Notes
Mobile behavior removed (desktop wins):
Desktop: no behavior change. The
pendingWorknotice moved to the shared keywriteNotice.pendingWork, with translations moved in all 7 locales.Deferred features (new phone UI): a Queue follow-ups toggle on the phone, the "Sending…" queued card, and image edits in the phone's queued editor.
Compatibility:
settings.getalso returnsnativeChatQueueFollowUps. A missing field (old host) means on, which is the old phone behavior. An old phone ignores the field.default-global-settings.tsis unchanged.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)