You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] Remote Link discovery picks a different/stale ocx than the one serving the Child, and misses npm-prefix installs #8359
Remote Link discovery (REMOTE_OCX_SCRIPT in src/link/ssh-argv.ts, OCX_CANDIDATES in src/link/remote-windows.ts) picks the first runnable ocx from a fixed candidate list. That binary is often not the one serving the Child, and common install locations are missing. ocx link probe then reports the wrong version or fails outright, even though /healthz on the Child is fine.
Observed today (three machines)
Child
Serving runtime (/healthz)
Probe result
macOS A, npm global with prefix ~/.local/node
2.51.0 → 2.99.0
Remote Link failed during remote OpenCodex discovery — ~/.local/node/bin is not in the candidate list nor the non-login PATH
macOS B, npm global under /opt/homebrew + old desktop app
2.99.0 (npm)
ocxVersion: "2.77.0" — /Applications/OpenCodex.app/Contents/MacOS/ocx wins over PATH
Windows, npm global (%APPDATA%\npm\ocx.cmd) + an old bun global
2.96.0 (npm)
ocxVersion: "2.32.1" — Get-Command ocx.exe finds ~\.bun\bin\ocx.exe; ocx.cmd is never considered
Workaround was installing the 2.99.0 desktop app/MSI on every Child so the first candidate matched. That leaves two installs (desktop CLI + npm-managed service) on each machine.
Risk beyond the confusing version: the enrollment then runs connect/restart through a different binary/version than the service manager launches.
Suggested fix
Prefer the binary that is actually serving: e.g. expose the executable path (or install kind) on loopback /healthz/runtime file and have the remote script use it, falling back to candidates.
Add npm global prefixes to the candidates ($(npm prefix -g)/bin, ~/.local/node/bin, ~/.npm-global/bin, nvm current), and on Windows %APPDATA%\npm\ocx.cmd.
If the chosen candidate's version differs from the serving runtime's version, warn in link probe output.
Acceptance
ocx link probe on each of the three layouts above reports the serving runtime's version without installing an extra copy.
#7832 - feat(link): Windows Remote Link Children and Child credential/connection attestation [merged]
📝 Issue Planner
Check the box below or use the @coderabbitai plan command to generate an implementation plan and prompts that you can use with your favorite coding assistant.
Create Plan
🧪 Issue enrichment is currently in open beta.
To disable automatic issue enrichment, add the following to your .coderabbit.yaml:
issue_enrichment:
auto_enrich:
enabled: false
💬 Have feedback or questions? Drop into our discord!
Triage notes from the issue sweep. I investigated a fix and an independent audit failed the plan, so this is the design, not a PR yet.
Why the obvious fix is wrong:service-state.json records how the service was installed, not what is serving.
launcherPath is written only for launchd and systemd. Windows never records it, so the Windows npm case (bunPath + cliPath) stays unsolved.
After a desktop takeover, recordServiceOwner keeps the old npm bunPath/cliPath, while the desktop sidecar serves. Preferring the recorded pair would select the stopped npm install.
cliPath may be absent (legacy record) rather than null. A shell-side JSON scrape cannot tell the two apart and would run plain bun as if it were ocx.
The authoritative copy is ~/.opencodex/service-state.json; the $OPENCODEX_HOME copy is a mirror.
Proposed direction:
Runtime evidence: the running proxy writes its own invocation (absolute executable plus entry args, version, pid) to a small runtime file under its home at startup and removes it on clean shutdown.
Preference:REMOTE_OCX_CANDIDATES and the Windows OCX_CANDIDATES prefer that invocation when the pid is alive and its --version matches. Otherwise they fall back to today's order.
Pinned sync:REMOTE_PINNED_SYNC_SCRIPT needs its own variant that keeps the version gate and sync --expect-link "$1" --json, because its $@ differs from the generic script's.
Windows: the npm layout needs a two-argument probe (OcxJob.Ok/V with an argument prefix). ocx.cmd shims cannot run under Process.Start with UseShellExecute=false or under CreateProcessW.
Search paths: add npm prefixes (~/.npm-global/bin, ~/.local/node/bin, $(npm prefix -g)/bin) ahead of /usr/local/bin as a secondary improvement.
Docs:structure/remote-link.md and docs-site/.../guides/remote-link.md document the candidate order and need updating.
This overlaps the files #8276 is changing (src/link/ssh-argv.ts, src/link/remote-windows.ts), so it should land after #8276 or inside the Remote Link lane.
Status: the POSIX half is on dev via #8424 (f0f34d09). On macOS and Linux Children, discovery, ocx link probe inspection and pinned sync now first run the install that last started serving the Child. That install is read from the first record of serving-runtimes.json, which every ocx start that binds writes about itself. Desktop and PATH copies are the fallback. This covers the two macOS layouts in the report: a stale /Applications app, and an npm install under ~/.local/node. #8431 cleans up the reader's error handling.
The Windows layout (npm global, [bun.exe, index.ts]) is still open. Probing that pair needs an argument-taking OcxJob.Ok/V overload in the C# helper compiled on the Child. PR CI never compiles it, and a mistake there would make every Windows Remote Link command exit 126, so it needs a change verified on a Windows host (the opt-in OCX_WINDOWS_OPENSSH_FIXTURE gate or the Windows batch lane). Keeping this issue open for that.
Partly fixed by #8769 (merged as 915a5c8): Windows discovery and ocx link probe now try the served install first. Still open: Windows windowsGatedOcxArgv / windowsOverwriteSyncArgv (src/link/remote-windows.ts) keep the fixed Desktop/PATH order, so ocx link sync and update planning can still pick an older bun-global ocx (step 3 of the plan above). This issue stays open for that part.
Activity
coderabbitai commentedon Nov 8, 2026
🔗 Related PRs
#7832 - feat(link): Windows Remote Link Children and Child credential/connection attestation [merged]
📝 Issue Planner
Check the box below or use the
@coderabbitai plancommand to generate an implementation plan and prompts that you can use with your favorite coding assistant.🧪 Issue enrichment is currently in open beta.
To disable automatic issue enrichment, add the following to your
.coderabbit.yaml:💬 Have feedback or questions? Drop into our discord!
lidge-jun commentedon Nov 8, 2026
Triage notes from the issue sweep. I investigated a fix and an independent audit failed the plan, so this is the design, not a PR yet.
Why the obvious fix is wrong:
service-state.jsonrecords how the service was installed, not what is serving.launcherPathis written only for launchd and systemd. Windows never records it, so the Windows npm case (bunPath+cliPath) stays unsolved.recordServiceOwnerkeeps the old npmbunPath/cliPath, while the desktop sidecar serves. Preferring the recorded pair would select the stopped npm install.cliPathmay be absent (legacy record) rather thannull. A shell-side JSON scrape cannot tell the two apart and would run plainbunas if it wereocx.~/.opencodex/service-state.json; the$OPENCODEX_HOMEcopy is a mirror.Proposed direction:
REMOTE_OCX_CANDIDATESand the WindowsOCX_CANDIDATESprefer that invocation when the pid is alive and its--versionmatches. Otherwise they fall back to today's order.REMOTE_PINNED_SYNC_SCRIPTneeds its own variant that keeps the version gate andsync --expect-link "$1" --json, because its$@differs from the generic script's.OcxJob.Ok/Vwith an argument prefix).ocx.cmdshims cannot run underProcess.StartwithUseShellExecute=falseor underCreateProcessW.~/.npm-global/bin,~/.local/node/bin,$(npm prefix -g)/bin) ahead of/usr/local/binas a secondary improvement.structure/remote-link.mdanddocs-site/.../guides/remote-link.mddocument the candidate order and need updating.This overlaps the files #8276 is changing (
src/link/ssh-argv.ts,src/link/remote-windows.ts), so it should land after #8276 or inside the Remote Link lane.fix(link): run the install serving the Child before Desktop or PATH c…
lidge-jun commentedon Nov 9, 2026
Status: the POSIX half is on
devvia #8424 (f0f34d09). On macOS and Linux Children, discovery,ocx link probeinspection and pinned sync now first run the install that last started serving the Child. That install is read from the first record ofserving-runtimes.json, which everyocx startthat binds writes about itself. Desktop and PATH copies are the fallback. This covers the two macOS layouts in the report: a stale/Applicationsapp, and an npm install under~/.local/node. #8431 cleans up the reader's error handling.The Windows layout (npm global,
[bun.exe, index.ts]) is still open. Probing that pair needs an argument-takingOcxJob.Ok/Voverload in the C# helper compiled on the Child. PR CI never compiles it, and a mistake there would make every Windows Remote Link command exit 126, so it needs a change verified on a Windows host (the opt-inOCX_WINDOWS_OPENSSH_FIXTUREgate or the Windows batch lane). Keeping this issue open for that.fix(link): keep the census reader quiet and bound to the first record (…
fix(link): rename the helper probe prefix so OcxJob compiles (#8359)
docs(es): mirror the resolve bind proof and Windows served-runtime no…
fix(link): read the Windows census where its writer puts it (#8359 re…
fix(link): keep ocx-child first when the Child state sits in the cens…
fix: issue sweep 261115 (Qoder lazy MCP, ended OAuth paste, resolve o…
lidge-jun commentedon Nov 16, 2026
Partly fixed by #8769 (merged as 915a5c8): Windows discovery and
ocx link probenow try the served install first. Still open: WindowswindowsGatedOcxArgv/windowsOverwriteSyncArgv(src/link/remote-windows.ts) keep the fixed Desktop/PATH order, soocx link syncand update planning can still pick an older bun-globalocx(step 3 of the plan above). This issue stays open for that part.fix(link): keep the served entry out of the gate loop variables (#8359)
test(link): inject the Windows overflow in the child-observe mapping …
fix(link): run the served install for Windows link sync and update pl…