Repository navigation
fix(desktop): retain the Rust preview client after window close - #6695
Conversation
Keep the admitted client until explicit application exit and capture presentation state before native window teardown. Refs #6668 Generated-by: Maka
Keep the admitted Host connection alive without retaining the AppKit window or UI engine. Add an opt-in resident runner and a reusable native Open/Quit status menu; Dock reopen rebuilds the UI and all explicit Quit paths return to bounded Desktop detach. Generated-by: Maka
Keep Ctrl+C twice aligned with the shell's window-close contract. Explicit native Quit remains the process-exit and bounded-detach path, and future reopened workbenches can close through the same request receiver. Generated-by: Maka
Gate resident window close through a nonblocking opt-in callback and reissue close when the shared shell snapshot completes. Native Quit bypasses the gate, and terminal exit keeps its explicit application-Quit semantics. Generated-by: Maka
Release the window UI on close and reconstruct it from process-owned configuration on Open. Gate native Quit on bounded detach and keep Host following active while no window exists. Add Linux SNI readiness, watcher recovery and isolated D-Bus action/re-registration coverage; reuse the native macOS status menu for optional GPUI. Generated-by: Maka
Re-enter the ordinary close path after Shell snapshot readiness and release the UI only once prepare_close admits it. Keep explicit Quit independent of snapshot readiness and detach on ordinary close if no tray is available. Generated-by: Maka
Validate close-attempt identities and avoid reading resident state during unrelated reentrant Win32 messages. Generated-by: Maka
Preserve the admitted client while releasing each closed UI, reject stale close replies, and route native macOS consumers and embedded tray artwork through CI. Exercise the actual native event loop through quiescence so close-and-exit regressions cannot hide behind immediately queued Open commands. Refs #6668 Generated-by: Maka
Generate and review the native distribution closure with the locked npm dependencies. Preserve the existing Pele and Lucide notices and include the shared Unlicense text for ksni and existing Unlicense components. Refs #6668 Generated-by: Maka
Take the published native input handler while Window still drops inside the final App update. Otherwise deferred native cleanup releases its strong entity owner after the last collection pass, leaving the UI engine alive until another window opens. Exercise real focused paint with native state retained, verify the regression red and green, and run its locked standalone suite through the existing GPUI CI worker. Document the native cleanup boundary without changing Host policy. Refs #6668 Generated-by: Maka
Merge upstream/rust-preview at 0a5ce77. Preserve resident desktop ownership alongside successor Host following, permission utilities and explicit reload pause states. Cover close admission during a pending native reload. Generated-by: Maka
Integrate upstream/rust-preview cb2cc89 without restoring removed GPUI backends. Retain the admitted client in the GTK application owner, exercise release under Xvfb, and preserve shared native window lifecycle callbacks. Fix production macOS feature gates and Objective-C close ABI, and keep transport errors separate from localized message keys. The upstream fixture policy fix restores the intended human child-approval boundary. Generated-by: Maka
Install nextest for the Linux native worker now that it executes desktop tests. Keep the generated TSV's trailing empty columns intact and import the updated native Windows fixture runner. Generated-by: Maka
Update the existing native worker tool-discovery assertion to include the display-backed Linux desktop consumer. Fold the duplicate Linux assertion into that coverage. Generated-by: Maka
Keep Linux's Escape reservation query inside the window module so both keyboard paths share the policy without exposing window attributes. Share AppKit menu tracking with selected text's Copy menu while keeping Menu.popup completion scoped to application menus. Pass the terminal root view to native hit testing instead of its surface. The upstream baseline fails these platform compilations independently of PR #6695. Native build and test validation is delegated to the main session; only stable rustfmt and git diff --check ran here. Generated-by: Maka
Capture the UI thread while creating each window and dispatch the engine callback through that handle. The upstream global window invoke helper no longer exists. Generated-by: Maka
There was a problem hiding this comment.
I reviewed all 40 changed files (+2,794/−264) at 32f6c4ffcdb9c8cb4caa32ec4ae3cece00ff2dc4 against rust-preview cb2cc895896220d8dffea66d16b31329defbbf76. This separates the lifetime of the Desktop client and tray from its UI: ordinary close captures presentation state and destroys the window/engine; Open recreates a window on the admitted connection, and explicit Quit detaches the client. This is a reasonable opt-in extension to the existing native runners. An actual merge succeeds. I found no confirmed P0–P2 defect in the reviewed code; native acceptance remains incomplete.
I checked the close handshake's request identity, five-second timeout, failure recovery, and pointer-identity guard that prevents a late response from closing a replacement window. The Workbench registry holds catalog changes and commands during capture, rejects close during a pending reload, and suppresses stale/disposed responses. The existing conversation capture path flushes drafts before returning; the root state records selected conversations, side panes, settings and plugin panels. This is in-process presentation recovery, not a durable database migration or a guarantee about all pending native input.
I also checked the GTK window release and application hold, SNI registration/loss and retry, no-tray exit, AppKit status-menu ownership and Dock reopen, Windows tray/message-loop ownership, deferred destruction, repeated Open, Explorer restart fallback, and Quit while no window exists. The existing Windows limitation remains: it does not reconnect after its Host stops. AppKit/Linux continue following replacement Hosts without opening a closed workbench; permission windows stay with their original UI/connection. Host lifecycle policy and accepted work are unchanged. The new native runner APIs are opt-in. There is no database schema or protocol epoch change.
Locally, 54 targeted Node tests pass across the close/reload regressions, CI routing and license-file discovery. These tests use controlled native bindings; they do not create AppKit or Windows windows. I separately inspected the raw log of current Linux native CI: all eight Desktop tests actually ran and passed, including the explicitly enabled ignored GTK lifecycle test under Xvfb and private-D-Bus tray registration/loss/recovery/Open/Quit. The GTK case creates and releases real engines/views three times; the tray test uses a controlled SNI watcher, so neither proves a GNOME panel displays a usable icon. Current root build, packaging, tooling, Linux NSH, license and audit checks pass; macOS and Windows are still running.
The Linux/macOS baseline compile repairs are byte-for-byte identical to the four files in #6709. I checked those changes separately: window-owned Escape policy, shared native context-menu tracking without an extra application-menu completion event, and the native-hit-test root argument. Their unrelated baseline compile failures must not be counted as resident-mode regressions.
I have not locally run the AppKit or Windows resident runners, inspected a real GNOME/Explorer tray, or accepted a complete populated business-session lifecycle. Remaining acceptance includes ordinary/minimized close, reopening selected conversations/drafts/panels, duplicate Open, pending-input behavior, hidden Host replacement, utility-window cleanup, no-tray behavior and bounded Quit under real desktop conditions. Current author-provided macOS/Windows observations and historical GPUI screenshots are not my verification. The passing Linux fixture tests and code review do not close that wider acceptance scope.
Current integration update: #6705 has since been merged by another contributor, advancing rust-preview to 8c1b8fc16d647dce0960137840c72f8253c63d7d. An actual merge of this unchanged PR into that current base now fails with content conflicts in scripts/ci.test.mjs and third-party/nsh/crates/nsh-platform-macos/src/chrome.rs. The successful merge above refers to the preceding cb2cc895 base. Please reconcile those overlaps before merging; this does not establish a new runtime defect.
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.
There was a problem hiding this comment.
I reviewed merge commit a48c7c49a069018d4013152c32a7fd5e050b36a9, whose parents are the previously reviewed 32f6c4ffcdb9c8cb4caa32ec4ae3cece00ff2dc4 and then-current rust-preview 1cba85e51aad22958d1af2fb856a0e5ca01ece4d. The PR now has 36 residual files (+2,759/−232) against that base. The two previously reported integration conflicts are resolved, and an actual merge succeeds. I found no confirmed new P0–P2 issue in this merge review.
I separated incoming changes from this PR: of the 58 files changed from the previous PR head, 56 are byte-for-byte identical to the incoming base. Of the 36 files remaining in the PR, 34 are identical to the already reviewed implementation. The two combined files are scripts/ci.test.mjs and scripts/ci/setup.mjs. The resolved test file retains both the Linux display-backed Desktop selection test and the incoming release-tool/digest/retry test. Setup retains the Desktop's nextest selection and XRandR/XFixes dependencies alongside the incoming setup changes. I ran the actual current close/reload, CI and license-discovery Node tests: all 55 pass.
I also checked the merge resolutions and incoming replacements. macOS chrome.rs takes the base's shared track_menu implementation/signature; application-popup completion remains separate from native context-menu tracking. The Linux scroll/window code takes the base's Escape predicate and pub(crate) attributes visibility together, rather than retaining a private-field access with mismatched visibility. These files match the incoming base. This review does not claim a fresh audit of the incoming agent replay feature in #6654.
CI 42555575165 has completed with failure; tooling, license and audit checks have passed. The current macOS job has now failed: 107 platform library tests pass, then the inherited rich_editor_composition_commit_matches_preedit_and_keeps_shortcuts test fails at third-party/nsh/crates/nsh-platform-macos/tests/terminal/cases.rs:1335 because the composition commit returns false (0.896 seconds). The native group records seven passes, one failure and two unrun tests; Desktop close/reopen tests are not reached. The incoming 1cba85e5 base fails the same assertion (0.734 seconds), and this entire test file has the same blob in the base and this PR. I therefore have no evidence that this residency change caused that failure; it is the already reported test failure from #6705. The Windows job has now completed successfully: 225 platform tests pass with one skipped, all 22 Desktop tests pass in 289.736 seconds, and both pixel tests pass in 1.481 seconds. The overall run has completed with failure because of the inherited macOS composition assertion. Full business-session and real tray behavior remain unverified. I have now also read the current Linux native job: all eight Desktop tests pass on this merge commit, including GTK view/engine release and reopen (1.356 seconds) and private-D-Bus tray recovery (5.525 seconds). This is Xvfb and a controlled SNI watcher, not a visible GNOME panel or full business-session acceptance. Real GNOME/Explorer tray behavior, AppKit/Windows close and reopen, pending input, populated conversations/drafts/panels, hidden Host replacement, permission-window cleanup and bounded Quit remain open acceptance items. No database schema or protocol epoch change is introduced by this merge.
Landed integration update: this PR has now been merged by another contributor as 9864d52160376f23aac53cfeb0d389e679e121a0. I verified that the actual merge tree of incoming 033e1a50 and reviewed head a48c7c49 exactly matches the landed tree. That incoming base includes #6710, whose macOS composition regression now passes; the earlier failure above belongs to this PR's pre-fix CI snapshot. The landed branch has its own running CI. I have also read its Linux native job: all eight Desktop tests pass, including GTK release/reopen (1.186 seconds) and controlled SNI recovery (5.486 seconds). This remains display-backed Xvfb/private-D-Bus testing. I have now read the landed macOS job: all 107 platform library tests and all 10 terminal-native tests pass, including the repaired composition regression (0.354 seconds). Desktop then stops at its sixth test, the Goal workflow: after 67.830 seconds it cannot find a single Pause Goal control (desktop_new_session.rs:230). Five Desktop tests pass, one fails and 16 are unrun; pixel tests are not reached. The same Goal test body passes on the incoming 033e1a50 run; this PR changes only a different test in that file. The log and uploaded failure artifact do not identify which of the repeated Pause Goal waits failed or isolate the cause. I have not established whether the residency change caused it, and full business-session acceptance remains open. The branch has since advanced to 75fe3d0e059c58b798782604668f37b56a420255 after #6683. I read that baseline's macOS job: all 107 platform library tests, all 10 terminal-native tests and all 22 Desktop tests pass (217.652 seconds), including the Goal workflow (14.450 seconds). The first pixel test passes; the second then fails after 0.355 seconds while loading the unchanged fixture that binds reserved Cmd+H. This newer passing Goal result does not establish the cause of the earlier 9864d521 failure. The landed Windows job has now succeeded: 226 platform tests pass with one skipped, including the resident close/reopen/hidden-Quit test (0.580 seconds). All 22 Desktop tests pass in 334.121 seconds, including the Goal workflow (21.428 seconds), and both pixel tests pass in 1.500 seconds. The overall 9864d521 run has completed with failure because of the macOS Goal failure described above; its cause remains unestablished. The newer 75fe3d0e Windows job has also succeeded: 226 platform tests pass with one skipped, all 22 Desktop tests pass in 327.844 seconds, and both pixel tests pass in 1.452 seconds. That overall run has completed with failure because of its separate macOS Cmd+H fixture error. At 606a11c27658484d52aa43c4f92066e68e6623f2, #6714 changed two test files (removing reserved Cmd+H and adding a Goal/Todo control wait); I inspected that diff and have now read its Windows job: 226 platform tests pass with one skipped, including the resident close/reopen/hidden-Quit test (0.496 seconds). All 22 Desktop tests pass in 323.098 seconds, including Goal (20.609 seconds), and both pixel tests pass in 1.510 seconds. The macOS job has now also succeeded: all 107 platform library tests, all 10 terminal-native tests, all 22 Desktop tests (196.573 seconds, Goal 14.948 seconds), and both pixel tests (2.182 seconds) pass. The overall 606a11c2 run has completed successfully. This provides passing native regression evidence after the fixture changes; it does not establish the cause of the older Goal timeout. The branch then advanced to ee7e906056aa256e584e21e060ae106e6399c094 through #6703. Its separate CI 42586921797 has now succeeded. I read the native logs: macOS passes 107 platform-library tests, 10 terminal-native tests, all 22 Desktop tests (257.876 seconds), and both pixel tests (3.842 seconds); Windows passes 226 platform tests with one skipped, all 22 Desktop tests (281.816 seconds), and both pixel tests (1.276 seconds). I inspected #6703's log and three-file change summary, not its implementation. These regression results do not complete the real resident-window, populated historical-session or cross-application acceptance described above. The complete native/business-session acceptance remains open.
Subsequent baseline CI update (2026-11-09): The separate Rust baseline 09ca38c23ae9d46214c2743e182fe018c6544429 now has a successful CI run 42612011937, attempt 1. All 35 jobs have finished, including the final test aggregate; I read its log confirming that all planned work succeeded. The native logs I read for that baseline pass macOS 107 platform-library, 10 terminal-native, 22 Desktop (239.939 seconds) and two pixel tests (2.644 seconds); Windows passes 227 platform tests with one skipped, 22 Desktop (338.712 seconds) and two pixel tests (1.470 seconds). The 22 root-test shards total 2,271 passing tests. This closes the previously pending aggregate, while the original Goal-timeout cause, populated historical-state recovery, real desktop residency and cross-application acceptance limits above remain unresolved.
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.
|
Maka CI diagnosis for current head The macOS failure is also present in the final CI of merged #6705, independently of this PR:
The affected IME test and platform input implementation match the integrated upstream code; no assertion, deadline or selector was relaxed here. A queued-composition/focus-admission interaction is being investigated, but is not yet a confirmed runtime root cause or a fix. All 22 root partitions, Linux native, Linux NSH, packaging, product, bridge, NSH, tooling, licenses and audit have passed. Windows hosted native verification is still pending, so this is not an all-green claim. Local Windows product tests (4) and the actual resident lifecycle regression (1) passed after this integration. Automated diagnosis by Maka. |
EnglishPost-merge review of 1. Architectural overlap and tension with
|
Summary
Fixes #6668.
Keep Desktop and its real, already-admitted Host client alive after an ordinary window close, without retaining the UI engine. This branch now integrates upstream
rust-previewthrough1cba85e51(including the merged #6705 native compilation, clipboard and focus fixes): AppKit on macOS, Direct2D on Windows, GTK4 on Linux. It does not restore upstream's removed GPUI backends.Verification
Latest head: a48c7c4, integrating upstream 1cba85e and merged #6705.
rich_editor_composition_commit_matches_preedit_and_keeps_shortcutsfails atcases.rs:1335when the composition commit returns false. The final upstream job and this PR's job fail the same assertion. Unifiedtestcorrectly fails because that required suite failed. Overall CI is not green; later macOS suites were blocked by fail-fast and are not presented as passed.The child-approval fixture now configures effective chat defaults consistently and checks the parent's read-only policy before delegation. No approval rule, timeout or selector was loosened. Superseded compile variants from closed #6709 were removed in favor of #6705; its diagnostic-only follow-up was not carried here.
Earlier Windows and GNOME/XWayland lifecycle runs at
bc93674abverified repeated painted close/Open cycles, the retained Host, watcher recovery, hidden Quit and no-tray exit. GPUI-specific code/tests were retired with upstream. The attached screenshot remains historical pre-integration evidence, not a current GTK4 image.Public API
Application-owned native runners are opt-in; ordinary runners keep their existing lifecycle:
TrayOptions { title, open_label, quit_label }andrun_resident_app(configuration, options, tray, on_active, on_closed, should_close)provide a native tray with a disposable window factory.StatusMenuOptions { title, open_label, quit_label },StatusMenu::new(options, open, quit)andrun_resident_app_with_config(...)provide equivalent menu-bar residency.UiReload::remember(state)stores presentation state without requesting a reload.Review limits
A real GNOME panel icon and a populated business-session/panel restoration walkthrough have not been manually accepted. No GNOME extension was installed, desktop configuration changed, or user session unlocked. Snapshot behavior and native protocol integration are not presented as a full manual business-session walkthrough.
AI use
Tool(s) and scope: Maka assisted with implementation, diagnosis, behavior tests, upstream integration, CI, notices and this description. Material commits carry
Generated-by: Maka; retain it when squashing. The human contributor remains responsible for review and provenance.Checklist
Does this PR entail a change in behavior?