[Bug][Windows] Remote Link relay verification times out and leaves a stale Child connection after Home rollback

オープン
#8,947 コメント 3 件 リアクション 1 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
42/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
node.js, typescript
領域
backend, devtools

調査の方向性

Start with src/link/remote-probe.ts and src/server/management/link-enrollment.ts to trace the shared relay-verification deadline and the two Windows probes; then read src/server/management/link-route-state.ts for failure compensation. Reproduce the reported timeout and check how enrollment recovery preserves the attempt ID and phase. Done means Windows verification has a bounded budget for both probes and failed enrollment leaves a safe, actionable recovery state on both machines; the empty desktop-remote directory may warrant separate handling.

索引モデルが issue の本文から書いたものです。

説明

bug platform
Client or integration

OpenCodex dashboard

Also reproduced through the ocx link add CLI.

Area

Platform (Windows / macOS / Linux)

Windows Remote Link enrollment, relay verification, and failure recovery.

Summary

Adding a Windows Child from a Home can establish the SSH tunnel, persist the Child connection, and synchronize its catalog, but then fail during relay verification because two Windows SSH/PowerShell probes share a 15-second deadline.

The failed enrollment leaves inconsistent state:

  • The Home stops the tunnel and removes its link record, so the device disappears from its dashboard.
  • The Child retains runtimeRole: client and the saved Home/link identity. Its dashboard still says it is managed by that Home.
  • The Child's live connection check reports linkTunnel.state: down with reason: home_unreachable.
  • Retrying Add Child fails because the Child is already configured as a client.

The retry error therefore obscures the initial verification timeout. Expected: sufficient bounded verification time on Windows, and consistent recovery or an explicit recoverable partial-enrollment state on both machines.

Reproduction

Environment: two Windows x64 computers, OpenCodex installed globally through npm, Windows Task Scheduler background services, connected through Tailscale and Windows OpenSSH with existing key-based authentication.

  1. Start with the Child in standalone mode. If reproducing after a failed attempt, first disconnect the specific stale link and verify that the Child has returned to standalone.
  2. From the Home, run:
    ocx link add <child-alias> --expect-fingerprint <verified-fingerprint> --json
    
  3. Observe the tunnel establish and the Child save its connection/catalog.
  4. On the affected setup, enrollment then fails with child_relay_timeout.
  5. Compare:
    # Home
    ocx link status --json
    
    # Child
    ocx connect status --json
    
  6. Retry adding the same Child from the Home.

Before the controlled CLI reproduction, the Home diagnostics also contained three attempts that reached tunnel state connected and then stopped approximately 53–60 seconds later. Those events alone do not identify each attempt's original failure. The controlled reproduction captured the precise timeout below.

This is timing-dependent; it is not claimed to reproduce on every Windows installation.

Version

@bitkyc08/opencodex 2.100.5 on both Home and Child.

The original failure was reproduced before applying the local patch described below.

Operating system
  • Home: Microsoft Windows 11 Pro, version 26H2, OS build 26300.9711, x64.
  • Child: Microsoft Windows 11 Pro, version 26H2, OS build 26300.9974, x64.

Both OS editions, display versions, and full build numbers were queried directly on the respective machines. Both OCX services use Windows Task Scheduler.

Provider and model

Not provider-specific: the failure occurs during Remote Link enrollment and catalog relay verification.

Post-fix inference validation used the existing deepseek/deepseek-flash route with a synthetic “Reply with exactly OK.” prompt.

Logs or error output

First captured failure, with the recovery guidance shortened and the link identity redacted:

Error: Remote Link failed during Child relay verification:
ssh command exceeded 4180ms.
The Child may still be connected.
Run ocx disconnect --expect-link <attempt-link-id> on the Child ...
(code child_relay_timeout)
Exit code: 1

Subsequent attempt:

The Child is still linked to a Home (config runtimeRole client).
To end that link and move it here, on the Child run:
ocx disconnect, then ocx restart.

The inconsistent state, reduced to non-sensitive fields:

{
  "home": {
    "role": "standalone",
    "links": []
  },
  "child": {
    "state": "connected",
    "transport": "link",
    "catalog": "present",
    "rotation": "clean",
    "readiness": "ready",
    "linkTunnel": {
      "state": "down",
      "reason": "home_unreachable"
    }
  }
}

The saved state: connected / readiness: ready values did not imply that the live tunnel was up.

Screenshots and supporting files
Source-level findings in the installed 2.100.5 package
  • src/link/remote-probe.ts defines LINK_RELAY_VERIFY_MS = 15_000.
  • In src/server/management/link-enrollment.ts, the post-restart health check and catalog relay verification share one deadline:
    const deadline = now() + LINK_RELAY_VERIFY_MS;
    
    The remaining time is passed to each successive remote command.
  • Each Windows probe starts a separate SSH/PowerShell command.
  • In the captured failure, only 4180ms remained for the second command. Approximately 10.8 seconds of the shared budget had already been consumed by the preceding check and intervening work.
  • A separate no-business-operation SSH + PowerShell invocation took approximately 3.6 seconds on this setup. This is a local measurement, not a universal Windows baseline.
  • compensateNewLink() in src/server/management/link-route-state.ts revokes the issued key, stops the tunnel, and removes the Home record. After the observed failure, the full OCX Child installation still retained its client configuration.
Additional recovery obstacle: empty desktop-remote directory

Cleaning up the controlled failed enrollment with ocx disconnect --expect-link <attempt-link-id> was refused with desktop_lifecycle_unsafe because %USERPROFILE%\.opencodex\desktop-remote existed but contained neither Claude Desktop remote state nor a disconnect receipt.

Inspection confirmed that this directory was empty and was not a reparse point. Renaming it to a backup location, without deleting it or modifying client configuration, allowed disconnect to complete.

This is an additional recovery obstacle, not asserted to be the cause of the original timeout. It can be split into a separate issue if preferred.

Local workaround and validation

A minimal local patch on the Home changed only the overall Windows relay-verification deadline:

- const deadline = now() + LINK_RELAY_VERIFY_MS, remaining = () => Math.max(1, deadline - now());
+ const deadline = now() + (remotePlatform === "windows" ? 60_000 : LINK_RELAY_VERIFY_MS), remaining = () => Math.max(1, deadline - now());

Each individual HTTP probe remains capped at 15 seconds. Authentication, runtime-role checks, and the complete authenticated catalog-relay verification were preserved.

Observed after the patch and Home service restart:

  • Bun build check of the changed module passed.
  • A fresh Home-initiated enrollment exited 0 and retained the Child in the Home's link list.
  • The Child reported readiness: ready, rotation: clean, and linkTunnel.state: up.
  • The Child's local models endpoint returned HTTP 200 and 23 models.
  • An actual Child → Home → provider request returned HTTP 200, content OK, and finish reason stop.

This supports insufficient shared verification time as the cause of the captured failure. 60 seconds is a locally successful workaround, not a claim that this fixed value is the best upstream design. No full upstream test suite or broader Windows matrix was run.

Requested behavior
  1. Account for Windows SSH/PowerShell startup overhead in the bounded relay-verification budget, so the first probe does not starve the second.
  2. Restore consistent state after failed enrollment where safe. If the Child cannot safely be restored, retain an explicit recoverable record on the Home and provide recovery scoped to the exact attempt/link ID.
  3. Preserve the original failed phase and reason in the dashboard; distinguish saved Home ownership from live connection health.
  4. Provide a safe, actionable recovery path for an empty desktop-remote directory.
Redacted configuration

Relevant state only; this is not a full configuration export:

{
  "beforeEnrollment": {
    "childRuntimeRole": "standalone",
    "childPort": 10100
  },
  "afterFailedEnrollment": {
    "homeLinks": [],
    "childRuntimeRole": "client",
    "transport": "link",
    "linkId": "<attempt-link-id>"
  }
}

Actual hostnames, SSH aliases, addresses, fingerprints, link/key identifiers, account details, and credentials have been omitted or replaced with placeholders.

Checks
  • I searched existing issues and documentation.
  • I removed secrets, tokens, account details, request credentials, and personal data.
主要言語
TypeScript
スター
16.9k
フォーク
1.3k
平均マージ
1日 4時間
マージ済み PR(30日)
814

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

lidge-jun/opencodex のほかの issue

lidge-jun/opencodex の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。