Repository navigation
Conversation
9 tasks done
7 of 9 tasks
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Mobile hardware keyboards currently lose terminal modifiers and navigation keys, cannot submit Native Chat correctly, and require touch to change workspaces or tabs. This integrates the existing native terminal capture and navigation implementations with the current mobile session structure, preserves iPad input focus, and adds native hardware Return submission while keeping software multiline input.
Reuses work from #10148, #12772 and #18195. Related issues: #9702 A–C, #12706, #14744, #18041 and the broader editing scope in #9000. This does not claim to close those issues yet. Browser creation (#9702 D), typing latency (#12071 / #15708), and DeX Escape behavior require further category work.
Review fixes included: focused-route command ownership; pending-navigation cancellation on blur; keyboard connection notifications and software-keyboard recovery; native IME pass-through; ordered terminal flush before controls; Android consumed key-up/repeat behavior; iOS Ctrl+Shift letter and punctuation coverage; hardware input focus after accepted sends.
Validation so far:
30d8ce8d8da: PR Checks run 34014925963 (including all eight Node test shards, static analysis, typecheck, cross-version compatibility, Linux and Windows packaging, Git compatibility and shell contracts), Mobile Checks 34014925852, Computer-use e2e 34014925861, and PR test LoC 34014925859. Draft-gated real IME and general e2e jobs were skipped, not exercised. This supersedes pending-CI statements in earlier checkpoints; physical Bluetooth/iPad, DeX and real remote-host stress remain unproved.30d8ce8d8da: Mobile Checks and cross-version wire compatibility passed. Remaining PR jobs are still pending verification. Independent review of the paired-remount fixture cleared its identity wiring and unchanged rejection→remount assertions; all three tests reran successfully.94e55714e5fprepares the existing Node native runtime for mobile's real-PTY tests;679582dcf53publishes keyboard handlers/navigation refs only after React commit and stabilizes the dynamic native-presence callback;30d8ce8d8dasupplies the existing arrival-target implementation to the paired-remount test fixture. Suspended-render regressions fail before and pass after. Independent lifecycle review: 14 tests passed; independent AST audit confirms exactly one callback insertion before updating parity digests. Full mobile: 542 files / 4,375 passed / 3 skipped; typecheck/lint/format pass. React Doctor: zero blocking errors, 28 warnings remain. Remount + arrival suites: 11 passed. Prior hosted Linux/Windows packaging, cross-version, Git compatibility and seven test shards passed; replacement hosted verification is pending.a63a4579cf5in merge54e6bd921f7, retaining both conflict-side tests and reliability gates. Independent overlap review found no transport merge regressions; 83 focused tests passed. Post-commit pinned-v1.4.197 encrypted mobile input/recovery and structured-session compatibility suites: 20 passed. These are loopback/real-local-PTY checks, not physical keyboard or public-relay proof.Native Android final-build proof: authenticated localhost emulator gRPC sends real kernel events through the nonvirtual qwerty2 InputDevice (not
adb inputor JavaScript key callbacks). A repeatable exact-byte harness checks native EditText focus before/after each case and observes the isolated mock host. All 12 cases pass exactly once: four arrows, Tab, forward Delete, Backspace, Home, End, Shift+Tab, Ctrl+C and Ctrl+D. This proves native app-to-mock delivery, not real PTY execution, Bluetooth, or DeX. AOSP's qwerty2 layout maps Linux Escape to Android Back and PC Home to Android Home; emulator Escape route changes are not evidence of an Orca Escape defect. W3C Home/End use its MOVE_HOME/MOVE_END mappings successfully.Additional native Android evidence: held Backspace produces repeated DEL bytes and stops after release. Rapid
abc+ hardware Return exposed a real Chat race: the mock received onlyawhile the field still showedabc. Commita5471cf02e9reads the latest native change-event text; rapidxyz+ Return now submits exactlyxyzand clears the focused field.a, Shift+Return,b, Return submits exactlya\nb. The regression fails with the stale React prop read and passes with the native-text ref; autocomplete followed immediately by Return is also covered. Composer styles were extracted unchanged to preserve the file-size limit.Native Chat primary-modifier submission (#14744): capable native builds now use Cmd+Enter on iPad and Ctrl+Enter on Android; plain Enter remains a native multiline edit. iPadOS's hold-Command menu names the action “Send message.” The existing send path, disabled/empty guards, focus handling and composition pass-through are reused. The prop is capability-gated and default-false, so older installed native builds retain their previous Enter/Shift+Enter convention until updated.
Native Android nonvirtual-keyboard proof:
alpha, Enter,betaleaves exactlyalpha\nbetain the composer with no send request. Ctrl+Enter sends that text once through the existing Ctrl+U preparation/send flow, clears the draft and retains focus. Ctrl+Enter on empty input sends nothing; rapidgamma, Ctrl+Enter sendsgammaonce. This is app-to-mock acceptance, not real agent execution or Bluetooth proof. All 20 Android capture tests pass, including five new real-KeyEvent dispatch tests; 30 independently rerun JS tests pass. Independent review found no concrete regression blocker. Both native builds pass; the iPad test app is installed and reports the new capability, but keyboard detection remains false. The physical Cmd+Enter/IME acceptance criteria remain open.Still draft: IME candidate navigation, clipboard/editing, attach/detach and modal/route transitions require further evidence. iOS UIKeyCommand does not expose repeat state for Chat Return; do not infer held-key suppression after fast rejection from the JavaScript repeat test. No screenshot or successful build is presented as proof of physical key delivery.
Latency PR #15708 was independently reviewed and is not imported unchanged: concurrent 20,000-byte text followed by
Zinterleaved at byte 16,384 in the host writer. Commitfc0944ce1dbfixes that prerequisite using the existing bounded cancellable queue, keyed by PTY generation, with synchronous stale/cancellation guards and original lease admission preserved. Re-review found and fixed a microtask stale-write race, canceled-entry capacity retention, and consumed-slot payload retention. Writer/queue tests cover paste ordering, independent terminals, lease/generation replacement, cancellation saturation, retained-text limits and both queue lanes. The later integration below adds pre-validation arrival ordering, negotiated receipts and explicit recovery; socket enqueue is never treated as host acceptance. Dependent controls still await accepted prefix receipts; old-host typing stays serialized.Reliability contract:
terminal-input.mobile-hardware-routingandterminal-input.generation-ordered-writes— captured keys reach the current terminal in order without crossing route/handle boundaries or consuming native IME edits. Behavioral mapping, writer ordering/cancellation and focus-lifecycle tests plus the native Android mock-byte matrix are the current oracles; physical-device/full-provider delivery remains an explicit incomplete gate. No new wire opcode is introduced. Local, daemon, SSH/WSL and folder/worktree execution retain the existing host-owned send path, now serialized at its writer. Provider callbacks remain unchanged; real daemon/SSH/WSL/Windows stress is an explicit gap, not inferred from unit coverage. Pending writes are capped at 1,023 per PTY generation, 2,048 globally, and approximately 32MiB retained text. No polling or subprocess-per-key work is added. Native command tables are bounded and keyboard attachment uses notifications. Final native/runtime evidence and performance review remain required before readiness.Latest latency integration (
a0ef01f11e6,c8a98363a3a): host input is ordered before asynchronous dispatch/validation, pinned to the subscribed PTY identity/generation, and accepted only after complete host writes. Optional ordered-input capability negotiation reuses opcode 7; old peers retain their previous wire behavior. Mobile direct/relay/logical clients pipeline only negotiated input, await receipts for dependent Enter, fence JSON suffixes after uncertain writes, and never replay. Failed mirrors clear native/JS text; recovery requires an explicit action and a fresh compatible subscription. Legacy JSON failures also show a warning and require explicit resubscription. Recovery is fenced against route A→B→A, newer interaction, and late pre-recovery failure callbacks.Real-clock encrypted test: four input events at 50ms cadence; with 300/400/500ms host-receipt delay, all 18,029 prefix bytes reached real PTY stdin before the first receipt in the pipelined runs, versus only seven bytes in serialized controls. Both paths delivered exactly 18,030 bytes after Enter, including Unicode paste, BOM, NUL, Tab, arrow and DEL. Latest receipt completion totals: pipeline 792/983/1180ms versus serial 923/1218/1517ms. This is production stream/E2EE/host receipt/writer code over loopback sockets with stubbed runtime metadata and a real local macOS PTY—not full network RTT, public relay authentication, or native-app proof. Cross-version terminal-wire suite: ten tests pass; that suite does not cover mobile/E2EE/relay skew.
Failure-history review finding fixed: detailed detached failures and explicit recovery permits are capped at 256. Overflow becomes a conservative client-wide unknown-input fence, never a missing failure record that could reopen JSON fallback. Recovery requires a fresh compatible subscription and an explicit action; permits are bounded and generation-scoped. Tradeoff: after extreme failure churn, unfamiliar terminals, old-host terminals and evicted permits are also fenced until compatible recovery. Active subscription records remain subscription-owned, not included in the historical cap. Five 2,048-cycle/recovery tests check bounded records, zero retained pending bytes/timers, earliest-identity JSON/binary fencing, stale candidates, permit eviction and late completions. Independent review passed 59 focused tests without blocking findings; the full transport run passed 719 tests, three skipped. No wire change; the overflow adapter is local-only. The reliability manifest includes the new history oracles. Native overflow interaction remains unproved.
Native latency ordering finding fixed (
62ecf93f41d): at 150ms each direction, Backspace previously overtook Return/Tab/Up. Three deterministic regressions now pass: control order, typing after Return without phantom deletes, and suffix suppression after failed Return. Controls enter the existing bounded queue synchronously as non-coalescing receipt barriers; mirror/native field state ends at admission, never at a late receipt. Paste, dictation and image callbacks use the same queue. Local admission failures show the existing recovery warning. Deferred attachment lease waits are cancelled on retained-route blur without poisoning resumed input; already-dispatched input keeps its actual result. Independent review passed 94 initial focused tests and a final 71 mobile / 13 host receipt tests without blocking findings. Changed-code quality across 153 branch files, targeted formatting, mobile typecheck and commit hooks pass.Native Android→production E2EEChannel/dispatcher/receipts/writer→real raw-stdin PTY now passes exact 19-byte order at 300/400/500ms simulated application-frame RTT, with 17 binary frames, 17 receipt sends and zero JSON fallback. First-input→final receipt-send totals were 2377/3189/3443ms; these are not native receipt-consumption or shell-execution measurements.
first, Return, immediatelyxalso passes at 500ms, exactly seven bytes and no phantom deletes (1692ms). Runtime/workspace metadata is stubbed; this is not public relay, Bluetooth or DeX proof. One initial 400ms attempt was one byte short and manually stopped; the diagnostic rerun passed, but the initial shortfall remains unexplained, so no native soak/reliability claim is made. Initial harness churn separately came from iPad and Android sharing one mock device token; keeping iPad at home removes that fixture collision.Remaining latency limitation: receipt barriers preserve the conservative rule that uncertain controls cannot dispatch a suffix. Consequently 64 held controls with 500ms receipts take 32 seconds; the 65th simultaneous admission fails closed. Tests prove this bound, not satisfactory fast-repeat responsiveness. Negotiated-only control pipelining needs a deliberate client-unknown outcome contract before adoption. The PR remains draft.
Rapid native input finding: three back-to-back 19-byte sequences at 400ms simulated RTT produced only 56 bytes: the third Tab was absent even though kernel logging captured all three presses. A second run missed two Tabs; its bounded JS callback trace also lacked them. Temporary native diagnostics then observed a missing Tab at pre-IME but not normal window/capture dispatch, with focus retained and no composing span. Rapid runs additionally exposed text-boundary corruption (
antive-proofor a duplicated prefix). An unsuccessful Enter-release experiment was removed. The replacement and new exact-byte evidence follow; these are focused regressions, not a native soak claim.Follow-up isolation: control-interleaved input also failed with 30ms pacing between injected key events, while uninterrupted text passed. Replacing raw clear with RN
clear()or making the field uncontrolled failed; both experiments were removed. The replacement uses opt-in Android pre-IME capture, an atomic native field snapshot/reset, and a noncoalescing event on the TextInput's own change stream. Native capability detection preserves older installed builds and iOS behavior. JavaScript acknowledges the reset, ignores stale events and never clears newer native typing at a late receipt. No prefix-stripping heuristic or transport change is used.Native field-boundary validation: the final build passes three mixed sequences at 30ms key-request pacing and 400ms simulated application-frame RTT: exactly 57 bytes, 29 frames/receipts, zero JSON fallback.
first, Enter,xwhile JavaScript was stalled for six seconds passes exactly 7 bytes with 7 frames/receipts. Ctrl+1, Alt+Enter, Ctrl/Alt+Backspace and Ctrl+Delete interleaved with text pass exactly 23 bytes with 15 frames/receipts at the same RTT. This is native nonvirtual keyboard→production encrypted transport/dispatcher/writer→real local raw-stdin PTY with stubbed runtime metadata, not Bluetooth/DeX/public-relay/soak proof.Peer review caught and fixed cross-target coalescing, modified-delete delegation, unmapped-control baseline retention, Alt+Enter mapping, an empty-payload mock mismatch, premature release ownership on fallback, and release ownership crossing keyboard devices. Final independent native ownership review found no remaining concrete blocker. All 15 capture-package Robolectric tests pass, including 10 new real-ReactEditText tests for reset, stale controlled writes, composition/deletion delegation, navigation, repeats and release ownership. The fixture records events rather than serializing through Fabric; actual deletion and newer-edit count advancement are not inferred from its delegation/direct-append tests. Full mobile regression: 4,268 passed / 3 skipped across 529 files; mobile typecheck, changed-code quality across 154 branch files, formatting, Android build and 104-gate manifest validation pass.
Native negotiated recovery now exercised: on the published app at 300ms simulated application-frame RTT, native
sfollowed by Return received a production pre-write rejected receipt; the PTY remained empty and Return was suppressed. The warning focused Reconnect input. Hardware Enter recovered through a fresh compatible stream, with no terminal bytes; freshuand Return delivered exactly75 0d, zero JSON fallback. A second run injected an error after the real writer delivereds: the host sentunknown, the UI accurately warned that input may have arrived, and queued Return was suppressed. Explicit keyboard recovery plus freshu, Return yielded exactly73 75 0d—the originalsappeared once, never replayed. Runtime metadata/provider fault injection is fixture-owned; receipt dispatch, native UI, encrypted transport and raw PTY are real. This does not prove relay-service or physical Bluetooth recovery.54e6bd921f7ea79923f2eb598ba5d2765is an ancestor; current pane gate retains Mac-only forwarder exclusion for iOS. Four current suites / 73 tests pass: platform detection, forwarder, Hangul coexistence and composition ownershipc2e3d13efe8is an ancestor; current 6 focus/tap/pointer/scroll suites / 49 tests pass. Mouse-aware touch keeps PTY mouse bytes then requests deferred focus; external mouse semantics retained7fe19f20ee9166d7810abdf02bc32be4512fc9ad1d957e69156f4e078f35c397e36a5b0e98bbe997c070e7114cdf940a75c1ae4035d3mInputShown=false; second tap opened IME. Trace showed native touch reclaimed focus before deferred RN focus, making it a no-op. Conditional Android re-blur now yields first-tap hidden→shown with native field focus retained. Red/green regression plus iOS non-regression; full mobile 4,327 passed / 3 skipped; typecheck/quality/hooks passe0e5add59d04f14d6d757c; 64 focused repeat/accessory/raw-send/input tests pass, covering release, stale targets/connections and distinct taps8ffa3513409x/Ctrl+C and palette Ctrl+Shift+J; hardware Tab moves native focus Codex→Claude. After dismissal, Ctrl+Shift+J opens focused search and Ctrl+1 returns to the workspace; freshq, Return sends exactlyq,\rto mockc134a02c43fb513cce6f08prefix한글fresh\rprove no replay or stray Enter. Full cross-version + CI scope: 88 tests / 10 files; final strengthened recovery test, typecheck, quality gate and hooks pass09716afbe57fNative Android recovery UI
Android undo and boundary-arrow follow-up
Android Ctrl+Shift+V paste
Follow-up on the published source-built APK: hold Ctrl+Shift+V, release Shift while V stays down for another second, release V/Control, then
H, fresh Ctrl+V, Enter. The native nonvirtual keyboard → encrypted dispatcher/writer → real raw-stdin PTY check passes exactlypaste-한글\nline-2H\x16\r(21 UTF-8 bytes), with exactly one paste JSON RPC at 400ms simulated application-frame RTT. This verifies no extra bytes in the observed hold sequence and preserves literal Ctrl+V; it does not establish an exact kernel/native repeat count or Bluetooth behavior. Two runs pass; final evidence isnotes/keyboard-native-held-paste-final-pty.logand the matching key log.Commit
8a3b81699f3: opt-in capable Android builds now use exact Ctrl+Shift+V for terminal paste. Ctrl+V remains terminal0x16; iOS Cmd+V, Native Chat editing, composition and older installed native builds retain their existing paths. Native capture reuses the same-input field snapshot/reset/count event and suppresses held-paste repeats, including after Shift release. JavaScript admits the boundary once and never clears later typing.The existing clipboard/image paste implementation now reserves its queue position before clipboard work. An accepted request snapshots promptly even while an earlier receipt is pending; later Enter cannot overtake it. Early read errors are handled immediately, failed paste fences the suffix, and stale pre-dispatch work is cancelled without replay. Requests use the existing fail-when-disconnected terminal option. Text reservations retain the existing queue budget; image snapshots have a separate 24MiB base64-character cap and four image-read/preparation permits held until native work actually settles, even after cancellation. Existing large-image downscaling is preserved. These are concurrency/retention bounds, not measured peak native raster memory. Cancelled remote uploads may leave unused temporary images.
Final actual Android nonvirtual qwerty2 flow:
a, Ctrl+Shift+V,x, Enter delivers exactlyapaste-한글\nline-2x\r(21 UTF-8 bytes) through production encrypted transport, dispatcher and writer to a real raw-stdin PTY. It uses one existing paste JSON RPC and three ordered input frames/receipts at 200ms each application-frame direction. The earlier no-prefix flow passes exact 20 bytes. Runtime metadata is stubbed; this is not Bluetooth/public-relay/agent execution proof. Final native45 tests, mobile4308 tests/3skip, typecheck, changed-code quality, host25 tests and104gate validation pass. Source-parity updates were limited to AST-verified new strings/handler/prop; style and component-count invariants are unchanged.Commit
65852e2aacbfixes the invisible undo step described below: identical nonempty RN/Fabric updates reconcile spans without replacing text. Changed text and empty clears retain the native path. First Ctrl+Z now changesabxctoabc; Ctrl+Shift+Z restoresabxc. Unicode insertion undo and exact Ctrl+Enter submission also pass on the nonvirtual emulator keyboard. Android now builds RN from source so the Kotlin patch actually reaches the APK; README documents SDK/toolchain and first-build cost. The existing iOS source-build setting and patches remain intact. Metro excludes only generated native-build trees; the lockfile differs only in patch/peer hashes.Android's exact-source boundary check let combined keyboard/DPAD arrows escape the composer. Submit mode now delegates native movement first and consumes only otherwise-unhandled, unmodified arrows from physical alphabetic keyboards. Recorded empty four-direction/end-of-text flows retain focus. Independent review found no concrete blocker; 37 native tests pass. A later paste-selection observation was traced to stock Android's toggled-keyboard Shift latch after redo, not established paste timing or RN patch regression; native sticky modifiers are preserved.
Source-built APK terminal regression passes all 57 expected bytes through native input, production encrypted transport/dispatcher/writer and real PTY stdin: 29 input frames, 29 receipts, zero JSON fallback at 400ms simulated application-frame RTT (200ms each direction). Runtime metadata is stubbed; this is not Bluetooth, public relay or soak proof. The earlier undo failure below is historical evidence from published
23e0a70f37f, not the new candidate's result.Arrow lifecycle follow-up: three additional native tests cover held movement reaching an unhandled boundary, captured release after focus moves to a button, and fresh native movement superseding a lost release. All40 native tests pass; independent review found no blocker. The new tests simulate editor dispatch results and prove ownership, not real caret movement. On the published emulator APK,
abc/Home, Right held for one second, release, thenxproducesabcxwith composer focus retained. No exact repeat-count trace or Bluetooth delivery is inferred. Responsive high-RTT editing repeats remain a separate contract decision: pipelining preserves no replay but allows several keys to have arrived before a lost receipt becomes known; current receipt-per-control behavior is unchanged.Undo provenance follow-up on
23e0a70f37f: a debugger caughtmaybeSetTextFromStatevia FabricupdateState, with native and incoming text bothabycand native/incoming event counts both 140. This confirms the actual identical-update path that the native fixture reproduces. Debugger detached and app resumed. This is not latency evidence; the source-built fix is described above.Native Chat clipboard follow-up on
23e0a70f37f: nonvirtual Android hardware events replace the draft withpaste-한글\nline-2, move the cursor and insertx, copy exactpaste-한글\nline-x2, cut it (independently replacing a clipboard sentinel), and paste it back. Editing generates no sends. Ctrl+Enter then sends the existing Ctrl+U preparation plus the exact draft once; the composer clears and stays focused. Assertion-generated evidence:notes/keyboard-native-chat-editing-proof.json. This uses real task-owned Android clipboard APIs and app-to-mock acceptance, not Korean IME composition or physical iPad proof. Undo failed: first Ctrl+Z leavesabxcunchanged; second restoresabc. A separate four-test native fixture reproduces the invisible undo step after identical RN JS/Fabric text updates; on-device provenance is recorded above. No speculative production undo fix is included.After clearing a stale Metro cache, verified the current recovery module is loaded. Native nonvirtual keyboard
sreached the mock as a rejected send; the app cleared the field, disabled input controls and displayed the warning. With the mock restored to acceptance, tapping Reconnect input removed the warning without any input replay. The next nativetand Return produced exactlytthen\r. This exercises legacy JSON failure/recovery, not negotiated-stream failure or real PTY execution.Android keyboard recovery follow-up: the initial failed-field focus landed on Back, so Enter navigated away. Recovery now requests native button focus after mount on the active route, canceling the request on blur/unmount. Native qwerty2
srejection showed Reconnect input as focused in the Android accessibility hierarchy; hardware Enter removed the warning without navigation or terminal bytes, thenu+ Enter delivered exactlyu,\r. Five lifecycle tests cover delayed focus, no automatic recovery, route blur/return, inactive routes, unmount and the Android-only platform boundary; together with recovery-state and keyboard-focus tests, 16 pass. Mobile typecheck and targeted lint pass. Independent focus re-review found no blocking issues. iOS button focus remains unproved and is unchanged.Paused state:
After explicit recovery and new input: