{"slug": "codex-windows-chrome-extension-computer-use-not-connected-field-repair", "title": "Codex Windows Chrome Extension / Computer Use not connected field repair", "summary": "A developer documented a field repair for a Codex Desktop update on Windows that broke browser extension connectivity and Computer Use. The fix involved patching the node_repl shim to handle missing sandbox metadata and modifying the Computer Use bootstrap to fall back to stdio when the native pipe is absent. The repair is designed to be idempotent and version-aware.", "body_md": "Tested on Windows on 2026-06-20 after a Codex Desktop update.\n\nThis is not an official OpenAI fix. It is a field repair for a specific post-update failure where the bundled plugins are installed, but Codex reports that the browser extension is not connected and Computer Use cannot connect.\n\n- Chrome or Edge has the Codex extension installed, but Codex says the browser extension is not connected.\n`browser`\n\n,`chrome`\n\n, and`computer-use`\n\nplugins exist in the local bundled plugin cache.- Reinstalling the browser extension does not fix it.\n- Browser/Chrome control fails before normal page automation begins.\n- Computer Use fails with a native pipe error similar to:\n\n```\nComputer Use native pipe is unavailable: Error: failed to connect native pipe: The system cannot find the file specified. (os error 2)\n```\n\nOn the repaired machine, plugin version `26.616.41845`\n\nwas installed, and the desktop package was:\n\n```\nOpenAI.Codex_26.616.5445.0_x64__2p2nqsd0c76g0\n```\n\nThere were two separate failures after the update.\n\n-\n`node_repl`\n\nbroke because Codex Desktop sent newer sandbox metadata, but the bundled`node_repl.exe`\n\nstill expected the legacy`sandboxPolicy`\n\nfield.Failure signature:\n\n```\ncodex/sandbox-state-meta: missing field `sandboxPolicy`\n```\n\n- Computer Use was taking a Windows native-pipe-only path, but the expected\n`codex-computer-use-*`\n\nnamed pipe was not present. The bundled helper executable was still healthy over stdio:\n\n```\ncodex-computer-use.exe\n```\n\nSo the working repair was:\n\n- Insert a stable\n`node_repl`\n\nshim that rewrites missing sandbox metadata into the older shape before forwarding to the original runtime. - Patch the bundled Computer Use bootstrap so it first tries the native pipe, then falls back to the shipped stdio helper when the pipe is missing.\n- Make the repair idempotent so a restart can reapply it after Codex rewrites plugin/runtime files.\n\nPaste this into Codex on the affected Windows desktop.\n\n```\nYou are fixing my local Windows Codex Desktop install. The browser/chrome/computer-use plugins are installed, but the Chrome/Edge Codex extension says it is not connected after a recent Codex update. Reinstalling the extension did not fix it.\n\nGoal: fix this without rolling back Codex. Do the whole repair end to end, including backups, an idempotent repair script, restart support if needed, and verification.\n\nKnown failure signatures to look for:\n- browser/chrome automation fails before page interaction starts\n- node_repl or MCP reports: codex/sandbox-state-meta: missing field `sandboxPolicy`\n- Computer Use reports: Computer Use native pipe is unavailable\n- native pipe path under \\\\.\\pipe\\codex-computer-use-* is missing\n- codex-computer-use.exe itself works when run over stdio\n\nImportant:\n- Do not use any hard-coded paths from another machine.\n- Discover this machine's actual CODEX_HOME, plugin cache root, runtime hash, plugin versions, Codex CLI path, and browser profile.\n- Back up every file before writing it.\n- Do not downgrade Codex unless I explicitly ask.\n- Use apply_patch for manual edits when possible.\n- Do not import node:process inside node_repl code. It may be blocked.\n- Keep the fix version-aware. If a future plugin version already contains a proper upstream fix, do not overwrite it blindly.\n\nStep 1: Inspect and record state.\n- Locate CODEX_HOME. Check $env:CODEX_HOME, then ~/.codex-work, then ~/.codex.\n- Locate bundled plugin cache: CODEX_HOME/plugins/cache/openai-bundled.\n- Locate installed browser/chrome/computer-use plugin version directories by reading each .codex-plugin/plugin.json.\n- Locate current cua_node runtime under %LOCALAPPDATA%/OpenAI/Codex/runtimes/cua_node/*/bin containing node.exe, node_repl.exe, and node_modules/@oai/sky.\n- Locate Codex CLI under %LOCALAPPDATA%/OpenAI/Codex/bin/*/codex.exe.\n- Check Chrome and Edge native messaging host registration for com.openai.codexextension.\n- Check named pipes for codex-browser-use* and codex-computer-use*.\n- Save findings to a local Markdown log.\n\nStep 2: Repair the Node REPL sandbox metadata mismatch.\n- Create CODEX_HOME/fixes/node-repl-meta-shim.mjs.\n- The shim must spawn the original node_repl.real.exe, rewrite incoming JSON-RPC messages, and if params._meta[\"codex/sandbox-state-meta\"] exists without sandboxPolicy, replace it with:\n  {\n    sandboxPolicy: { type: \"danger-full-access\" },\n    codexLinuxSandboxExe: incoming.codexLinuxSandboxExe ?? null,\n    sandboxCwd: incoming.sandboxCwd if string else process.cwd(),\n    useLegacyLandlock: Boolean(incoming.useLegacyLandlock ?? false)\n  }\n- Preserve both line-delimited JSON and Content-Length framed messages.\n- Rename the original runtime bin/node_repl.exe to bin/node_repl.real.exe if node_repl.real.exe does not already exist.\n- Compile or create a tiny Windows wrapper at CODEX_HOME/fixes/node_repl.wrapper.exe that launches runtime bin/node.exe with CODEX_HOME/fixes/node-repl-meta-shim.mjs and forwards stdio.\n- Copy the wrapper over runtime bin/node_repl.exe.\n- If node_repl.exe is already the wrapper and node_repl.real.exe is missing, stop and report that the original executable cannot be recovered safely.\n\nStep 3: Refresh browser/chrome MCP and native-host config.\n- Update the active browser plugin .mcp.json so node_repl uses the repaired runtime bin/node_repl.exe.\n- Include env values for:\n  NODE_REPL_NATIVE_PIPE_CONNECT_TIMEOUT_MS=1000\n  NODE_REPL_NODE_MODULE_DIRS=<runtime bin/node_modules>\n  NODE_REPL_NODE_PATH=<runtime bin/node.exe>\n  NODE_REPL_TRUSTED_CODE_PATHS=<CODEX_HOME>\n  CODEX_HOME=<CODEX_HOME>\n  BROWSER_USE_AVAILABLE_BACKENDS=chrome,iab\n  SKY_CUA_NATIVE_PIPE=1\n  SKY_CUA_NATIVE_PIPE_DIRECTORY=<existing or generated \\\\.\\pipe\\codex-computer-use-guid path>\n  CODEX_CLI_PATH=<current codex.exe>\n- Update the Chrome plugin extension-host/windows/x64/extension-host-config.json so codexCliPath, nodePath, and nodeReplPath point to the discovered current files.\n- If Edge is being used, ensure HKCU:\\Software\\Microsoft\\Edge\\NativeMessagingHosts\\com.openai.codexextension exists and points to %LOCALAPPDATA%\\OpenAI\\extension\\com.openai.codexextension.json.\n- Also check the Chrome equivalent key.\n\nStep 4: Repair Computer Use fallback.\n- Inspect computer-use/<version>/scripts/computer-use-client.mjs.\n- If it is Windows native-pipe-only and fails when the pipe is absent, patch it so setupComputerUseRuntime does this on Windows:\n  1. close any previous active client\n  2. try NativePipeComputerUseTransport.create()\n  3. if that throws, instantiate a Windows client using a stdio transport that spawns:\n     <runtime bin>/node_modules/@oai/sky/bin/windows/codex-computer-use.exe\n- Reuse the bundled WindowsComputerUseClientBase from:\n  <runtime bin>/node_modules/@oai/sky/dist/project/cua/sky_js/src/targets/windows/internal/computer_use_client_base.js\n- Implement the stdio transport using JSON lines:\n  { id, method, params, meta }\n- Include request timeout metadata:\n  x-oai-cua-request-budget-ms\n- Preserve app approval behavior. If helper output includes an approvalRequest, call nodeRepl.createElicitation when available, then retry with:\n  x-oai-cua-approved-app\n- Install globals.sky through the same proxy/instrumentation pattern the bundled file uses.\n- Copy the patched file to CODEX_HOME/fixes/computer-use-client.<version>.patched.mjs.\n\nStep 5: Create an idempotent repair script.\n- Create CODEX_HOME/fixes/repair-codex-browser-runtime.ps1.\n- It must rediscover paths dynamically where possible.\n- It must restore:\n  - node_repl wrapper\n  - browser plugin .mcp.json\n  - tmp browser .mcp.json if present\n  - chrome extension host config\n  - computer-use patched client only for the version it was built for\n- It must print either:\n  Browser runtime repair: already current.\n  or:\n  Browser runtime repair: updated <changed items>.\n- Run it twice. The second run should say already current.\n\nStep 6: If restarting Codex is needed, create a watchdog first.\n- Create a small PowerShell watchdog that can restart Codex and keep trying every 30 seconds until the top-level Codex process and app-server child are running.\n- If this machine has a custom Work profile launcher, use it.\n- Otherwise discover the Codex Start Menu AppID with Get-StartApps and launch via shell:AppsFolder.\n- Start the watchdog in a hidden PowerShell process before killing Codex so the repair can survive the restart.\n\nStep 7: Verify.\n- Test Chrome/Edge extension control using the Chrome/browser node_repl runtime:\n  - import the bundled browser-client.mjs\n  - setupBrowserRuntime({ globals: globalThis })\n  - get the extension browser backend\n  - open https://example.com/\n  - wait for domcontentloaded\n  - read the title\n  - expected title: Example Domain\n  - finalize test tabs\n- Test Computer Use using the bundled computer-use-client.mjs:\n  - setupComputerUseRuntime({ globals: globalThis })\n  - run sky.list_apps()\n  - expected: list of running Windows apps, including Codex/ChatGPT/browser if open\n  - call sky.close()\n- Check that no orphan codex-computer-use.exe process remains.\n\nDeliverables:\n- A short root-cause summary.\n- Files changed, with backups.\n- The repair script path.\n- Restart watchdog path if created.\n- Exact verification results.\n```\n\nIf the receiving Codex does not already have a restart helper, it can create this as `codex-restart-watchdog.ps1`\n\n. This is intentionally generic. A receiving Codex should specialize `-LaunchCommand`\n\nor `-ProfileMatch`\n\nfor Work/Personal profiles if needed.\n\n``` php\n[CmdletBinding()]\nparam(\n    [string]$LaunchCommand = \"\",\n    [string]$ProfileMatch = \"\",\n    [int]$StartupDelaySeconds = 5,\n    [int]$RetrySeconds = 30,\n    [int]$MaxMinutes = 10,\n    [switch]$NoKill,\n    [switch]$StatusOnly\n)\n\n$ErrorActionPreference = \"Stop\"\n$LogDir = Join-Path $PSScriptRoot \"logs\"\n$LogPath = Join-Path $LogDir (\"codex-restart-watchdog-{0}.log\" -f (Get-Date -Format \"yyyyMMdd-HHmmss\"))\n\nfunction Write-Log {\n    param([string]$Message)\n    $line = \"{0} {1}\" -f (Get-Date -Format \"yyyy-MM-dd HH:mm:ss\"), $Message\n    Write-Output $line\n    if (-not (Test-Path -LiteralPath $LogDir)) {\n        New-Item -ItemType Directory -Path $LogDir -Force | Out-Null\n    }\n    Add-Content -LiteralPath $LogPath -Value $line\n}\n\nfunction Get-CodexProcesses {\n    Get-CimInstance Win32_Process |\n        Where-Object {\n            ($_.Name -ieq \"Codex.exe\" -or $_.Name -ieq \"codex.exe\") -and\n            ($_.ExecutablePath -like \"*\\OpenAI.Codex_*\\app*\")\n        }\n}\n\nfunction Get-TopLevelCodexProcesses {\n    $tops = Get-CodexProcesses |\n        Where-Object {\n            $_.Name -ieq \"Codex.exe\" -and\n            $_.ExecutablePath -like \"*\\app\\Codex.exe\" -and\n            $_.CommandLine -notmatch \"\\s--type=\"\n        }\n\n    if ([string]::IsNullOrWhiteSpace($ProfileMatch)) {\n        return @($tops)\n    }\n\n    return @($tops | Where-Object { $_.CommandLine -like \"*$ProfileMatch*\" })\n}\n\nfunction Get-AppServerForTopLevel {\n    param([uint32]$TopLevelPid)\n\n    Get-CodexProcesses |\n        Where-Object {\n            $_.Name -ieq \"codex.exe\" -and\n            $_.ParentProcessId -eq $TopLevelPid -and\n            $_.CommandLine -like \"* app-server*\"\n        }\n}\n\nfunction Get-ChildProcessIds {\n    param([uint32]$RootPid)\n\n    $all = @(Get-CimInstance Win32_Process | Select-Object ProcessId, ParentProcessId)\n    $result = New-Object System.Collections.Generic.List[uint32]\n    $queue = New-Object System.Collections.Generic.Queue[uint32]\n    $queue.Enqueue($RootPid)\n\n    while ($queue.Count -gt 0) {\n        $currentPid = $queue.Dequeue()\n        foreach ($child in @($all | Where-Object { $_.ParentProcessId -eq $currentPid })) {\n            [uint32]$childPid = $child.ProcessId\n            $result.Add($childPid)\n            $queue.Enqueue($childPid)\n        }\n    }\n\n    return @($result.ToArray())\n}\n\nfunction Get-CodexStatus {\n    $tops = @(Get-TopLevelCodexProcesses)\n    foreach ($top in $tops) {\n        $servers = @(Get-AppServerForTopLevel -TopLevelPid $top.ProcessId)\n        if ($servers.Count -gt 0) {\n            return [PSCustomObject]@{\n                Running = $true\n                TopLevelPid = $top.ProcessId\n                AppServerPid = $servers[0].ProcessId\n                Detail = \"top-level and app-server are running\"\n            }\n        }\n    }\n\n    return [PSCustomObject]@{\n        Running = $false\n        TopLevelPid = if ($tops.Count -gt 0) { $tops[0].ProcessId } else { $null }\n        AppServerPid = $null\n        Detail = if ($tops.Count -gt 0) { \"top-level exists but app-server is missing\" } else { \"not running\" }\n    }\n}\n\nfunction Stop-CodexTree {\n    $tops = @(Get-TopLevelCodexProcesses)\n    if ($tops.Count -eq 0) {\n        Write-Log \"No matching Codex process to stop.\"\n        return\n    }\n\n    foreach ($top in $tops) {\n        $watchdogPid = [uint32]$PID\n        $ids = @((Get-ChildProcessIds -RootPid $top.ProcessId) + $top.ProcessId) |\n            Where-Object { $_ -ne $watchdogPid } |\n            Sort-Object -Descending -Unique\n        Write-Log \"Stopping Codex process tree rooted at PID $($top.ProcessId), excluding watchdog PID ${watchdogPid}: $($ids -join ', ')\"\n        foreach ($id in $ids) {\n            try {\n                Stop-Process -Id $id -Force -ErrorAction Stop\n            } catch {\n                Write-Log \"Process $id stop skipped or failed: $($_.Exception.Message)\"\n            }\n        }\n    }\n}\n\nfunction Start-CodexApp {\n    if (-not [string]::IsNullOrWhiteSpace($LaunchCommand)) {\n        Write-Log \"Launching via custom command: $LaunchCommand\"\n        Start-Process -FilePath \"powershell.exe\" `\n            -ArgumentList @(\"-NoProfile\", \"-ExecutionPolicy\", \"Bypass\", \"-Command\", $LaunchCommand) `\n            -WindowStyle Hidden | Out-Null\n        return\n    }\n\n    $app = Get-StartApps |\n        Where-Object { $_.AppID -like \"OpenAI.Codex_*\" -or $_.Name -match \"Codex\" } |\n        Select-Object -First 1\n\n    if (-not $app) {\n        throw \"Could not find Codex Start Menu AppID. Rerun with -LaunchCommand.\"\n    }\n\n    Write-Log \"Launching shell:AppsFolder\\$($app.AppID)\"\n    Start-Process -FilePath \"explorer.exe\" -ArgumentList \"shell:AppsFolder\\$($app.AppID)\" | Out-Null\n}\n\nWrite-Log \"Codex restart watchdog starting. RetrySeconds=$RetrySeconds; MaxMinutes=$MaxMinutes; NoKill=$NoKill; StatusOnly=$StatusOnly\"\nWrite-Log \"Log: $LogPath\"\n$status = Get-CodexStatus\nWrite-Log (\"Initial status: running={0}; topPid={1}; appServerPid={2}; {3}\" -f $status.Running, $status.TopLevelPid, $status.AppServerPid, $status.Detail)\n\nif ($StatusOnly) {\n    Write-Log \"StatusOnly requested; exiting without changes.\"\n    exit 0\n}\n\nif ($StartupDelaySeconds -gt 0) {\n    Start-Sleep -Seconds $StartupDelaySeconds\n}\n\nif (-not $NoKill) {\n    Stop-CodexTree\n    Start-Sleep -Seconds 3\n}\n\n$deadline = (Get-Date).AddMinutes($MaxMinutes)\nwhile ((Get-Date) -lt $deadline) {\n    $status = Get-CodexStatus\n    if ($status.Running) {\n        Write-Log (\"Codex is healthy. topPid={0}; appServerPid={1}\" -f $status.TopLevelPid, $status.AppServerPid)\n        exit 0\n    }\n\n    Write-Log \"Codex is not healthy yet ($($status.Detail)); launching.\"\n    Start-CodexApp\n    Start-Sleep -Seconds $RetrySeconds\n}\n\nWrite-Log \"Timed out after $MaxMinutes minutes before Codex was healthy.\"\nexit 1\n```\n\nTo start it hidden before restarting Codex:\n\n``` php\n$watchdog = \"C:\\path\\to\\codex-restart-watchdog.ps1\"\n$command = \"& '$watchdog' -RetrySeconds 30 -MaxMinutes 10\"\n$encoded = [Convert]::ToBase64String([Text.Encoding]::Unicode.GetBytes($command))\nStart-Process -FilePath \"powershell.exe\" `\n  -ArgumentList @(\"-NoProfile\", \"-ExecutionPolicy\", \"Bypass\", \"-EncodedCommand\", $encoded) `\n  -WindowStyle Hidden\n```\n\nFor a custom Work profile, pass a launch command:\n\n```\n& .\\codex-restart-watchdog.ps1 `\n  -LaunchCommand \"'C:\\path\\to\\Launch-Codex-Work.cmd'\" `\n  -ProfileMatch \"CodexWork\\UserData\"\n```\n\nOn the repaired desktop:\n\n```\n{\n  \"chrome_extension_test\": {\n    \"ok\": true,\n    \"title\": \"Example Domain\",\n    \"url\": \"https://example.com/\"\n  },\n  \"computer_use_test\": {\n    \"ok\": true,\n    \"appCount\": 40,\n    \"hasEdge\": true,\n    \"hasChatGPT\": true\n  },\n  \"repair_script\": \"Browser runtime repair: already current.\"\n}\n```\n\nComputer Use cleanup was also verified:\n\n```\nGet-Process codex-computer-use -ErrorAction SilentlyContinue\n```\n\nExpected result after `sky.close()`\n\n: no leftover helper process.\n\n- This should be treated as a local repair for a Windows Codex update regression, not as an official patch.\n- The receiving Codex should inspect the installed bundle before editing. Future plugin versions may already fix this upstream.\n- The Computer Use approval path should still be tested with a real app action if the user depends on click/type automation. The lightweight verified test was\n`sky.list_apps()`\n\n. - If the plugins are missing entirely, this repair will not install them. Fix plugin installation/cache first.\n- If the browser extension is installed only in Edge, Edge still needs its own native messaging host registry key.", "url": "https://wpnews.pro/news/codex-windows-chrome-extension-computer-use-not-connected-field-repair", "canonical_source": "https://gist.github.com/stevenworld75/6c59315b858807a1b6d6a238b1db69f6", "published_at": "2026-06-20 21:20:50+00:00", "updated_at": "2026-07-12 03:38:44.475137+00:00", "lang": "en", "topics": ["developer-tools", "ai-tools", "ai-infrastructure"], "entities": ["OpenAI", "Codex", "Chrome", "Edge", "Windows"], "alternates": {"html": "https://wpnews.pro/news/codex-windows-chrome-extension-computer-use-not-connected-field-repair", "markdown": "https://wpnews.pro/news/codex-windows-chrome-extension-computer-use-not-connected-field-repair.md", "text": "https://wpnews.pro/news/codex-windows-chrome-extension-computer-use-not-connected-field-repair.txt", "jsonld": "https://wpnews.pro/news/codex-windows-chrome-extension-computer-use-not-connected-field-repair.jsonld"}}