Skip to content

Remote Link: Home-initiated enrollment of a Windows Child always fails with opaque 502 — WINDOWS_OS_PROBE uses "cmd /c echo %OS%" and Windows sshd answers "Windows_NT\"" #8972

Closed

Description

@javiruu

Client or integration

Codex CLI

Area

Proxy and routing

Summary

From a Linux Home, ocx link probe returns HTTP 502 {"error":{"code":"probe_failed","message":"SSH host probing failed."}} with no hint, and the CLI only prints Link management request failed (502). Key-based SSH from the Home to the Windows Child works (plain ssh alias "echo ok" succeeds), ssh-keygen can read the host key, and the remote ocx --version works. The failure is 100 % reproducible and is caused by platform detection, not by SSH.

src/link/ssh-argv.ts sets WINDOWS_OS_PROBE = "cmd /c echo %OS%" and src/link/remote-platform.ts requires stdout to be exactly Windows_NT. With the Windows OpenSSH server, that exact command comes back as Windows_NT" (trailing double quote), so the check fails, requireRemotePlatform falls back to sh -c 'uname -s' (which on Windows prints a localized error), classifies the platform as unknown and throws Remote platform could not be determined. probe()'s catch-all (src/server/management/link-enrollment.ts:148) turns any exception into 502 probe_failed, and because the thrown value is a plain Error (not SshRunnerError), sshRunnerErrorHint() returns undefined and the real reason is silently dropped.

Expected: probing a Windows host over working key-based SSH returns fingerprint + version, and any failure at least carries its hint.

Reproduction

Home: Ubuntu 26.04, OpenSSH_10.2p1

~/.ssh/config: Host windows-child { HostName ; User ; IdentityFile ~/.ssh/id_ed25519; IdentitiesOnly yes }

ssh -o BatchMode=yes windows-child "echo ok" # ok (key auth works)
ssh -T -o BatchMode=yes -- windows-child "cmd /c echo %OS%" | od -c

0000000 W i n d o w s _ N T " \r \n <-- trailing quote breaks the check

ssh -T -o BatchMode=yes -- windows-child "cmd.exe /c echo %OS%" | od -c

0000000 W i n d o w s _ N T \r \n <-- works

ssh -T -o BatchMode=yes -- windows-child "cmd /c echo hello"

hello" <-- generic for the bare cmd form

ocx link probe windows-child --json

Error: Link management request failed (502) (no code, no hint)

The hint the CLI hides:

curl -sS -X POST http://127.0.0.1:10100/api/link/probe
-H "x-opencodex-api-key: $ADMIN_TOKEN" -H 'content-type: application/json'
-d '{"alias":"windows-child","includeVersion":true}'

502 {"error":{"code":"probe_failed","message":"SSH host probing failed."}}

Fix that made enrollment succeed (verified, one line, no other change):

diff
Copy

  • export const WINDOWS_OS_PROBE = "cmd /c echo %OS%";
  • export const WINDOWS_OS_PROBE = "cmd.exe /c echo %OS%";

After this, ocx link probe windows-child --json → {fingerprint, keyType, ocxVersion "2.100.6"} and ocx link add windows-child --expect-fingerprint … → {"linkId":"lnk_…","state":"connected","childRole":"client"}.

Two things worth fixing beyond the one-word change: (a) tolerate what cmd actually prints (or prefer cmd.exe), and (b) never swallow the reason — probe() should map a non-SshRunnerError to a hint too, otherwise every platform-detection failure looks like an SSH outage. Also the GUI hint "macOS or Linux on both computers" is outdated: 2.100.6 clearly ships Windows support (src/link/remote-windows.ts, buildWindowsProbeArgv, windowsOcxArgv, windowsChildHttpArgv).

Version

2.100.6 (npm @bitkyc08/opencodex), Home and Child.

Operating system

Ubuntu 26.04 LTS (kernel 7.0, OpenSSH_10.2p1). Child: Windows 11 build 26100, Microsoft OpenSSH Server, default shell cmd.exe (no DefaultShell override).

Provider and model

link management only, no provider involved.

Logs or error output

$ ocx link probe windows-child --json
Error: Link management request failed (502)

HTTP/1.1 502 Bad Gateway
{"error":{"code":"probe_failed","message":"SSH host probing failed."}}      # no "hint" field

# internal exception (before it was dropped): "Remote platform could not be determined"
# remote stderr for the uname fallback (localized, so WINDOWS_SHELL_REFUSAL does not match):
El sistema no puede encontrar la ruta especificada.

Screenshots and supporting files

No response

Redacted configuration

# Home ~/.ssh/config
Host windows-child
    HostName <tailscale-ip>
    User <user>
    Port 22
    IdentityFile ~/.ssh/id_ed25519
    IdentitiesOnly yes

# Child: ocx link status --json  (after the fix)
{"role":"child","links":[{"id":"lnk_…","direction":"hub-initiated","state":"idle"}],
 "local":{"version":"2.100.6","relayAuth":"2"}}

Checks

  • I searched existing issues and documentation.
  • I removed secrets, tokens, account details, request credentials, and personal data.

Activity

  1. added
    bug
    on Nov 19, 2026
  2. added
    platform
    proxy
    on Nov 19, 2026
  3. coderabbitai commented on Nov 19, 2026

    @coderabbitai
    Contributor
    🔗 Related PRs

    #7832 - feat(link): Windows Remote Link Children and Child credential/connection attestation [merged]
    #7496 - fix(link): refuse Windows Children with a Hub-mode pointer and explain existing ones [merged]
    #7530 - [WRONG BRANCH] release: promote dev 1025acd to main as 2.91.0 [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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugplatformproxy

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions