Repository navigation
fix(mobile): report interrupted native chat sends as delivery-unknown, not failed - #10021
Conversation
…, not failed A terminal.send interrupted mid-flight showed a definite "Message not sent" even when the desktop may have already delivered the text. Three paths were misclassified as definite failures: - Logical relay/direct cutover: migrateTo rejects in-flight requests with LogicalClientCutoverError, which mapped to 'rejected'. Now maps to 'unknown' (held unconfirmed + transcript-echo verification; never retried since terminal.send is non-idempotent). - Suspend/close of a half-open session: the stable logical client blanket- rejected in-flight pendings with plain 'Client suspended'/'Client closed', preempting the physical layer's delivery-unknown marking. It now lets the physical close settle them, so post-write failures stay marked and pre-write failures stay definite. - Relay path: mobile-relay-rpc-session never marked delivery ambiguity at all (timeout, close, link failure). Post-write rejections are now marked; pending entries only exist after the frame reached the authenticated link. Permission, ask-answer, and cancel-Escape surfaces now show "unconfirmed — check chat before retrying" instead of a definite "not sent" on ambiguous outcomes (still not-accepted, never retried). Also consolidates a private copy of isLogicalClientCutoverError in worktree-create-retry. Co-authored-by: Orca <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (15)
🚧 Files skipped from review as they are similar to previous changes (10)
📝 WalkthroughWalkthroughMobile RPC transport now preserves delivery-unknown classification for timeouts, closures, suspensions, and pending-request failures. Native chat sends classify outcomes as accepted, rejected, or unknown, and permission, answer, and cancel flows report distinct errors and avoid stale writes. Tests cover these paths and updated payloads. Skill manifests, release mappings, and snapshot registries also record new revisions and application releases. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
⚔️ Resolve merge conflicts
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Checkov (3.3.8)resources/skills/current-manifest.jsonTraceback (most recent call last): resources/skills/release-mapping.jsonTraceback (most recent call last): resources/skills/snapshot-registry.jsonTraceback (most recent call last): 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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
mobile/src/session/mobile-native-chat-permission-send.ts (1)
39-52: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExtract a shared outcome→message helper. Both sites implement the identical
unknown→unconfirmed-message /rejected→not-sent-message / return-only-if-acceptedbranching, differing only in the action label; one shared helper would keep this consistent as more chat actions adopt the outcome contract.
mobile/src/session/mobile-native-chat-permission-send.ts#L39-L52: replace the inlineif/else ifoutcome branching with a shared helper, e.g.reportUnconfirmedSendOutcome(outcome, 'Response', args.onSendError).mobile/src/session/use-mobile-native-chat-controller.ts#L175-L191: replace the inlineif/else ifoutcome branching inhandleNativeChatCancelAskwith the same shared helper, e.g.reportUnconfirmedSendOutcome(outcome, 'Cancel', onSendError).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 1f93899e-6cae-4e5b-81d8-758236c423da
📒 Files selected for processing (12)
mobile/src/session/mobile-native-chat-permission-send.test.tsmobile/src/session/mobile-native-chat-permission-send.tsmobile/src/session/mobile-native-chat-send.test.tsmobile/src/session/mobile-native-chat-send.tsmobile/src/session/use-mobile-native-chat-answer-send.test.tsmobile/src/session/use-mobile-native-chat-answer-send.tsmobile/src/session/use-mobile-native-chat-controller.tsmobile/src/tasks/worktree-create-retry.tsmobile/src/transport/mobile-relay-rpc-session.test.tsmobile/src/transport/mobile-relay-rpc-session.tsmobile/src/transport/stable-logical-rpc-client.test.tsmobile/src/transport/stable-logical-rpc-client.ts
cfd6530 to
0c79c9a
Compare
…, not failed (stablyai#10021) * fix(mobile): report interrupted native chat sends as delivery-unknown, not failed A terminal.send interrupted mid-flight showed a definite "Message not sent" even when the desktop may have already delivered the text. Three paths were misclassified as definite failures: - Logical relay/direct cutover: migrateTo rejects in-flight requests with LogicalClientCutoverError, which mapped to 'rejected'. Now maps to 'unknown' (held unconfirmed + transcript-echo verification; never retried since terminal.send is non-idempotent). - Suspend/close of a half-open session: the stable logical client blanket- rejected in-flight pendings with plain 'Client suspended'/'Client closed', preempting the physical layer's delivery-unknown marking. It now lets the physical close settle them, so post-write failures stay marked and pre-write failures stay definite. - Relay path: mobile-relay-rpc-session never marked delivery ambiguity at all (timeout, close, link failure). Post-write rejections are now marked; pending entries only exist after the frame reached the authenticated link. Permission, ask-answer, and cancel-Escape surfaces now show "unconfirmed — check chat before retrying" instead of a definite "not sent" on ambiguous outcomes (still not-accepted, never retried). Also consolidates a private copy of isLogicalClientCutoverError in worktree-create-retry. Co-authored-by: Orca <[email protected]> * chore(skills): regenerate skill-bundle manifest artifacts --------- Co-authored-by: Orca <[email protected]>
Summary
A mobile native-chat
terminal.sendinterrupted mid-flight showed a definite "Message not sent" even when the desktop may have already delivered the text — inviting a manual resend and a double-delivered message. #9792 fixed this for physical ack-loss on direct sockets; this PR covers the three remaining interruption paths:migrateTorejects in-flight requests withLogicalClientCutoverError; the chat send path now maps it to'unknown'(held unconfirmed + verified via transcript echo) instead of'rejected'. Never retried:terminal.sendis non-idempotent, and a cutover cannot tell whether the frame was written.'Client suspended'/'Client closed', preempting the physical layer's accurate delivery-unknown marking (the marked rejection landed second on a settled promise and was dropped).suspendActiveSessionfires exactly on network handoff with a half-open relay. The logical client now lets the physicalclose()settle in-flight requests, so post-write failures surface marked and pre-write failures stay a truthful definite'rejected'. Pre-send guards and themigrateTocutover-error contract (relied on by idempotent retry callers likeworktree-create-retry) are unchanged.mobile-relay-rpc-sessiontimeout/close/link-failure rejections were unmarked, so even plain ack-loss over relay (the original fix(mobile): stop reporting delivered chat messages as "Message not sent" #9792 scenario) read as a definite failure there. Post-write rejections are now marked; sound because a pending entry only exists after its frame reached the authenticated E2EE link.User-visible copy: the main chat send holds
'unknown'as "Delivery unconfirmed — check chat before retrying" (existing behavior, now reachable on these paths). Permission responses, ask answers, and cancel-Escape now say "Response/Answer/Cancel unconfirmed — check chat before retrying" instead of a definite "not sent" on ambiguous outcomes; they still return not-accepted (card stays visible) and never retry.Also consolidates a private copy of
isLogicalClientCutoverErrorinworktree-create-retry.tsinto the shared export.Screenshots
No visual layout change — only error-toast copy on ambiguous outcomes (strings above).
Testing
pnpm lint(mobile)pnpm typecheck(mobile)pnpm test(mobile: 312 files, 2267 passed / 2 skipped)pnpm build— not run; change is mobile-only (Expo app), no desktop build impact'unknown'; permission/answer surfaces report ambiguity honestlyAI Review Report
Adversarial review of the original one-line cutover fix traced the full rejection flow through
stable-logical-rpc-client,rpc-client, andmobile-relay-rpc-session. Main risks checked: double-send (none — no caller retries on'unknown'/false; verified all four send surfaces), false-definite failures (found on suspend/close and the whole relay path — fixed here), false-ambiguous regressions (pre-write failures verified to stay unmarked: connect-waiter and pre-send rejections still map to'rejected'), and themigrateToretry contract for idempotent callers (unchanged; covered by existing tests). Also verified therejectPendingmark cannot leak throughgetFailure()consumers (guarded to only mark when requests were actually pending, and those consumers classify by message/instanceof).Cross-platform: mobile-only (React Native/Expo) — no Electron, desktop shortcuts, path handling, or shell behavior touched; no platform-conditional code paths involved. Runs identically on iOS/Android/web targets since all changes are transport/state logic.
Security Audit
No new input handling, command execution, path handling, auth, or dependency surface. The delivery-unknown mark is a module-private
WeakSetmembership on existing error objects — no new error-message parsing beyond the pre-existing cutover message match, no data added to errors, nothing logged or transmitted. E2EE relay framing and credential flows untouched. No follow-up needed.Notes
Accepted precision limit: a cutover can reject a request whose frame never left the device (still waiting for connect); that now reads "unconfirmed" instead of a clean "not sent". Safe direction — costs one check-chat, can never cause a double-send.
Made with Orca 🐋