Repository navigation
fix(mobile): hold Japanese kana composition off the PTY until a real boundary - #11450
brennanb2025 wants to merge 10 commits into
Conversation
|
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:
📝 WalkthroughWalkthroughThe terminal composition mirror now classifies Hangul and Kana trailing code points with distinct held commit policies. Mirror steps expose those policies and preserve Kana modifier pairs. Pending-input handling queues boundary sends, reconciles disconnects, and starts timers only for timer-based holds. External terminal input, paste, dictation, accessories, and image attachments now use boundary callbacks. Tests cover ordering, failure handling, Kana composition, normalization, and updated integrations. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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 |
Greptile SummaryThis PR fixes Japanese kana composition leaking provisional bytes to the PTY on flick keyboards by introducing a
Confidence Score: 5/5Safe to merge. All changed paths target mobile terminal byte delivery only, with no shared server or desktop logic touched. The kana hold logic is deterministic and validated by AVD simulation. Recovery paths are self-correcting even in edge cases. The core kana boundary hold and all async guard paths are clearly reasoned, well-tested (391 files, 2,932 passed), and validated on real hardware. The two findings are both narrow edge cases (Return rejection on an empty field; callback-recreation frequency) that self-correct and carry no data-loss or PTY-corruption risk. No correctness, security, or ordering issues were found on any of the main code paths. Files Needing Attention: terminal-live-boundary-field-recovery.ts and use-terminal-live-input-boundary.ts — the null-recoveryToken recovery path and the snapshot-ordering logic are the most intricate parts of the new code and merit the closest future read.
|
| Filename | Overview |
|---|---|
| mobile/src/terminal/terminal-live-composition-mirror.ts | New file: adds kana code-point ranges and 'boundary' hold policy; getTerminalLiveHeldSuffixLength correctly holds 2 code points when a combining mark follows a non-modifier kana base. Clean. |
| mobile/src/terminal/terminal-live-boundary-field-recovery.ts | New file: snapshot-based field recovery for rejected/unknown boundary sends. recoverTerminalLiveRejectedBoundary with a null token treats all snapshots as dependent and prepends recoveryBytes to state.currentCaptureText — can transiently set live input to boundary bytes (e.g. '\r') when called on an empty-field rejection. |
| mobile/src/terminal/use-terminal-live-input-boundary.ts | New file: orchestrates flush-then-send ordering, boundary field reservation/release, and one-shot retry for rejected Return. The null-recoveryToken path when no pending mirror state exists has a minor state-corruption edge case on rejection with non-empty recoveryBytes. |
| mobile/src/terminal/use-terminal-live-pending-input-flush.ts | Refactored: switched from useEffect to useLayoutEffect for runMirrorStepRef/dispose teardown; added liveInputGeneration/lifecycleEpoch guards. isLiveInputProducerCurrent is returned as a plain inline arrow (not useCallback), causing dependent useCallback hooks to re-create every render. |
| mobile/src/terminal/terminal-live-pending-flush-state.ts | Added module-level terminalLiveHandleSendTails for per-handle send serialization and queueTerminalLiveBoundarySend. Cleanup logic correctly removes entries when sends settle. Clean. |
| mobile/src/terminal/terminal-live-mirror-payload-send.ts | New file: handles mirror payload send, rejection recovery (recoverTerminalLiveBoundaryFields), and unknown-delivery path (clears state, calls onDeliveryUnknown). Generation/epoch guards prevent stale callbacks from triggering recovery. |
| mobile/src/terminal/use-terminal-live-input-commit.ts | Refactored: replaces flushPendingLiveInputBeforeExternalSend with sendLiveInputExternalBoundary and liveInputProducerGeneration; adds isLiveInputProducerCurrent guard to all handlers. Clean. |
| mobile/app/h/[hostId]/session/[worktreeId].tsx | Wires terminalInputScope/terminalInputStateReady, useTerminalInputCommittedSnapshot, useTerminalAccessoryRepeat, useTerminalGestureInputQueue, and liveInputProducerGeneration through the session screen; removes direct clientRef/connStateRef mutations in favour of committed snapshot hook. Clean. |
Sequence Diagram
sequenceDiagram
participant User as User (flick keyboard)
participant Commit as useTerminalLiveInputCommit
participant Flush as useTerminalLivePendingInputFlush
participant Mirror as computeTerminalLiveMirrorStep
participant Boundary as useTerminalLiveInputBoundary
participant PTY as PTY (terminal.send RPC)
User->>Commit: onChangeText("ka")
Commit->>Flush: applyLiveInputMirror(handle, "ka")
Flush->>Mirror: "sentText="", fieldText="ka", commitHeld=false"
Mirror-->>Flush: "policy='boundary', heldText="ka", payload="""
Note over Flush: Empty payload - no RPC, kana stays held
User->>Commit: onChangeText("ka+modifier")
Flush->>Mirror: "sentText="", fieldText="ka+modifier", commitHeld=false"
Mirror-->>Flush: "policy='boundary', heldSuffixLen=2, payload="""
Note over Flush: Modifier + base held together, still no RPC
User->>Commit: onKeyPress(Enter)
Commit->>Boundary: runLiveInputBoundary(handle, sendBoundaryBytes, recoveryBytes)
Boundary->>Flush: "runMirrorStep(handle, fieldText, commitHeld=true)"
Flush->>PTY: queueTerminalLiveHandleSend - terminal.send(finalKana)
PTY-->>Flush: accepted
Boundary->>PTY: queueTerminalLiveBoundarySend - terminal.send(CR)
PTY-->>Boundary: accepted
Note over Boundary: On rejected: recoverTerminalLiveRejectedBoundary restores field
Note over Boundary: On unknown: onDeliveryUnknown - stop repeat, show toast
Reviews (22): Last reviewed commit: "Merge origin/main into brennanb2025/mobi..." | Re-trigger Greptile
|
Re: Greptile's P2 ("Boundary-held kana silently discarded on tab change — wider window than Hangul"): confirmed, and the PR description's Notes section has been updated to state it precisely. The discard mechanism in |
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (1)
mobile/src/terminal/use-terminal-live-pending-input-flush.ts (1)
140-176: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExtract the duplicated handle-validity check.
The three-condition check at Line 150-155 (
handle !== activeHandleRef.current || (activeSessionTabTypeRef.current != null && activeSessionTabTypeRef.current !== 'terminal') || !liveInputTerminalHandlesRef.current.has(handle)) repeats the identical check inrunMirrorStepat Line 80-85. Extract a single predicate function and call it from both places. This prevents the two paths from silently diverging if the validity rule changes later.♻️ Proposed refactor
+ const isTerminalLiveHandleActive = useCallback( + (handle: string): boolean => + handle === activeHandleRef.current && + (activeSessionTabTypeRef.current == null || + activeSessionTabTypeRef.current === 'terminal') && + liveInputTerminalHandlesRef.current.has(handle), + [activeHandleRef, activeSessionTabTypeRef, liveInputTerminalHandlesRef] + ) + const runMirrorStep = useCallback( async (handle: string, fieldText: string, commitHeld: boolean): Promise<boolean> => { - if ( - handle !== activeHandleRef.current || - (activeSessionTabTypeRef.current != null && - activeSessionTabTypeRef.current !== 'terminal') || - !liveInputTerminalHandlesRef.current.has(handle) - ) { + if (!isTerminalLiveHandleActive(handle)) { resetMirrorState() return false } ... }, - [ - activeHandleRef, - activeSessionTabTypeRef, - clearHeldCommitTimer, - liveInputTerminalHandlesRef, - resetMirrorState, - sendLiveTerminalInputRef, - waitForPendingLiveInputFlush - ] + [ + clearHeldCommitTimer, + isTerminalLiveHandleActive, + resetMirrorState, + sendLiveTerminalInputRef, + waitForPendingLiveInputFlush + ] ) ... const runLiveInputBoundary = useCallback( (expectedHandle: string | null, sendBoundary: () => Promise<boolean>): Promise<boolean> => { ... - if ( - handle !== activeHandleRef.current || - (activeSessionTabTypeRef.current != null && - activeSessionTabTypeRef.current !== 'terminal') || - !liveInputTerminalHandlesRef.current.has(handle) - ) { + if (!isTerminalLiveHandleActive(handle)) { clearPendingLiveInputCommit() return queueTerminalLiveBoundarySend(pendingLiveInputFlushRef, async () => false) } ... }, - [ - activeHandleRef, - activeSessionTabTypeRef, - clearPendingLiveInputCommit, - liveInputTerminalHandlesRef, - runMirrorStep - ] + [clearPendingLiveInputCommit, isTerminalLiveHandleActive, runMirrorStep] )
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 6291427c-be32-4f06-99c9-54128dfa30bb
📒 Files selected for processing (19)
mobile/app/h/[hostId]/session/[worktreeId].tsxmobile/src/session/mobile-image-attachment.test.tsmobile/src/session/mobile-image-attachment.tsmobile/src/session/use-mobile-attachment-input-lease-gate.test.tsmobile/src/session/use-mobile-attachment-input-lease-gate.tsmobile/src/session/use-mobile-image-attachment.tsmobile/src/session/use-mobile-session-image-attachments.tsmobile/src/session/use-mobile-terminal-paste.tsmobile/src/terminal/terminal-live-composition-mirror.test.tsmobile/src/terminal/terminal-live-composition-mirror.tsmobile/src/terminal/terminal-live-input-sender.tsmobile/src/terminal/terminal-live-pending-flush-state.test.tsmobile/src/terminal/terminal-live-pending-flush-state.tsmobile/src/terminal/use-terminal-live-accessory-input-commit.test.tsmobile/src/terminal/use-terminal-live-accessory-input-commit.tsmobile/src/terminal/use-terminal-live-input-commit.test.tsmobile/src/terminal/use-terminal-live-input-commit.tsmobile/src/terminal/use-terminal-live-pending-input-flush.test.tsmobile/src/terminal/use-terminal-live-pending-input-flush.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- mobile/src/terminal/use-terminal-live-input-commit.test.ts
- mobile/src/terminal/terminal-live-composition-mirror.test.ts
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: e471e353-32fc-4c7d-9817-6728efc6c9cf
📒 Files selected for processing (4)
mobile/src/session/use-mobile-attachment-input-lease-gate.test.tsmobile/src/session/use-mobile-attachment-input-lease-gate.tsmobile/src/terminal/use-terminal-live-pending-input-flush.test.tsmobile/src/terminal/use-terminal-live-pending-input-flush.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- mobile/src/session/use-mobile-attachment-input-lease-gate.ts
- mobile/src/terminal/use-terminal-live-pending-input-flush.ts
There was a problem hiding this comment.
🧹 Nitpick comments (1)
mobile/src/terminal/use-terminal-live-input-disconnect.test.ts (1)
1-58: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winReuse the existing test harness instead of duplicating it.
This file reimplements the
Harnesscomponent and thereact-test-renderer is deprecatedconsole suppression already built foruse-terminal-live-input-commit.test.ts(createTerminalLiveInputCommitHarness,suppressReactTestRendererDeprecationWarning). That harness already exposessetConnected, which is exactly what this test needs at Line 64-67.Export the existing harness factory and suppression helper from a concretely named module (for example
terminal-live-input-commit-test-harness.ts, not a generictest-utils.ts) and reuse them here. This keeps warning-suppression and harness behavior consistent across the terminal live-input test suite.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: df5ea2c6-c26b-489b-8ae0-6def6f79a4f0
📒 Files selected for processing (7)
mobile/app/h/[hostId]/session/[worktreeId].tsxmobile/src/session/use-mobile-session-image-attachments.tsmobile/src/terminal/use-terminal-live-input-commit.test.tsmobile/src/terminal/use-terminal-live-input-commit.tsmobile/src/terminal/use-terminal-live-input-disconnect.test.tsmobile/src/terminal/use-terminal-live-pending-input-flush.test.tsmobile/src/terminal/use-terminal-live-pending-input-flush.ts
🚧 Files skipped from review as they are similar to previous changes (3)
- mobile/src/terminal/use-terminal-live-input-commit.test.ts
- mobile/src/session/use-mobile-session-image-attachments.ts
- mobile/app/h/[hostId]/session/[worktreeId].tsx
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: f0c09700-1186-4324-b6c8-7d657a775ddd
📒 Files selected for processing (6)
mobile/src/session/mobile-image-attachment.test.tsmobile/src/session/mobile-image-attachment.tsmobile/src/session/use-mobile-terminal-paste.tsmobile/src/terminal/terminal-input-connection-gate.test.tsmobile/src/terminal/use-terminal-live-pending-input-flush.test.tsmobile/src/terminal/use-terminal-live-pending-input-flush.ts
🚧 Files skipped from review as they are similar to previous changes (3)
- mobile/src/session/use-mobile-terminal-paste.ts
- mobile/src/session/mobile-image-attachment.ts
- mobile/src/terminal/use-terminal-live-pending-input-flush.ts
308958e to
db2fd20
Compare
…a script table (#15007) * fix(mobile): decide terminal preedit from the marked-text range, not a script table The live terminal capture field decided what to withhold from the PTY with a Unicode-block allowlist (Hangul jamo and syllables) and held exactly one trailing code point. Kana and kanji are not in the table, so a Japanese reading streamed to the PTY one fragment at a time and was repaired afterwards with DEL bytes (#7427). A code-point table cannot work, and the counterexample is not exotic: Chinese pinyin preedit is plain ASCII, and a Japanese romaji reading is one code point on the first keystroke and three on the fourth. Preedit is a property of the FIELD, not of the characters in it, so the only signal that identifies it is the text system's marked-text range. That is what a reference terminal implementation uses on every platform it supports - `hasMarkedText` there, the input-method context's composing state elsewhere - and neither one classifies code points anywhere in the input path. So the mirror now takes the marked-text report per change and holds the whole preedit region, whatever its length or script: - Subscribe the capture field to `onChange`, not `onChangeText`; only the raw native event carries the report at all. - A reported preedit is held entire and is never committed by the settle timer, because preedit is not text yet. Explicit boundaries still flush it. - `isTerminalLiveHangulCodePoint` and its four ranges are deleted. iOS reports the range but React Native drops it before JS, so the pinned patch forwards `markedTextRange` into the change payload. It is three hunks and it compiles because the app already sets `buildReactNativeFromSource` for iOS. The same idea was proposed in #11450, which is where the patch comes from. Android has no marked-text report in React Native at all, and a Kotlin patch would not help: Android consumes the prebuilt react-android artifact, so node_modules sources are never compiled. Until the report exists there, the fallback holds the trailing non-ASCII run. It enumerates nothing, it covers kana, kanji and Hangul, and ASCII keeps its zero-latency echo - but it cannot see an ASCII preedit, so Chinese pinyin on Android still leaks its reading. Only a report fixes that. Not-tested: no physical device or emulator was available, so no real IME drove this path. Japanese, Chinese and Korean composition are covered at the model and hook level only, and the iOS patch has not been compiled. Co-authored-by: Brennan Benson <[email protected]> * fix(mobile): bound the fallback hold to text the pty has not received The no-report branch walked the trailing non-ASCII run over the whole field and ignored stableLength, unlike the reported branch directly above it. So after a settle-timer commit the next keystroke re-held everything already delivered and the caller erased it with DEL and retyped it — a nine-character Cyrillic word cost a DEL per already-sent character, and for the 300ms before the re-send the held text was the only copy, so a blur or reconnect destroyed characters the pty already had. Bound it the way the reported branch is bounded. Pinned by a test that drives a settle commit between every keystroke and asserts no DEL reaches the wire. --------- Co-authored-by: Brennan Benson <[email protected]>
|
Closing — but your patch is the part that shipped, and you're credited as co-author on #15007 ( Your premise was the load-bearing finding: React Native 0.83.9 genuinely does not expose composition state, so no amount of JS gets at it. I checked this the hard way — an earlier pass concluded RN already shipped
What changed on the JS side: your Closing the branch, not the contribution. Thanks — the patch was the hard part. |
…a script table (stablyai#15007) * fix(mobile): decide terminal preedit from the marked-text range, not a script table The live terminal capture field decided what to withhold from the PTY with a Unicode-block allowlist (Hangul jamo and syllables) and held exactly one trailing code point. Kana and kanji are not in the table, so a Japanese reading streamed to the PTY one fragment at a time and was repaired afterwards with DEL bytes (stablyai#7427). A code-point table cannot work, and the counterexample is not exotic: Chinese pinyin preedit is plain ASCII, and a Japanese romaji reading is one code point on the first keystroke and three on the fourth. Preedit is a property of the FIELD, not of the characters in it, so the only signal that identifies it is the text system's marked-text range. That is what a reference terminal implementation uses on every platform it supports - `hasMarkedText` there, the input-method context's composing state elsewhere - and neither one classifies code points anywhere in the input path. So the mirror now takes the marked-text report per change and holds the whole preedit region, whatever its length or script: - Subscribe the capture field to `onChange`, not `onChangeText`; only the raw native event carries the report at all. - A reported preedit is held entire and is never committed by the settle timer, because preedit is not text yet. Explicit boundaries still flush it. - `isTerminalLiveHangulCodePoint` and its four ranges are deleted. iOS reports the range but React Native drops it before JS, so the pinned patch forwards `markedTextRange` into the change payload. It is three hunks and it compiles because the app already sets `buildReactNativeFromSource` for iOS. The same idea was proposed in stablyai#11450, which is where the patch comes from. Android has no marked-text report in React Native at all, and a Kotlin patch would not help: Android consumes the prebuilt react-android artifact, so node_modules sources are never compiled. Until the report exists there, the fallback holds the trailing non-ASCII run. It enumerates nothing, it covers kana, kanji and Hangul, and ASCII keeps its zero-latency echo - but it cannot see an ASCII preedit, so Chinese pinyin on Android still leaks its reading. Only a report fixes that. Not-tested: no physical device or emulator was available, so no real IME drove this path. Japanese, Chinese and Korean composition are covered at the model and hook level only, and the iOS patch has not been compiled. Co-authored-by: Brennan Benson <[email protected]> * fix(mobile): bound the fallback hold to text the pty has not received The no-report branch walked the trailing non-ASCII run over the whole field and ignored stableLength, unlike the reported branch directly above it. So after a settle-timer commit the next keystroke re-held everything already delivered and the caller erased it with DEL and retyped it — a nine-character Cyrillic word cost a DEL per already-sent character, and for the 300ms before the re-send the held text was the only copy, so a blur or reconnect destroyed characters the pty already had. Bound it the way the reported branch is bounded. Pinned by a test that drives a settle commit between every keystroke and asserts no DEL reaches the wire. --------- Co-authored-by: Brennan Benson <[email protected]>
…a script table (stablyai#15007) * fix(mobile): decide terminal preedit from the marked-text range, not a script table The live terminal capture field decided what to withhold from the PTY with a Unicode-block allowlist (Hangul jamo and syllables) and held exactly one trailing code point. Kana and kanji are not in the table, so a Japanese reading streamed to the PTY one fragment at a time and was repaired afterwards with DEL bytes (stablyai#7427). A code-point table cannot work, and the counterexample is not exotic: Chinese pinyin preedit is plain ASCII, and a Japanese romaji reading is one code point on the first keystroke and three on the fourth. Preedit is a property of the FIELD, not of the characters in it, so the only signal that identifies it is the text system's marked-text range. That is what a reference terminal implementation uses on every platform it supports - `hasMarkedText` there, the input-method context's composing state elsewhere - and neither one classifies code points anywhere in the input path. So the mirror now takes the marked-text report per change and holds the whole preedit region, whatever its length or script: - Subscribe the capture field to `onChange`, not `onChangeText`; only the raw native event carries the report at all. - A reported preedit is held entire and is never committed by the settle timer, because preedit is not text yet. Explicit boundaries still flush it. - `isTerminalLiveHangulCodePoint` and its four ranges are deleted. iOS reports the range but React Native drops it before JS, so the pinned patch forwards `markedTextRange` into the change payload. It is three hunks and it compiles because the app already sets `buildReactNativeFromSource` for iOS. The same idea was proposed in stablyai#11450, which is where the patch comes from. Android has no marked-text report in React Native at all, and a Kotlin patch would not help: Android consumes the prebuilt react-android artifact, so node_modules sources are never compiled. Until the report exists there, the fallback holds the trailing non-ASCII run. It enumerates nothing, it covers kana, kanji and Hangul, and ASCII keeps its zero-latency echo - but it cannot see an ASCII preedit, so Chinese pinyin on Android still leaks its reading. Only a report fixes that. Not-tested: no physical device or emulator was available, so no real IME drove this path. Japanese, Chinese and Korean composition are covered at the model and hook level only, and the iOS patch has not been compiled. Co-authored-by: Brennan Benson <[email protected]> * fix(mobile): bound the fallback hold to text the pty has not received The no-report branch walked the trailing non-ASCII run over the whole field and ignored stableLength, unlike the reported branch directly above it. So after a settle-timer commit the next keystroke re-held everything already delivered and the caller erased it with DEL and retyped it — a nine-character Cyrillic word cost a DEL per already-sent character, and for the 300ms before the re-send the held text was the only copy, so a blur or reconnect destroyed characters the pty already had. Bound it the way the reported branch is bounded. Pinned by a test that drives a settle commit between every keystroke and asserts no DEL reaches the wire. --------- Co-authored-by: Brennan Benson <[email protected]>
Summary
Part of #7427 — this PR does NOT close the issue; it must stay open. It fixes only the deterministic kana half of Japanese IME input on the mobile terminal; romaji remains out of scope.
On Japanese flick keyboards, the terminal previously received a base kana before a small-kana, dakuten, or handakuten modifier finished rewriting it. The composition mirror now holds kana until a real boundary and forwards the final text exactly once. Hangul keeps its existing timer policy, while kana is never committed by a timing guess.
The review loop also hardened every asynchronous input path around that boundary:
Conflict repair
The exact pushed head is
308958eaf7cb4ab795c2e230da98244acf2f0e45; its current-main merge parent is8fc892dd023850df379c07cc4e7a46cff9a3ea84.b04c695750e9859e0d8bf79f503279bc4d656925resolved one overlap inmobile/app/h/[hostId]/session/[worktreeId].tsx: current main's extracted live-input focus lifecycle was integrated after the PR's connection/scope gate without replacing its kana generation, ordering, or delivery-outcome protections.b04c695…to live main8fc892dd…was conflict-free. Its only mobile delta was an unrelated active-PR polling hint inmobile/src/session/github-pr-rpc.ts.Screenshots
No visual change — this changes terminal byte flow, not layout or components. The embedded screenshots below are preserved as historical evidence from the earlier device lane; they are not current-head validation.
Testing
git diff --checkpassed.boundaryhold caused 12/26 composition tests to fail with the expected provisional-kana/DEL regressions; restoring exact committed production code returned 26/26 green and a clean tracked tree.308958eaf7cb4ab795c2e230da98244acf2f0e45: 43 successful, including Greptile Review; only the path-gated e2e job is skipped.OWNER-LANE VERDICT: CLEAN
Simulator validation — exact public head (PASS)
Fresh Android A/B used the exact current-main baseline
8fc892dd023850df379c07cc4e7a46cff9a3ea84and exact public head308958eaf7cb4ab795c2e230da98244acf2f0e45. The lane held one Android AVD (emu_qa_keystore,emulator-5560) alongside the unrelated booted iPad and never controlled the iPad. The Android app data was cleared before the baseline half, then the same AVD, prebuiltcom.stably.orca.mobiledev client, native Gboard日本語(12 キー), saved Host 1 profile, mock process, Narwhal terminal fixture, endpoint10.0.2.2:6865, Metro port8092, 4-second accepted-send response delay, and tap coordinates were held constant. Only the Metro-served mobile client bundle changed.かimmediately reached the mock as provisional"か"; native dakuten later produced DEL +"が"; nativeあthen sent"あ".かproduced no send after a 2-second pause; dakuten changed the active composition toがand still produced no send after another pause. The real nativeあboundary produced exactly one send,"が", with no provisionalか, no DEL repair, and no duplicate.がis visible in native composition, but provisionalかand DEL +がhave already reached the PTYがremains held before a real boundary; the mock has received no bytesThis exact-head acceptance run intentionally used only native Japanese flick input. Clipboard/ADB Unicode was not treated as acceptance evidence; the older paste and route-reuse evidence remains preserved below as explicitly historical evidence. Romaji was not tested and remains out of scope; #7427 stays open.
Simulator validation — historical and stale
The historical lane used Android AVD
emu_qa_keystorewith native Gboard日本語(12 キー). Parent was the then-true merge-base4d044c47dccb58642cba6df6fe56e42b7b87dc6d; head was3fe69c66f9d070c0f7d87c23faa369372eb78016. Both halves used the same AVD/app data, IME, dev client, delayed-acceptance mock, endpoint, terminal, and clipboard marker; only the Metro-served client bundle varied.か→ dakuten →あ: parent sent provisionalか, then DEL+が, thenあ. The historical head sent nothing for the base/modifier edits and sent exactly oneがonly whenあcreated the real boundary; the later Enter flush sentあ, then CR.か, DEL+が, then the clipboard text. The historical head sent finalがfirst andCAQA12PASTEsecond, exactly once each after accepted responses.terminal.sendresponse delay: parent let the queued paste reach Manta after leaving Narwhal. The historical head sent only the held Narwhalか, dropped the stale queued paste on route replacement, then a fresh Manta Paste sent exactly once.がafter provisional bytes had already leakedがremains held before a real boundaryRomaji was not tested and remains explicitly out of scope. Issue #7427 remains open.
Same-model review loop
The earlier review-only lanes returned literal
CLEANon old head3fe69c66f9d070c0f7d87c23faa369372eb78016; those verdicts are historical and stale for the newly pushed head.gpt-5.6-solxhighread-only review returned literalCLEANon exact head308958eaf7cb4ab795c2e230da98244acf2f0e45versus exact main parent8fc892dd023850df379c07cc4e7a46cff9a3ea84.AI Review Report
The owner lane re-audited kana range and boundary semantics, exact-byte recovery, committed route ownership, disconnect/reconnect invalidation, producer-generation fences, direct and mirrored sends, pending flushes, paste, image attachments, lease gating, dictation, buffered sends, gestures, accessory repeat, and the current-main focus-lifecycle extraction. Definite rejection and delivery-unknown behavior were checked separately so recovery cannot duplicate bytes whose delivery is uncertain.
Cross-platform and remote behavior remain within the shared mobile terminal-send flow. No desktop shortcut, path, provider, or Git behavior changes, and SSH/folder workspaces receive the same ordered terminal bytes.
Security Audit
The change only controls when user-authored terminal input is forwarded and whether uncertain sends may be retried. It adds no command execution, path handling, authentication, secret, dependency, or IPC surface. Treating delivery-unknown outcomes as a fence reduces the risk of replaying input into an interactive shell or TUI.
Notes
8ae5c6d95dand Android A/B at3fe69c66f9dremain useful historical evidence only and are stale for current head308958eaf7cb4ab795c2e230da98244acf2f0e45.What the user sees before and after
Before: With a Japanese IME, intermediate kana can leak into the live terminal while composition is still changing, so users can see duplicated or corrupted characters.
After: Kana stays buffered until a real composition boundary, then the final text reaches the terminal exactly once. Romaji composition is unchanged, so #7427 remains open.