Repository navigation
fix(mobile): report a partly-sent ask answer honestly (STA-3333) - #12503
brennanb2025 wants to merge 1 commit into
Conversation
An ask-answer chain that was aborted mid-sequence (session swap, input lease loss, Stop, a superseding answer) returned silently even when earlier keystroke groups had already been accepted by the host. The card was left looking cleanly sent while the remote selector sat half-stepped, so a retry replayed a from-scratch key plan onto an advanced position. Route the abort paths through the existing fail() reporter and let it speak when the chain wrote something, not only when it is still the current generation: an accepted group reports "Answer partly sent", an ambiguous one "Answer unconfirmed". A chain that never got a keystroke onto the wire stays silent, so a superseded answer the user replaced on purpose does not raise a banner. Refs STA-3333.
|
Warning Review limit reached
Next review available in: 31 seconds You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
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 |
|
Moving this PR to draft because it has been untouched for more than 80 days (latest recorded PR activity or commit timestamp: 2026-08-04T09:59:20Z; checked on 2026-10-27). This keeps the review queue focused on active work while preserving the proposal. Please mark it ready for review when work resumes. |




Summary
Split from #12373 (fix 7 of that PR's list) — this PR is independent and targets
main; #12373 stays open and untouched.A mobile ask-answer send for Claude/Codex is a paced sequence of keystroke groups, not one write. If the chain was aborted mid-sequence — chat session swap, acknowledged input lease loss, Stop, or a superseding answer — it returned silently, even when earlier groups had already been accepted by the host. The user saw the card end cleanly, while the remote selector actually sat half-stepped on a later question. Retrying then replayed a from-scratch key plan onto an advanced position and answered the wrong question.
Three abort paths bypassed the existing
fail()reporter (return falseinstead ofreturn fail()), andfail()itself only spoke while the chain was still the current generation — which an abort has by definition already invalidated. So the one case that most needed a warning was the one guaranteed to stay quiet.Now:
fail().fail()speaks when the chain wrote something, not only when it is still current: an accepted group reportsAnswer partly sent — check chat before retrying, an ambiguous oneAnswer unconfirmed — check chat before retrying.wait()returns immediately when the chain is already superseded, so the report is not delayed by a full pacing step.The wording and the accepted/unknown precedence are the ones already used by this hook's budget-exhaustion path and by the Stop sender, so no new user-facing vocabulary is introduced.
Deliberately not in this PR: the shared PTY write lock / send serialization (fix 8 of #12373). That is a separate concern and is being split separately — this change only identifies and reports a partial send.
Screenshots
No visual change— the existing composer send-error banner is reused verbatim; only the conditions under which it is raised changed.Testing
pnpm lint— rootoxlintand mobileoxlintclean on the changed files;audit:code-quality:nativeclean;check:max-lines-ratchetOK (352 grandfathered, no new bypasses);lint:react-doctor:changedclean. Nomax-linesdisable added or bumped (source file is 248 lines against a 300 cap).pnpm typecheck— mobiletsc --noEmitclean.pnpm test— full mobilesrc/sessionsuite: 114 files, 908 passed. Focused file: 21 passed.pnpm build— not run; no build-affecting change (pure hook logic, no new module, no dependency change). CI covers it.Tests added to
use-mobile-native-chat-answer-send.test.ts, one per abort trigger plus a negative guard:Each of the four positive tests was confirmed to fail against the unmodified source and pass with it, so none is vacuous. The negative test passes both ways by design — it exists to pin the no-false-banner boundary.
AI Review Report
Reviewed with focus on:
generation === generation || sawAcceptedGroup || sawUnknownOutcome, so an aborted chain that wrote nothing is still silent. Locked by the negative test. This matters because a deliberate answer change is a common, non-error interaction.use-mobile-native-chat-send-error.ts:show()compares the scope the callback was built for against the live scope and falls back to a toast when they differ or the banner is unmounted, so a late report cannot paint or wipe another tab's banner. This pre-existing guard is exactly what makes reporting from an aborted chain safe; no change was needed there.onSendResolvedviauseNativeChatAcceptedActionand retires it — the end state matches today's behavior, with the warning visible only if the replacement also fails or is slow.acceptedoutranksunknown: a definitely-half-stepped selector is the more actionable warning, and an ambiguous write is never presented as a definite failure (double-send hazard).answerAskstill resolvesfalseon every abort, so the accepted-action wrapper does not retire the banner just raised. No caller contract changed.terminal.sendRPC. No Electron-specific surface involved.Security Audit
No new input parsing, command execution, path handling, auth, or secret handling. No IPC/RPC surface change — the same
terminal.sendrequest is made under the same conditions; only the client-side interpretation of an already-received outcome changed. The two new banner strings are fixed literals, never server-echoed content, so there is no injection or data-leak path. No dependency changes. Byte-for-byte, this PR writes nothing to the PTY that it did not write before — it only stops staying quiet about what it already wrote. No follow-up needed.Notes
Answer partly sentwhen groups already landed. That is intended: Stop cannot un-send committed keystrokes, and the selector really is half-stepped.