Skip to content

fix(windows): isolate Desktop tool helpers and restore proxy inheritance - #163

Merged
mouzhi merged 2 commits into
mainfrom
fix/browser-computer-use-compat
Sep 5, 2026
Merged

mouzhi merged 2 commits into
mainfrom
fix/browser-computer-use-compat

Conversation

@mouzhi

@mouzhi mouzhi commented Sep 5, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Fix two Windows subprocess compatibility boundaries affecting Browser Use / Chrome Control and native Computer Use under a managed Codex Desktop launch.

  • Route positively identified nested Desktop helper app-servers to the validated official CLI, without starting another Host Runtime or acquiring its ownership lease. Keep the direct Desktop app-server on the Host Runtime.
  • Strip internal Host bootstrap environment from those official CLI children.
  • Recover static current-user Windows proxy settings for sparse-environment CLI helpers and the official tool runtime, respecting explicit environment overrides (including empty values).
  • Package a small supervised codexhost-node-repl.exe proxy and select it through Desktop's supported CODEX_NODE_REPL_PATH override. Preserve a user-selected custom runtime and resolve the official runtime only next to Desktop's explicit NODE_REPL_NODE_PATH.
  • Include regression tests, Windows payload checks, and a compatibility/verification note.

Evidence and diagnosis

On the unchanged 0.5.0 Windows installation:

  1. Native Computer Use returned codex app-server exited before returning response 1. Its auxiliary app-server inherited Host bootstrap variables. A controlled official CLI initialization probe with the same routing environment reproduced STORE_LOCKED / Another codexhost process owns Mapping Store. The new shim initialized the official app-server successfully under the same conditions. Direct Desktop routing remains covered by integration tests.
  2. The primary official app-server had working proxy environment, but the MCP tool runtime and its CLI child did not. Browser navigation/discovery could occur while later requests failed with nodeRepl.fetch request failed, page-state timeouts, or Debugger unattached. The official MCP launcher filters inherited environment variables.
  3. A standalone real official node_repl MCP test made the same trusted-service request to a fixed official ChatGPT endpoint. The original launch timed out at 14 seconds; the new wrapper returned HTTP 200 (about 0.51 seconds for tool execution / 2.66 seconds overall). Only status and timing were recorded, never authenticated response content. Untrusted global fetch is not treated as an equivalent test.

These protocol/network results establish the fixed boundaries. They do not yet establish that every live browser debugger error has the same cause.

Safety and scope

  • No administrator policy, authentication, certificate validation, model restriction, or tool approval is bypassed.
  • No signed Desktop/runtime files, user config, credentials, system proxy settings, or browser profile settings are modified.
  • PAC/WPAD is intentionally not converted to a global proxy; explicit MCP proxy configuration remains available for those environments.
  • Process ancestry checks are bounded and reject missing/reused ancestry. Existing official CLI target validation and process supervision remain in use.
  • Runtime behavior changes and wrapper packaging are Windows-only. macOS has not been exercised in this change.

Validation

  • npm run format:check
  • npm run lint
  • npm run typecheck
  • npm run test:typescript — 2309 passed, 18 skipped
  • npm run check:rust — formatting, Clippy with warnings denied, full workspace tests
  • Real official CLI initialization red/green comparison
  • Real official node_repl trusted-service network red/green comparison
  • Release candidate packaging / installed-file verification — 0.5.0-pr163.43e0f91.1, installed into a new side-by-side candidate directory; launcher, shim, tool wrapper, Host Runtime, controller, and renderer hashes match the release payload
  • Installed release-binary protocol probes — official CLI initialization succeeds; the official trusted-service network comparison again times out without the wrapper (14.25 seconds) and returns HTTP 200 with it (0.496 seconds tool execution / 2.676 seconds overall)
  • Post-restart normal CodexHost turn and stable single Host owner — confirmed PR163 launcher/shim; the same primary runtime remains the Mapping Store owner after browser and native-tool probes
  • Post-restart in-app browser: page read and interaction — Example Domain accessibility tree, click Learn more, read the IANA destination; Google homepage tree also succeeds
  • Post-restart Chrome extension: page read and interaction — separate new test tab, Example Domain accessibility tree, click Learn more, read the IANA destination
  • Post-restart native Computer Use: foreground window observation and harmless interaction — clicked 2, +, 3, pressed Return, and visually verified both the display and history show 2 + 3 = 5

Post-restart native-tool status

The user restarted into the packaged PR163 candidate. Official @oai/sky app/window enumeration, Calculator launch, target selection, activation, and foreground screenshot capture now succeed; the prior app-server early-exit failure did not recur. Initial inputs were rejected by the normal user-input detection guard. After the user explicitly resumed testing with a quiet foreground window, normal screenshot-grounded clicks on 2, +, 3 and a Return keypress succeeded. Fresh screenshots after each action verified the intermediate states and final 2 + 3 = 5 result. The guard was not disabled or bypassed. The primary Host Runtime and Mapping Store owner remained unchanged after the input test.

Known limitations remain: Calculator accessibility was null, and captures while Calculator was covered showed the covering foreground window rather than an unobscured Calculator. Foreground screenshot-based control is verified; unobscured background capture and accessibility-based native input are not claimed as fixed. Their cause has not been attributed to CodexHost by a controlled comparison, and this PR does not patch the official native helper.

All four GitHub CI jobs passed (Windows, macOS, Ubuntu x64, Linux ARM64). Ready for review of the scoped helper-routing/proxy-inheritance fix, with the native capture/accessibility limitations above explicitly retained. No signed app/runtime, machine configuration, or safety guard was changed during post-restart testing.

@mouzhi
mouzhi marked this pull request as ready for review September 5, 2026 09:29
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 5, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-05T09:33:21.998064Z 43e0f91 Draft marked ready
🔒 Security Review ✅ Completed 2026-09-05T09:35:16.103143Z 43e0f91 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 43e0f91c30

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/platform/src/desktop_launch.rs Outdated
Comment on lines +72 to +75
if let Some(wrapper) =
managed_node_repl_override(&shim_path, std::env::var_os("CODEX_NODE_REPL_PATH"))
{
environment.push((OsString::from("CODEX_NODE_REPL_PATH"), wrapper));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve custom node REPL overrides for packaged Desktop

When CODEX_NODE_REPL_PATH names a user-selected runtime, managed_node_repl_override returns None, so this conditional adds no value to the environment block passed to activate_packaged_desktop. AppX launches do not inherit the launcher's process environment, meaning the explicit custom runtime is lost instead of preserved as documented; forward the existing value while substituting the bundled wrapper only when no custom override is present.

AGENTS.md reference: AGENTS.md:L64-L66

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 83f723f. Custom CODEX_NODE_REPL_PATH values (including an explicit empty value) are now returned and included in the AppX activation environment instead of being omitted. Added an isolated-process regression that exercises managed_desktop_environment and the final UTF-16 Windows environment block, covering a custom path with spaces/non-ASCII characters and an empty value. The test failed before the fix with no matching environment entry and passes after it; existing default-wrapper and old-wrapper replacement tests also pass. Local format, lint, typecheck, full TypeScript tests (2309 passed, 18 skipped), and check:rust all passed. No running Desktop, user configuration, or installed candidate was changed for this follow-up.

@mouzhi
mouzhi merged commit 117e1ac into main Sep 5, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant