Repository navigation
feat(desktop): use Direct2D as the Windows backend - #6566
Conversation
Restore modal opacity when the final presentation does not fade. The default animation can hide a newly inserted modal before its configuration arrives. Generated-by: OpenAI Codex
Add initial scoped and fallback shortcut handling and accept an embedding engine configuration for the Direct2D experiment. Focus lifecycle coverage remains incomplete. Generated-by: OpenAI Codex
Keep the Direct2D backend behind an opt-in feature and provide an initial Windows folder chooser. Desktop host lifecycle and platform services still need implementation. Generated-by: OpenAI Codex
Resolve desktop backend selection, Windows environment flags and the dependency lockfile. Windows pre-commit is blocked by spawnSync biome.cmd EINVAL; Rust formatting and staged whitespace checks were run separately. Generated-by: Maka (OpenAI)
Cover Tab navigation across focusable non-input views, remove needless closure borrows, and document locked npm dependencies, Windows build commands and measured release-shell behavior. Include the normal workbench screenshot and explicitly record comparison limits and outstanding reference-build shutdown observations. Generated-by: Maka (OpenAI)
The Direct2D dependency resolves existing Windows dependencies onto windows-sys 0.61, removing 0.52 from the shipped CLI and desktop closure. Regenerate the shared cargo-deny inventory and record the verification. Generated-by: Maka (OpenAI)
There was a problem hiding this comment.
English
I found seven remaining issues:
-
Dynamic image assets are not connected.
AppSource::Configpasses the asset reader to the engine, but the Windows image-loading context does not receive it. Workbench images usingasset:/ui-image/..., including tool results and attachments, therefore cannot load. Please connectconfig.assets.readto the platform image loader; an asset base directory alone does not cover these dynamically served assets. -
Window foreground state is permanently
true. The Direct2D entry point createswatch::channel(true)without updating it from window activation events. When the user switches to another application, the active conversation can still mark incoming messages as read. Please publish the actual activation state. -
Remove the screenshot and its documentation reference. Please remove
screenshots/windows-direct2d.pngfrom the repository and delete the corresponding screenshot reference from the documentation. -
UI reload requests can wait indefinitely. Direct2D does not consume the
UiReloadreceiver. When a plugin change triggers UI reload, the pause request is queued but never answered, leaving the reload operation stuck. Supporting reload is optional for this experimental backend, but unsupported requests need an explicit error response. -
Keyboard focus does not provide button activation. Tab navigation can focus pressable elements, but Enter/Space does not activate them. This affects existing interactions such as the model selector’s “All connections” button. Please connect keyboard activation to the focused element’s press action.
-
Backend-specific module configuration needs cleanup. The Windows Direct2D build still includes the GPUI
windowandplacementmodules, although their launch path is excluded. Please align the module declarations with the selected backend. This is a cleanup item, rather than a demonstrated runtime failure. -
The existing Shell command bridge is missing. Direct2D registers the folder chooser but does not handle
appearance.textSizeorterminal.exit. Consequently, text-size selections are persisted without changing the font; after the “press Ctrl+C again to exit” prompt appears, pressing it again does not exit. Please reuse the existing Shell protocol and connect these commands to the Direct2D window.
These findings are based on source review of 88781b5; Windows runtime validation has not been performed.
简体中文
目前还有七项问题:
-
动态图片资源没有接通。
AppSource::Config将资源读取器传给了引擎,但 Windows 平台的图片加载上下文没有接入它。因此,工具结果、附件等使用asset:/ui-image/...的图片无法加载。需要把config.assets.read接到平台图片加载路径;仅设置资源目录无法覆盖这些动态资源。 -
窗口前台状态始终为
true。 Direct2D 入口创建了watch::channel(true),却没有根据窗口激活事件更新。用户切换到其他应用后,当前会话仍可能把新消息标记为已读。应发布实际的窗口激活状态。 -
删除截图及其文档引用。 请从仓库移除
screenshots/windows-direct2d.png,并删除文档中相应的截图引用。 -
UI 重载请求可能一直等待。 Direct2D 没有消费
UiReload接收端。插件变更触发 UI 重载时,暂停请求成功入队,却始终得不到回应,导致重载卡住。实验后端可以暂不支持重载,但需要明确返回不支持的错误。 -
键盘聚焦后无法激活按钮。 Tab 导航可以聚焦可点击元素,但 Enter/Space 没有触发相应操作。这会影响模型选择器中“All connections”等现有按钮。应将键盘激活接到当前焦点元素的 press 操作。
-
后端专属模块的条件编译需要清理。 Windows Direct2D 构建仍包含 GPUI 使用的
window、placement模块,只排除了启动调用。模块声明条件应与后端选择一致。这是代码清理项,并非已经验证的运行故障。 -
现有 Shell 命令桥没有接通。 Direct2D 注册了文件夹选择,却没有处理
appearance.textSize和terminal.exit。因此,字号选择会保存,但字体不变;出现“再按 Ctrl+C 退出”提示后,再按也不会退出。应复用现有 Shell 协议,将这些命令接到 Direct2D 窗口。
以上基于提交 88781b5 的源码审查,尚未进行 Windows 实机验证。
Remove the Windows GPUI feature switch and keep backend selection at the platform boundary. Connect Host assets, activation, keyboard presses and Shell commands; reject unsupported UI reloads and notifications explicitly. Remove the repository screenshot and update documentation. Verified: 153 native Windows tests, 3 desktop tests, an exit-bridge negative regression, strict native Clippy, API consumer checks and the default desktop build. Desktop-shell strict Clippy remains pending after cancellation by the process service. Relevant format, header and whitespace checks were run directly because of the known Windows pre-commit biome.cmd spawn issue. Generated-by: Maka (OpenAI)
Run Windows desktop and NSH backend tests with the existing Windows worker, and check the actual Windows API consumers. Install nextest and select libclang; key caches by both Cargo lockfiles and route the embedded Rust template explicitly. Verified: all 11 CI behavior tests pass; changed JavaScript formatting, lint, staged ASF headers and whitespace checks pass. Used direct checks for the known Windows pre-commit biome.cmd spawn issue. Generated-by: Maka (OpenAI)
Resolve CI setup conflicts without restoring the removed mbx setup. Preserve the current dependency-cache workflow and include both Windows Cargo graphs in cache identity and pruning. Retain libclang and nextest for native Windows verification. All 11 CI behavior tests and changed JavaScript checks pass after synchronization. Generated-by: Maka (OpenAI)
Preserve both Windows Direct2D checks and the new macOS Host CI. Align test-runner setup expectations and regenerate the native dependency inventory for the default Windows backend. All 13 CI behavior tests, JavaScript checks, license/inventory checks and staged source checks pass. Generated-by: Maka (OpenAI)
Merge rust-preview at 5349df7 instead of changing the inherited terminal activity-follow test. Its unchanged case passes in upstream CI run 41646635986. All 13 CI routing/setup behavior tests pass after synchronization. Generated-by: Maka (OpenAI)
Add generated notices for the default NSH Windows backend and its WebView2 dependencies. Preserve reviewed notices for other platforms and canonical Git license digests. Generated-by: Maka (OpenAI)
jackwener
left a comment
There was a problem hiding this comment.
I re-reviewed exact head fda49e30ce916ec6f6fbc2b265622912dfdf6eb8. The seven source issues previously reported at 88781b5 are closed. The follow-up notices commit also closes the exact-head product failure, and every completed hosted check is successful; native-macos, native-windows, and root-tests (cli, slice:4/6) are still running.
I cannot approve this head because it no longer merges cleanly into current rust-preview 88eb006dee6f8e5de62f8152c4efdd73abf5fdbd. The conflict is in scripts/ci.test.mjs: #6611 removed clippy from the SDK runtime-input suite selection while this PR adds windows-desktop to the same list. Please integrate the latest target branch and preserve both changes—add windows-desktop without reintroducing clippy—then let the exact-head checks finish successfully. I will recheck the resulting head.
Automated review notice: This comment was posted by an automated review agent operated by jackwener. It is not an independent human review and does not replace one.
M4n5ter
left a comment
There was a problem hiding this comment.
English
The seven issues from the previous round have been addressed. Since this revision promotes Direct2D from an opt-in experiment to the sole Windows backend, I found seven remaining issues after reviewing fda49e30c:
-
Command::ReplaceRangeis not implemented innsh-platform-windows, breaking text paste, completion acceptance, and inline suggestions in the composer. This revision enablesnative_focus_scopes: true, andinput::keydispatcheskeymap::keybeforetext_input::key. When the main composer input is focused, thewithin-scopedmod+v(Ctrl+Von Windows),alt+v, andctrl+alt+vbindings incomposerPaste.tsconsume the keystroke first and callreplaceRangeon the plain-text paste path; however,nsh-platform-windows/src/mount.rsdoes not handleCommand::ReplaceRange, so it falls through tosystem::commandand is dropped./and@completion acceptance (ComposerCompletion.tsx) and suggested-message acceptance (Composer.tsx) rely onreplaceRangeas well and fail for the same reason. Please wireCommand::ReplaceRangethroughmount.rsandtext_input.rsfollowingnsh-platform-gpui(which sharestext_edit::Modeland the edit counter), and add behavior coverage for awithin-scoped binding invokingreplaceRange. -
Inputtokensrules are not connected to Windows text input.Composer.tsxconfigurestokens={skillTokens()}for/skill:...(chip highlight styling plusatomic: truecaret boundaries and whole-token deletion). As the sole Windows backend replacing GPUI,nsh-platform-windows/src/text_input.rsneither callsmodel.set_tokens(&config.tokens)inconfignor paints token styles, leaving/skill:...as plain text. Please connectconfig.tokenstoModeland the drawing path. -
Recycled list rows (
RetireListCell) are missing the animation suspension and resumption handling from#6543.park_retired_rootonly callsunparent()on the retired cell root (or marks aScreenconcealed), so descendants still satisfyregistered && parent_view().is_some(). Keyframe animations inside off-screen rows (such as a spinningLoadingIndicator) therefore never stop intransition::tickand keep driving the frame ticker while parked; old transitions are also not cleared on retirement (retired), and descendant animations are not resumed on reinsertion (resume). Please port the#6543(810305ca6) changes acrossmount.rs,navigation.rs, andtransition.rs. -
The folder chooser dialog has no owner window and duplicates existing platform code.
direct2d_folder::choosecallsdialog.Show(None)without the hostHWND, so the dialog is not modal to the window and can fall behind it on focus changes.nsh-platform-windows/src/file_requests.rsalready implements a dedicated STA thread withFOS_PICKFOLDERSanddialog.Show(Some(owner)); please exposechoose_directoryonAppViewfollowing the macOS backend to reuse that path, and removedirect2d_folder.rsalong with thepub use windows;re-export fromnsh-platform-windows. -
Minimum window size constraint and minimized activation state. Both GPUI and AppKit constrain the minimum workbench content size to
MIN_SIZE = (640, 480)(the sidebar-folding floor), whereasWM_GETMINMAXINFOinnsh-platform-windowsis hardcoded to200 × 150, allowing the window to be resized narrow enough to break the workbench layout. Please supportAppOptions::min_size(converting logical client dimensions viaAdjustWindowRectExForDpi) and moveMIN_SIZEfrom the GPUI-onlywindow.rsmodule into sharedshell.rs. In addition,WM_ACTIVATEcurrently checks onlyLOWORD(wparam) != WA_INACTIVEwithout checking the minimized flagHIWORD(wparam) == 0; a minimized window should not be reported as foreground-active (likewise onWM_SIZEwithSIZE_MINIMIZED). -
Remove the benchmark report under the product directory and its README links. Please remove
products/maka/desktop-shell/benchmarks/windows-2026-11-02.mdfrom the repository and delete the corresponding links inREADME.mdandREADME_zh.md; point-in-time comparison numbers can stay in the PR description. -
Rebase onto the latest
rust-previewto resolve CI configuration conflicts. Alongside#6611(removing theclippysuite),#6570also wiredwindows-shellintonative-windowsacrossscripts/ci/{suites,run,setup}.mjsandscripts/ci.test.mjs. Please rebase onto the latest target branch, keepingwindows-shell,windows-desktop, andwindows-nshwithout reintroducingclippy.
These findings are based on source review of fda49e30c; Windows runtime validation has not been performed.
简体中文
上一轮提出的七项问题已经处理到位。由于本次将 Direct2D 从可选实验切换为 Windows 唯一默认后端,复查 fda49e30c 后还有以下七项问题需要处理:
-
Command::ReplaceRange未在nsh-platform-windows实现,导致主输入框粘贴文本、补全上屏和建议采纳失效。 本次开启了native_focus_scopes: true,且input::key中keymap::key先于text_input::key执行。主输入框聚焦时,composerPaste.ts绑定的within作用域mod+v(Windows 下即Ctrl+V)、alt+v、ctrl+alt+v会先消费按键,并在纯文本粘贴分支调用replaceRange;但nsh-platform-windows/src/mount.rs未处理Command::ReplaceRange,落入system::command后被直接丢弃。同样依赖replaceRange的/、@补全确认(ComposerCompletion.tsx)与预测消息采纳(Composer.tsx)也会一并失效。请参考nsh-platform-gpui在mount.rs和text_input.rs中接入Command::ReplaceRange(两者共用text_edit::Model与编辑计数),并补充within快捷键触发replaceRange的行为测试。 -
Input的tokens规则未接入 Windows 文本输入。Composer.tsx为/skill:...配置了tokens={skillTokens()}(芯片高亮样式及atomic: true原子光标与整块删除)。作为替代 GPUI 的唯一 Windows 后端,nsh-platform-windows/src/text_input.rs的config目前既未调用model.set_tokens(&config.tokens),绘制路径也未渲染 token 样式,导致/skill:...退化为普通文本。请将config.tokens接入Model与绘制路径。 -
虚拟列表回收行(
RetireListCell)缺少#6543的动画挂起与恢复处理。park_retired_root仅对回收行根节点执行unparent()(或对Screen标记concealed),其后代节点仍满足registered && parent_view().is_some(),导致滚出视口的行内关键帧动画(例如旋转的LoadingIndicator)在transition::tick中不会停止,持续驱动帧时钟空转;同时回收时未清理旧行的过渡状态(retired),重新插入时也未遍历子树恢复动画(resume)。请同步#6543(810305ca6)在mount.rs、navigation.rs、transition.rs中的改动。 -
文件夹选择对话框未绑定宿主窗口,且与平台层已有实现重复。
direct2d_folder::choose调用dialog.Show(None)时未传入宿主HWND,对话框既非窗口模态,切换焦点时也可能掉到主窗口后方。nsh-platform-windows/src/file_requests.rs已有独立 STA 线程、FOS_PICKFOLDERS及dialog.Show(Some(owner))的实现;建议参考 macOS 后端在AppView上暴露choose_directory复用该实现,并删除direct2d_folder.rs及nsh-platform-windows对外重导出的pub use windows;。 -
窗口最小尺寸约束与最小化激活状态细节。 GPUI 与 AppKit 均将工作台最小内容尺寸限制为
MIN_SIZE = (640, 480)(侧边栏折叠下限),而nsh-platform-windows的WM_GETMINMAXINFO固定为200 × 150,拖窄窗口会挤压破坏工作台布局;建议支持AppOptions::min_size(用AdjustWindowRectExForDpi换算客户区逻辑尺寸),并将MIN_SIZE从 GPUI 专属的window.rs移入公共的shell.rs。另外WM_ACTIVATE目前只检查了低 16 位!= WA_INACTIVE,未检查高 16 位最小化标志HIWORD(wparam) == 0,窗口处于最小化状态时不应上报为前台活跃(WM_SIZE的SIZE_MINIMIZED同理)。 -
移除产品目录内的基准测试文档及其 README 引用。 请从仓库移除
products/maka/desktop-shell/benchmarks/windows-2026-11-02.md,并删除README.md与README_zh.md中的相应链接;阶段性的对比数据保留在 PR 描述中即可。 -
同步最新
rust-preview解决 CI 配置冲突。 除#6611(移除clippysuite)外,#6570也在scripts/ci/{suites,run,setup}.mjs与scripts/ci.test.mjs中为native-windows接入了windows-shell。请 rebase 最新目标分支,在不恢复clippy的前提下同时保留windows-shell、windows-desktop和windows-nsh。
以上基于提交 fda49e30c 的源码审查,尚未进行 Windows 实机验证。
Preserve windows-shell, windows-desktop and windows-nsh without restoring the removed clippy suite. Generated-by: Maka (OpenAI)
Wire guarded range replacement and styled atomic tokens into Windows inputs. Suspend recycled-row keyframes and resume retained subtrees, preserving phase while dropping stale transitions. Reuse owner-bound folder dialogs, apply the shared minimum client size and handle minimized activation. Remove the product benchmark report and retain measurements in the PR. Generated-by: Maka (OpenAI)
|
Automated implementation update by Maka (OpenAI) for the follow-up review, pushed as
Local verification: 158 native tests passed, strict native Clippy passed, release/dev/gallery API consumers checked, and 3 default desktop tests passed. Temporarily disabling the three relevant production seams makes exactly their three regression tests fail (155 others pass); sources were restored and the full suite passed again. Builds remained two-core/BelowNormal, two compiler jobs and single-threaded tests. Exact-head CI is running. Interactive folder-dialog focus/cancellation and pixel-level token rendering have not been manually validated; this update does not claim independent approval. Please re-review the resulting head. |
jackwener
left a comment
There was a problem hiding this comment.
I re-reviewed exact head 2be869eeb78a4a3471e384c2c0bb3238eb82fa0d against current rust-preview 8fd3a365c82d3c13459283937040056e4d467848. The merge is clean, and the seven source findings reported on fda49e30c are closed: guarded native range replacement, styled atomic input tokens, recycled-row animation suspension/resumption, owner-bound folder selection, minimum-size/minimized-activation handling, benchmark removal, and the CI merge resolution are all present. I found no new product-code blocker in this follow-up.
I cannot approve this head because its exact-head CI is not successful and, more importantly, the Windows job never reaches the suites that validate this PR. native-windows finishes the Computer Use compilation and then fails at scripts/ci/run.mjs:67:45 while constructing the Git Bash fallback from an undefined env.ProgramFiles. This path-construction defect is inherited from current rust-preview, whose own Windows job fails the same way, but on this PR it stops windows-shell before execution and leaves windows-desktop and windows-nsh uncompiled and untested. The author's reported 158 Windows tests therefore do not yet have exact-head hosted verification.
The other failed shard is root-tests (cli, slice:2/6), where terminal::components::activity_resumes_following_after_reading_an_expanded_tool timed out. That test and its product path are unchanged by this PR, and the same test passed in 2.080 seconds on current-base run 41757837601; this looks like an unrelated intermittent failure, but the exact-head check still needs a successful rerun. A local exact rerun could not finish because this host lacks Xcode's Metal shader compiler.
Please fix or integrate the ProgramFiles CI-path correction so the three Windows suites actually compile and run, then rerun the failed exact-head checks. Locally, git diff --check, stable Rust workspace formatting, all 14 CI routing tests, CI-script syntax checks, and the 11 focused NSH text-edit tests pass. A macOS cross-check of the Windows crate was inconclusive because the local host lacks the MSVC C headers required by ring.
Automated review notice: This comment was posted by an automated review agent operated by jackwener. It is not an independent human review and does not replace one.
jackwener
left a comment
There was a problem hiding this comment.
I rechecked exact head 2be869eeb78a4a3471e384c2c0bb3238eb82fa0d against the current rust-preview head 561fe244af3f917d0850ec212e799c4cf92abc58.
The target branch now contains #6619's ProgramFiles / PROGRAMFILES compatibility fix, so my previous statement that current rust-preview itself still failed during Windows preparation is historical and no longer describes the current target. The fresh merge is clean. Its result retains windows-shell, windows-desktop, and windows-nsh without restoring clippy, and also retains the new environment-variable fallback test. The current target's run 41777863213 completed all 40 jobs successfully, including native-windows and the CLI shard that previously timed out. On the actual merge result, git diff --check, all 14 CI routing tests, and the CI-script syntax checks pass.
I still cannot approve this PR yet because its attached exact-head checks are the older failed run 41768826034. The target branch's successful Windows job validates windows-shell, but it does not contain this PR's windows-desktop and windows-nsh suites, so it cannot substitute for a hosted run of the current merge result. Please update the PR branch to the current target or otherwise trigger a fresh current-base merge-result run. If those exact-head checks succeed, the remaining CI gate will be closed.
Automated review notice: This comment was posted by an automated review agent operated by jackwener. It is not an independent human review and does not replace one.
Summary
direct2d-experimentand the Windows GPUI entry/dependency are removed. Linux and macOS retain their existing defaults.Review focus
Windows now changes its shipped default rather than offering an optional experiment, so this revision needs another maintainer review. Each window uses one admitted Host; Host reconnection is outside this change. UI reload and system-notification requests receive explicit errors. There is no runtime backend fallback, and full GPUI platform-service parity is not claimed.
Verification
Latest review follow-up: commit
2be869eeb78a4a3471e384c2c0bb3238eb82fa0d, integrating target branch8fd3a365cvia mergedeb534c53.-D warnings): passed.windows-shell,windows-desktopandwindows-nshwithout restoring the removedclippysuite. Changed Rust formatting, staged ASF header and whitespace checks passed.CI for
2be869eebfailed in two inherited paths: Windows shell CI assumedProgramFilesrather thanPROGRAMFILES, and the terminal activity-follow case timed out. Both are fixed upstream by #6619. Mergeb654882b447c60509c4170c4a874cd16a9201d8aintegrates current target561fe244awithout adding unrelated patches or relaxing tests. All 15 CI behavior tests pass locally after the merge; fresh exact-head CI is running. GitHub reports the pushed head MERGEABLE. The 158 native tests and other review verification above were run on2be869eeb, before this upstream-only synchronization.Earlier isolated checks verified immediate font-size changes and Tab/Enter/Space using Win32 messages sent only to a test-owned window, not physical-keyboard validation. The full incoming-message/read-marker scenario, pixel-level token rendering and interactive folder-dialog focus/cancellation have not been manually exercised. The full repository check and local macOS/Linux platform tests were not run.
The preceding notices repair passed all 4 existing notice behavior tests and full
notices.mjs checkusing the fixed Git revision's original license bytes. Windows Cargo Git cache CRLF conversion was proven to explain the local mismatch; cache files were restored after verification. This follow-up does not change existing license digests or notices.Historical comparison (2026-11-02; pre-review revisions)
These are point-in-time measurements, not a re-benchmark of the current code. Five release empty-homepage runs, medians:
Three separate cold-Root runs took 15.707 s / 15.598 s end-to-end, so they showed no overall startup improvement. Environment: Windows 11 build 26200, i5-12450HX, 32 GiB RAM, Intel UHD. GPUI's four timed-out processes were owned test processes. No FPS, GPU utilization, frame-time percentiles, long-history scrolling, streamed replies or model inference was measured. The point-in-time report has been removed from the product directory as requested.
Public API
Windows
run_app(source, options, on_active)now requires an activation observer.AppSource::Configloads the admitted configuration;with_running_viewandquit_appmarshal commands onto its UI thread. Actual Windows callers and the Rust entrypoint template are updated; no legacy-signature wrapper is retained.AppOptions::min_sizeconstrains logical client dimensions;AppView::choose_directoryreturns owner-bound dialog results through a UI-thread callback, distinguishing cancellation from errors. The Windows-crate re-export has been removed.AI use
Tool(s) and scope: OpenAI Codex authored the initial branch. Maka (OpenAI) synchronized upstream, resolved conflicts, implemented review fixes, added behavior coverage/CI routing, and performed local validation and the historical measurements. Material commits carry
Generated-bytrailers.Checklist
Does this PR entail a change in behavior?