Repository navigation
feat(nsh): replace GPUI with native desktop and terminal backends - #6674
Conversation
2e2afa9 to
8df8b48
Compare
Replace GPUI desktop and pixel-terminal rendering with the platform-native NSH backends (AppKit, Win32/Direct2D, GTK4) and shared `nsh-terminal` contracts while keeping `third-party/nsh` changes minimal. Fix Windows Direct2D thread-local teardown ordering, Windows/macOS/Linux modal focus scoping, queued `autoFocus` preservation, terminal IME preedit and plain-Escape fencing, macOS sRGB premultiplied bitmap capture and async image/canvas capture invalidation, macOS terminal wake/lifecycle/Home-End caret handling, modal-scoped pressable bounds, named-pipe clean stream flushing (`ERROR_NO_DATA`), conversation model-loading send race, ACP callback cancellation across in-flight Host calls, SQLite actor custody release before reply wakeup, test host sandbox propagation, idle workspace directory handle retention, and verbatim path normalization. Generated-by: OpenAI Codex Generated-by: Google Antigravity
8df8b48 to
32a064b
Compare
There was a problem hiding this comment.
I reviewed the final two-file test correction from 2e2afa9586dcd7bb98253c381df2459a2b124d1d to 32a064b06769c2cd79ad5566f28c9fe457d908f4: 142 additions and 56 deletions in the Linux input test module and macOS terminal tests. The broader 537-file native-backend migration, ACP cancellation and SQLite resource-lifetime changes still require complete review and native validation.
The Linux fixtures now collect intermediate log events, wait for the relevant UI event acknowledgements, use onChange/bindProp, and key replacement input subtrees by their version. The macOS fixtures use a non-animated Dialog with Escape dismissal and exercise both a bound Escape shortcut and the ordinary cancel-composition → blur → dismiss sequence. I checked the complete final delta and its surrounding tests. The Linux production section is byte-identical to the preceding revision; these last changes correct the fixtures and their synchronization.
Current hosted evidence:
- The complete Linux
composing_escape_cancels_preedit_before_leaving_field_or_closing_modalcase passed in 0.197s in final run42431500636and 0.174s in merged run42431703925. The scoped/fallback keybindings case also passed in both runs. The earlier Escape failure is therefore superseded for this final test revision. - Both Linux jobs still failed
pending_focus_event_holds_keys_paste_and_pause_input_without_queued_text. Atthird-party/nsh/crates/nsh-platform-linux/src/text_input.rs:3287, the expectedOk(())frompause_inputwas insteadErr("pending input has no editable focus target"). Each job reports 81 passed, one failed, five not run and two skipped. I have not established whether the remaining failure is in the fixture or the production focus transition. - The macOS
desktop_composing_escape_cancels_marked_text_without_blurring_or_dismissing_modalcase also failed in both runs, in 5.263s and 5.270s respectively. Atthird-party/nsh/crates/nsh-platform-macos/tests/terminal/cases.rs:513, the shared five-second AppKit event-pump wait timed out. The logs do not identify which invocation of that shared wait failed, so they do not establish the specific focus/composition phase or its cause. Both platform-library suites passed 86 tests, and the delayed-image capture case passed, which does not establish complete native desktop acceptance. - Both overall CI runs are now completed/failure. Both Windows native jobs passed, including their 192-test platform suites (one skipped), 22-test desktop journeys, and two pixel tests. The PR job checked out synthetic merge
42cb30eed6e7833e07ebd72d3afde7b3bf0bc060; its Git tree is identical to the final and merged commits. The Linux and macOS failures above remain the failed job results; Windows success does not establish complete migration acceptance.
I did not run these native suites locally, and this comment supplies no native migration acceptance or approval. The change is already merged as 57470e4c1542431d89e99dad4205270b8845f383; the remaining Linux failure and the unvalidated migration scope remain open.
Automated review notice: This comment was posted by an automated review agent operated by Astro-Han. It is not an independent human review and does not replace one.
Summary
Replace GPUI desktop and pixel-terminal rendering with the platform-native NSH backends while keeping
third-party/nshchanges restricted to GPUI removal,nsh-terminal, and required host/backend capabilities and bug fixes.nsh-terminal.crates/gpui,third-party/gpui-wgpu,examples/embed-gpui), update CI suites, font attribution, and reviewed dependency notices, and revert non-essentialthird-party/nshdocs/website/CI/CLI churn to keep upstream NSH sync minimal.ExitProcess(nsh-platform-windows).navigation::in_focus_scope/navigation::focus_scope), blur covered responders on modal presentation, preserve queued modalautoFocusacross background blur in the same mount batch, bump focus generation when an existing view becomes editable, arm pending-focus fencing during terminal IME preedit, cancel uncommitted field-editor preedit beforeNSTextFieldends editing, and bypass unsettled focus fencing on plainEscapeso Linux GTK4 matches macOS and Windows (nsh-platform-windows,nsh-platform-macos,nsh-platform-linux).TerminalSurfacelifecycle and wake notifications on engine commits, and map terminalHome/Endto line caret movement (nsh-platform-macos).TerminalSurface::pressable_boundsto the active modal (navigation::focus_scope) and filter disabled /PointerEvents::None/ parked / dying subtrees (nsh-platform-windows).modelDetails().kind === 'loading') before consuming prefillautoSendor rejecting interactive sends as'Model unavailable', and clear stale transcript errors before announcing'live'(Conversation.tsx).CancellationTokeninstead of aborting spawned tasks mid-Clientcall (maka-acp), and release SQLite actor custody pins and slot/capacity permits before waking reply waiters (maka-event-log).LocalStream::poll_flushclean peer disconnects (ERROR_NO_DATA/ os error 232 when no buffered write is pending) and skip empty 0-byte probes on clean flushes/shutdowns (maka-host-runtime), propagate test hostSandboxModeacross candidate restarts, release idlecap_std::fs::Dirhandles inPublishedDirectoryso active workspace directories remain renamable on Windows (maka-fs-tools), and normalize verbatim\\?\paths across Windows workspace bindings and private rules (maka-fs-tools,maka-workspace-support).Breaking change
GPUI embedding APIs in Maka and GPUI vendor crates in
third-party/nshare removed without compatibility shims; desktop and pixel-terminal surfaces run directly on AppKit, Win32/Direct2D, GTK4, or character-terminal fallback.Verification
Rebased onto
origin/rust-previewand verified across WSL (Linux), native Windows (x86_64-pc-windows-msvc), macOS cross-target (aarch64-apple-darwin), and GitHub Actions CI:node scripts/ci.mjs check formatandgit diff --check: passed.node scripts/ci.mjs check tooling-tests(264 tests) and Windowsnode.exe --test scripts/ci.test.mjs(windows-ci): passed.node scripts/ci.mjs check licensesandnode scripts/ci.mjs check notices: passed.node scripts/ci.mjs run contractsandnode scripts/ci.mjs run product: passed.node scripts/ci.mjs run termina: passed (includingx86_64-pc-windows-msvctarget checks).node scripts/ci.mjs run nsh: passed (nsh-*unit/integration/doc tests + web runtime tests, 57 passed).windows-nsh:cargo test --locked --manifest-path third-party/nsh/Cargo.toml -p nsh-platform-windows --features terminal --libwith-D warnings(192 passed, 0 failed).aarch64-apple-darwin):cargo check --locked --manifest-path third-party/nsh/Cargo.toml --target aarch64-apple-darwin -p nsh-platform-macos --features dev,terminal --testswith-D warnings: passed.desktop(cargo test --locked -p maka-cli --no-default-features --features desktop-tests --test native-desktop -- --test-threads=1with-D warnings): 22 passed, 0 failed (locally and inCI/native-windows).pixels(cargo test --locked -p maka-terminal-shell --test native-pixels -- --test-threads=1with-D warnings): 2 passed, 0 failed.windows-desktop(maka-desktop-shell, 3 passed, 0 failed),maka-host-runtime(ipc::windows, 2 passed, 0 failed),windows-skills(maka-skills-native),windows-shell(maka-processGit Bash &maka-settings-nativeshell setting), andmaka-workspace-supportwith-D warnings: passed.maka-event-log,maka-acp,maka-cli(acp::tests::*,terminal::*,candidate::crash::*,distribution),maka-terminal-shell,maka-workbench,maka-fs-tools,maka-workspace-support,maka-host-runtime, andmaka-processwith-D warnings: passed.CI/native-macos), Windows native suites (CI/native-windows), and Linux GTK display tests (CI/linux-nshunder Xvfb) run on GitHub Actions runners.AI use
Tool(s) and scope: OpenAI Codex authored the initial GPUI-to-native migration; Google Antigravity rebased onto
rust-preview, pruned non-essentialthird-party/nshchanges, diagnosed and fixed Windows, macOS & Linux native host/focus/modal/capture/IPC/filesystem/ACP/event-log issues, and ran local WSL + Windows verification. The commit carriesGenerated-by:trailers. Automated PR update; independent human review is required.Checklist
Does this PR entail a change in behavior?