Expose a supported way to disable browser-use ambient network initialization

Open 💬 3 comments Opened May 8, 2026 by zhanglg12
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

Environment

  • Codex Desktop App: 26.506.21252 / build 2575
  • Platform: macOS 26.3.1, Darwin 25.3.0, Apple Silicon
  • Chrome plugin: openai-bundled Chrome plugin 0.1.7
  • Related issue: #21704

Summary

There appears to be an existing internal browser-use request metadata flag that can disable the ambient network/account initialization path:

x-codex-browser-use-disable-ambient-network: true

When this flag is present in nodeRepl.requestMeta, the bundled browser-client.mjs skips the ambient branch that starts Sentry/Statsig/account initialization and eventually calls:

nodeRepl.fetch("https://chatgpt.com/backend-api/me")

That is useful for cases like #21704, where the Chrome extension backend is healthy but setupAtlasRuntime() hangs because the non-browser nodeRepl.fetch() path gets stuck on the ambient /backend-api/me probe.

The problem is that there does not appear to be a supported way for a packaged Codex Desktop user to set this request metadata flag.

What I observed

browser-client.mjs contains the gate:

var j2 = "x-codex-browser-use-disable-ambient-network";
function Ps() {
  return globalThis.nodeRepl?.requestMeta?.[j2] === true;
}

var Ry = async () => {
  let e = await (await Sn("https://chatgpt.com/backend-api/me")).json();
  ...
};

var Dy = () => {
  Ps() || (Og(), Iy(), ep());
};

So when Ps() is true, the ambient network/account path is skipped.

The node_repl binary also appears to recognize BROWSER_USE_DISABLE_AMBIENT_NETWORK=1 when launched directly. In a standalone MCP probe, launching node_repl with:

BROWSER_USE_DISABLE_AMBIENT_NETWORK=1

produced:

{
  "x-codex-browser-use-disable-ambient-network": true
}

However, setting this for Codex Desktop did not make the packaged app's built-in node_repl receive the flag. After restart, the node_repl process still only received request metadata similar to:

{
  "x-codex-browser-use-available-backends": ["chrome", "iab"]
}

I also tried shell_environment_policy.set in ~/.codex/config.toml; it parsed successfully but did not affect the built-in node_repl MCP server environment/request metadata.

Local validation of a possible fix

Without modifying the app bundle or browser-client.mjs, I tested a local wrapper via CODEX_NODE_REPL_PATH that:

  1. preserves the NODE_REPL_REQUEST_META generated by Codex Desktop;
  2. adds "x-codex-browser-use-disable-ambient-network": true;
  3. execs the official bundled node_repl binary.

With that metadata present, Chrome browser-use setup started working again:

{
  "disableAmbient": true,
  "backend": "extension",
  "tabCount": 4
}

setupAtlasRuntime() no longer timed out on the ambient /backend-api/me path, and browser.user.openTabs() returned promptly.

This is only a local diagnostic workaround, not a supported fix, but it suggests that the existing metadata flag is sufficient to unblock Chrome extension discovery for this failure mode.

Suggested fixes

Any of these would make the internal flag usable without local wrappers:

  1. In the packaged app's browser-use node_repl MCP configuration, honor BROWSER_USE_DISABLE_AMBIENT_NETWORK=1 by adding:
{
  "x-codex-browser-use-disable-ambient-network": true
}

to the generated NODE_REPL_REQUEST_META.

  1. Expose a supported Codex config key for this behavior, for example a browser-use setting that maps to the same request metadata flag.
  1. Make the ambient /backend-api/me initialization non-blocking or bounded by a short timeout, so Chrome extension discovery can proceed even when the ambient account probe fails, returns HTML, returns a Cloudflare challenge, or otherwise cannot complete.

Expected behavior

If the Chrome extension/native host is healthy, setupAtlasRuntime() should be able to discover and use the Chrome extension backend even when optional ambient account/analytics initialization cannot complete.

Actual behavior

Without the metadata flag, setupAtlasRuntime() can hang until the JS execution kernel times out:

js execution timed out; kernel reset, rerun your request

This happens before any browser tab work, even though the extension-host socket can be healthy.

View original on GitHub ↗

3 Comments

github-actions[bot] contributor · 3 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #21704

Powered by Codex Action

Anonymousnake · 3 months ago

帅的哥们,这个方法修好了

tavaresgmg · 3 months ago

I hit a related macOS case on a newer Codex Desktop build. Sanitized details below.

Environment:

  • Codex Desktop: 26.513.31313 / build 2867
  • macOS: 26.5 (25F71)
  • Google Chrome: 148.0.7778.168
  • Chrome plugin: chrome@openai-bundled / 0.1.7
  • Codex Chrome Extension: 1.1.4_0
  • Extension ID: hehggadaopoacecdllhhajmbjkdcmajg
  • Native host: com.openai.codexextension

Config/runtime signals:

  • ~/.codex/config.toml has [plugins."chrome@openai-bundled"] enabled = true.
  • The Node REPL request metadata advertised x-codex-browser-use-available-backends: ["chrome"].
  • The local config also had [features] browser_use = false; I am not sure whether that is relevant because the turn metadata still advertised the Chrome backend.

Plugin health checks passed:

  • Chrome was running.
  • check-extension-installed.js --json reported the extension installed, registered, and enabled in the Chrome Default profile.
  • check-native-host-manifest.js --json reported the manifest exists, host name matches, and allowed_origins contains chrome-extension://hehggadaopoacecdllhhajmbjkdcmajg/.
  • The native host process existed and held a /tmp/codex-browser-use/<uuid>.sock.

Observed failure:

  • Browser bootstrap initially could not acquire the Chrome backend and returned Browser is not available: extension.
  • A direct agent.browsers.list() call returned [] even though the same turn metadata advertised ["chrome"].
  • This happened before page-specific work, so it did not look like a Gmail/site issue.

Recovery observation:

  • After resetting the JS runtime and re-running the official bundled Chrome browser-client.mjs bootstrap, agent.browsers.list() returned a Chrome backend with type: "extension".
  • After that, agent.browsers.get("extension") succeeded.
  • A direct nodeRepl.fetch("https://chatgpt.com/backend-api/me") returned HTTP 200 JSON in this environment, so my case may not be the exact Cloudflare/ambient-fetch hang from #21704. It still looks like the Chrome backend can be advertised in request metadata while discovery temporarily returns no backend until the JS runtime is reset/rebootstrapped.

Why I think this belongs here:

  • The local Chrome extension/native-host checks were healthy.
  • The failure was in browser backend discovery/availability, not Chrome installation and not a target website.
  • The successful recovery after JS runtime reset suggests a runtime/bootstrap state issue around the same browser-use/native-pipe path discussed here.