Skip to content

codex app-server 0.159.2: turn fails with "workspace routing discovery failed" while codex exec succeeds #49827

Open

Description

@sheson1105

codex app-server 0.159.2: turn fails with "workspace routing discovery failed" while native codex exec succeeds

Environment

  • OS: Windows 10.0.26200 x86_64
  • CLI: codex-cli 0.159.2, binary SHA-256 cbafb6422bca005b94c12d105b1a16a0474219e24ea4893f85846409c464f5a1 (pinned; schema dump locked to the same binary)
  • Entry: stdio app-server (codex app-server, NDJSON over stdin/stdout)
  • Auth: the CLI's own ChatGPT login state; default provider (no token injection, no -c overrides, no provider switch)
  • Workspace: synthetic, empty (README + two tiny text files), existing absolute path, pure ASCII, short/shallow — and separately a deep pytest-shaped path (see controls)
  • Model / approval policy / sandbox policy: not specified (server defaults)
  • No tool calls anywhere in any transcript

Minimal protocol sequence

  1. spawn codex app-server
  2. → initialize {clientInfo:{name,version}}; ← success response
  3. → initialized notification
  4. → thread/start {cwd: <existing absolute dir>}; ← result.thread.id
  5. → turn/start {threadId, input:[{type:"text", text:"Reply exactly <TOKEN>. Do not use tools or modify files."}]}
  6. observe notifications until terminal state

Expected

  • agent message deltas and final text
  • turn/completed with turn.status = "completed"

Actual (4/4 product-path attempts on 2026-10-01)

  • thread/start and turn/start are accepted (valid ids returned)
  • mid-turn error notifications:
    • message: "workspace routing discovery failed"
    • codexErrorInfo: "other", additionalDetails: null, misalignment: null
    • terminal willRetry: false
    • in one run the server first emitted 9 × willRetry: true notifications, then the same terminal error
  • no agent message, no file or tool side effects; the app-server exits cleanly on stdin EOF (exit code 0)
  • failure time: ~13-15s after turn/start, regardless of workspace path shape

Controls

  1. Same binary, same contract, earlier date (2026-09-30): an app-server turn over the identical protocol sequence (including initialized) completed successfully in ~6.6s with status=completed. The client contract therefore has a success precedent on 0.159.2.
  2. Different entry, same day as failures: native codex exec with the same prompt and login succeeded (PROBE_OK). This only proves the exec entry works — it does not prove app-server routing health.
  3. Path shape ruled out: a shallow stable path and a deep pytest-shaped path fail with the byte-identical error; the failing client's outbound thread/start.cwd was verified character-exact against the existing directory.
  4. initialized ruled out as sufficient cause: after the client fixed its handshake to send initialized (per official docs), the turn still failed with the identical routing error (after 9 retries).
  5. Clean lifecycle: every failing app-server instance exits with code 0 on stdin EOF; no orphan processes.

Requests to upstream

  1. What preconditions does "workspace routing discovery failed" (codexErrorInfo=other) indicate, and which side is expected to satisfy them?
  2. Is default provider + Codex CLI login state a supported combination for app-server turn/start?
  3. Are there undocumented workspace registration / routing / trust requirements for app-server turns (beyond thread/start.cwd pointing at an existing directory)?
  4. Is there a structured error code or diagnostic field beyond codexErrorInfo=other that clients can read to disambiguate this failure?
  5. Is this a service-side state issue, an account-routing issue, or a known 0.159.2 CLI regression?
  6. What client-side recovery/retry policy do you recommend for this error?

Reproduction data

  • minimal-transcript.jsonl — minimal protocol with placeholders (no tokens, no real paths, no usernames)
  • evidence-ledger.json — per-attempt ledger computed from committed evidence (totals: 11 product turn/start sent, 1 completed, 1 auxiliary native invocation)
  • evidence-matrix.md — per-evidence completeness (CAPTURED / DERIVED_FROM_CODE / MISSING / NOT_APPLICABLE)
  • normalized-diff.json — semantic diff between the successful and failing request sets (client-side differences declared)
  • redaction-report.txt — redaction method and checks

Attachments

file sha256
minimal-transcript.jsonl 9dccf617c65c8834655a72a24d0e7f74403f63b282fa00aa2f6ec1f6e3b85953
evidence-ledger.json a413565e0d74c8f45379ec200869708b002f85ba4da61f56a3c40eaa99426f44
normalized-diff.json add4808498b25f1fa746771df1f74820e0cd99ac525b7820a36ebe4ffd44bf55
evidence-ledger.json 5d70420ff93ff99b168bd76b99b8aada45dda9d30d1d8d88ceedbbf8072f4fc9
normalized-diff.json ba5388ff3492cfb0b20b66eaa534a3e3c5436ba45a63f52989b4b54df47c732d

Attached evidence

Raw-file uploads are not available through the API surface used to create this issue; the three evidence files are embedded below in full, with SHA-256 digests so they can be re-materialized verbatim.

file sha256
minimal-transcript.jsonl 9dccf617c65c8834655a72a24d0e7f74403f63b282fa00aa2f6ec1f6e3b85953
evidence-ledger.json 5d70420ff93ff99b168bd76b99b8aada45dda9d30d1d8d88ceedbbf8072f4fc9
normalized-diff.json 8afc908b644f303c520d2d6d6cea1b82455566640d37c982d235b2e852c7bc0a
minimal-transcript.jsonl sha256 b14fb1634b01e843460ea68d555271f87c993df7f02c3c6e23895fda2d3206e9
{"direction":"out","frame":{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"clientInfo":{"name":"<CLIENT_NAME>","version":"0.1.0a1"}}}}
{"direction":"in","frame":{"jsonrpc":"2.0","id":1,"result":{"userAgent":"<UA>","codexHome":"<CODEX_HOME>","platformOs":"windows","version":"codex-cli 0.159.2"}}}
{"direction":"out","frame":{"jsonrpc":"2.0","method":"initialized"}}
{"direction":"out","frame":{"jsonrpc":"2.0","id":2,"method":"thread/start","params":{"cwd":"<CWD>"}}}
{"direction":"in","frame":{"jsonrpc":"2.0","id":2,"result":{"thread":{"id":"<THREAD_ID>","status":null}}}}
{"direction":"out","frame":{"jsonrpc":"2.0","id":3,"method":"turn/start","params":{"threadId":"<THREAD_ID>","input":[{"type":"text","text":"Reply exactly PING_OK. Do not use tools or modify files."}]}}}
{"direction":"in","frame":{"jsonrpc":"2.0","id":3,"result":{"turn":{"id":"<TURN_ID>","status":"inProgress"}}}}
{"direction":"in","frame":{"jsonrpc":"2.0","method":"thread/started","params":{"thread":{"id":"<THREAD_ID>"}}}}
{"direction":"in","frame":{"jsonrpc":"2.0","method":"turn/started","params":{"threadId":"<THREAD_ID>","turn":{"id":"<TURN_ID>"}}}}
{"direction":"in","frame":{"jsonrpc":"2.0","method":"error","params":{"error":{"message":"workspace routing discovery failed","codexErrorInfo":"other","additionalDetails":null,"misalignment":null},"willRetry":false,"threadId":"<THREAD_ID>","turnId":"<TURN_ID>"}}}
evidence-ledger.json sha256 d3f9d179c41d9dee4c85fb6f61072900e57e94cdd53d5cb555273b6763f6df44
{
  "built_from": "reporter's archived run records; per-entry excerpts in this ledger",
  "entries": [
    {
      "date": "2026-09-30",
      "task": "successful_control",
      "entry": "app-server (stdio)",
      "codex_version": "codex-cli 0.159.2",
      "binary_sha256_short": "cbafb6422bca",
      "product_turn_start_sent": 1,
      "product_turn_completed_success": 1,
      "auxiliary_model_invocations": 0,
      "terminal": "turn/completed status=completed",
      "error": null,
      "willRetry_count": 0,
      "tools_approvals_side_effects": 0,
      "process_recycle": "clean (exit 0; report.md)",
      "elapsed_s": 6.61,
      "evidence": "archived by reporter"
    },
    {
      "date": "2026-10-01",
      "task": "dispatch_batch_1 (4 dispatches, no per-round capture)",
      "entry": "app-server (stdio)",
      "codex_version": "codex-cli 0.159.2",
      "binary_sha256_short": "cbafb6422bca",
      "product_turn_start_sent": 4,
      "product_turn_completed_success": 0,
      "auxiliary_model_invocations": 0,
      "terminal": "UNKNOWN (per-round detail not captured; documented execution deviation)",
      "error": "UNKNOWN",
      "willRetry_count": "UNKNOWN",
      "tools_approvals_side_effects": 0,
      "process_recycle": "clean (lifecycle rounds PASS; R8/R10)",
      "elapsed_s": "UNKNOWN",
      "evidence": "archived by reporter"
    },
    {
      "date": "2026-10-01",
      "task": "failed_batch_2 (3 dispatches)",
      "entry": "app-server (stdio)",
      "codex_version": "codex-cli 0.159.2",
      "binary_sha256_short": "cbafb6422bca",
      "product_turn_start_sent": 3,
      "product_turn_completed_success": 0,
      "auxiliary_model_invocations": 1,
      "terminal": "UNKNOWN (per-round detail lost; evidence-persistence defect documented)",
      "error": "UNKNOWN (all three failed ~15s; root cause later identified via )",
      "willRetry_count": "UNKNOWN",
      "tools_approvals_side_effects": 0,
      "process_recycle": "clean (F1 state machine; baseline intact)",
      "elapsed_s": "UNKNOWN (~15s per round recorded)",
      "evidence": "archived by reporter"
    },
    {
      "date": "2026-10-01",
      "task": "failed_run_1 (single diagnostic)",
      "entry": "app-server (stdio)",
      "codex_version": "codex-cli 0.159.2",
      "binary_sha256_short": "cbafb6422bca",
      "product_turn_start_sent": 1,
      "product_turn_completed_success": 0,
      "auxiliary_model_invocations": 0,
      "terminal": "error notification willRetry=False",
      "error": "workspace routing discovery failed",
      "codexErrorInfo": "other",
      "willRetry_count": 0,
      "tools_approvals_side_effects": 0,
      "process_recycle": "clean (graceful-exit rc=0; zero descendants; ws unchanged)",
      "elapsed_s": 13.43,
      "evidence": "archived by reporter"
    },
    {
      "date": "2026-10-01",
      "task": "failed_run_2 (shallow path; deep withheld by design)",
      "entry": "app-server (stdio)",
      "codex_version": "codex-cli 0.159.2",
      "binary_sha256_short": "cbafb6422bca",
      "product_turn_start_sent": 1,
      "product_turn_completed_success": 0,
      "auxiliary_model_invocations": 0,
      "terminal": "error notification willRetry=false",
      "error": "workspace routing discovery failed",
      "codexErrorInfo": "other",
      "willRetry_count": "UNKNOWN (per-entry detail not in exception-path evidence)",
      "tools_approvals_side_effects": 0,
      "process_recycle": "clean (graceful close; zero descendants; ws unchanged)",
      "elapsed_s": 12.83,
      "evidence": "archived by reporter"
    },
    {
      "date": "2026-10-01",
      "task": "failed_run_3 (post-handshake-fix validation)",
      "entry": "app-server (stdio)",
      "codex_version": "codex-cli 0.159.2",
      "binary_sha256_short": "cbafb6422bca",
      "product_turn_start_sent": 1,
      "product_turn_completed_success": 0,
      "auxiliary_model_invocations": 0,
      "terminal": "error notification willRetry=False",
      "error": "workspace routing discovery failed",
      "codexErrorInfo": "other",
      "willRetry_count": 9,
      "tools_approvals_side_effects": 0,
      "process_recycle": "clean (graceful-exit rc=0; zero descendants; ws unchanged)",
      "elapsed_s": 14.58,
      "note": "initialized notification verifiably sent exactly once on the wire",
      "evidence": "archived by reporter"
    }
  ],
  "totals": {
    "product_turn_start_sent": 11,
    "product_turn_completed_success": 1,
    "auxiliary_model_invocations": 1
  }
}```

</details>


<details>
<summary><code>normalized-diff.json</code>
sha256 <code>c4a78f1656f94a183b97ea898375b2df60ce26d22116ab1b3d2f7e0d47617ab0</code></summary>

```json
{
  "comparison": "successful control (earlier date, captured timeline) vs failed runs (2026-10-01; request params derived from code, verified character-exact for cwd in the path-shape comparison)",
  "normalization": "dynamic only: req id/thread/turn/item ids/pid/timestamps/reply tokens; paths kept as shape class; null-vs-absent, model, provider, approval, sandbox, capabilities, clientInfo, config, auth, proxy presence, argv, method order, array order NOT normalized",
  "differences": [
    {
      "field": "argv",
      "detail": [
        "$.argv: list length 4 vs 2 (order preserved)"
      ]
    },
    {
      "field": "initialize",
      "detail": [
        "$.initialize.clientInfo.name: \"<CLIENT_NAME_VARIANT_A>\" vs \"<CLIENT_NAME_VARIANT_B>\""
      ]
    },
    {
      "field": "initialized_notification",
      "detail": [
        "$.initialized_notification: true vs false"
      ]
    },
    {
      "field": "turn_start",
      "detail": [
        "$.turn_start.input[0].text: \"Reply exactly <REPLY_TOKEN>. Do not use tools, execute commands, or modify file vs \"Reply exactly <REPLY_TOKEN>. Do not use tools or modify files.\""
      ]
    }
  ],
  "equivalences": [
    {
      "field": "thread_start",
      "detail": []
    },
    {
      "field": "model",
      "detail": []
    },
    {
      "field": "approval_policy",
      "detail": []
    },
    {
      "field": "sandbox_policy",
      "detail": []
    }
  ],
  "schema_validation": {
    "successful_control": {
      "initialize": [],
      "thread/start": [],
      "turn/start": []
    },
    "product": {
      "initialize": [],
      "thread/start": [],
      "turn/start": []
    }
  },
  "schema_note": "线格式全部合法(含 product 的 initialized 缺失——Schema 未强制、官方顺序要求)。Schema 通过≠服务端业务路由接受。",
  "classification": "LOCAL_PROTOCOL_DEFECT_FOUND",
  "primary_candidate": "product omitted the officially-required 'initialized' notification (fixed offline in offline analysis; unverified against live server this batch)",
  "secondary_candidates": [
    "clientInfo.name: '<CLIENT_NAME_VARIANT_B>' vs '<CLIENT_NAME_VARIANT_A>' (client identity may participate in routing)",
    "argv: missing '--listen stdio://' (documented equivalent; untested on server)"
  ]
}```

</details>

Activity

  1. added
    bug
    CLI
    windows-os
    app-server
    on Oct 1, 2026
  2. github-actions commented on Oct 1, 2026

    @github-actions
    Contributor
  3. sheson1105 commented on Oct 1, 2026

    @sheson1105
    Author

    Update: this failure appears intermittent on a timescale of hours with the same Codex CLI binary, client configuration, and workspace shape.

    Observed sequence:

    • Sep 30: 1 successful app-server turn, completed in about 6.6 seconds.
    • Oct 1 morning: 4 failures, each reaching the terminal workspace routing discovery failed error after about 13–15 seconds.
    • Oct 1 afternoon: 2 successful turns, each completing after about 117 seconds and four responseStreamDisconnected reconnect attempts.
    • Oct 1 evening: the same terminal routing error returned after about 12.4 seconds.

    During a successful window, A/B checks of clientInfo.name and explicit --listen stdio:// produced successful turns in both variants. Shallow and deeper workspace paths have also produced the same failure. These tested client-side variables therefore have not explained the success/failure difference.

    This evidence is consistent with an intermittent failure at the app-server/backend routing boundary, but it does not establish the upstream internal cause. Please let us know which sanitized request, thread, turn, timestamp, account-region, or other correlation identifiers would be most useful for investigation. We can run a small, explicitly bounded probe during a requested diagnostic window if needed.

  4. 4Liberty commented on Oct 1, 2026

    @4Liberty

    Additional measured context for this failure class, from a desktop-heavy Windows workload with many concurrent threads. Same symptom family you and the related reports describe, plus a negative control that narrows where the time goes.

    Mechanism (from current source)

    codex-rs/app-server/src/request_processors/account_processor/workspace_routing.rs wraps the whole read_account routing read in a hard tokio::time::timeout(Duration::from_secs(15), read); expiry maps to the DiscoveryTimeout variant, i.e. the "workspace routing discovery timed out" text. Inside that one 15 s budget sit:

    • one or two full config loads (ConfigManager::load_latest_config), which serialize process-wide behind the single-permit network_policy_reload semaphore and can include a cloud-config-bundle snapshot stage with its own 20 s fetch timeout,
    • the authenticated GET {chatgpt_base_url}/wham/accounts/check call,
    • a 401-triggered token-refresh retry loop.

    So a 15 s failure is not necessarily a network failure: any slow stage (config path, lock wait, refresh) consumes the same budget, and all waiters that started within the window fail together.

    Symptom shape observed

    • Turns fail with the timed-out variant; the sampling request is then retried 5x as stream disconnected - retrying sampling request with sampling_error=workspace routing discovery timed out, burning ~90 s per turn before the turn is failed for good.
    • Failures come in multi-minute host-wide windows (multiple per day over several days): every concurrent turn-start that lands inside a window fails discovery, then everything recovers at once. Desktop background tasks that call account/read fail the same way in the same windows.
    • A 15 s deadline is hit on each retry attempt, not an immediate error, which matches attempts waiting on a stalled stage rather than an instant rejection.

    Negative control

    Outside the windows, the exact call answers 200 OK in 0.3–0.5 s when probed directly with the same account and the same custom CA bundle the client uses, with no proxy configured. The credential state is also stable (no relogin around the failures). That rules out a permanently broken endpoint or credential for this workload, and points at something intermittent inside the 15 s read on the client side of the boundary.

    Correlated signal

    In the same windows, non-routing app-server requests that share the config/network-policy load path also stall: the desktop requested config/read / configRequirements/read and logged App server request expired while queued after 30 s. That is consistent with the stage eating the 15 s being on the config/policy-load path (or generic app-server contention under load), but current logs carry no phase timing for the routing read, so the exact stage cannot be identified from the outside.

    Suggested improvements

    1. Log per-phase timing for the routing read (config load, cloud-config snapshot, accounts call, refresh) so these reports can be classified.
    2. Serve last-known-good routing when a refresh exceeds the budget, instead of failing the turn; and cache per auth generation without making credential reloads invalidate a still-valid route.
    3. Do not classify DiscoveryTimeout as a retryable stream disconnect — 5 retries of a deterministic 15 s failure is ~90 s of dead time per turn.
    4. Consider making the bound adaptive (or moving the routing read off each attempt's critical path) when a turn is already admitted.

    Related open reports that look like the same class: #48894 (the timed-out variant in sign-in/extension paths), and the intermittent app-server windows already described here.

  5. VasiliyBorisenok commented on Oct 2, 2026

    @VasiliyBorisenok

    I am experiencing a reproducible workspace routing discovery failed issue with Codex CLI 0.159.3 on Arch Linux (running inside Distrobox).

    My network connection is routed through Psiphon Tunnel Core. Codex is configured to use the local Psiphon HTTP proxy at 127.0.0.1:8081.

    Environment:

    • Codex CLI: 0.159.3
    • Arch Linux / x86_64
    • Running inside Distrobox
    • Psiphon Tunnel Core
    • Local HTTP proxy: 127.0.0.1:8081
    • Logged in using ChatGPT
    • codex login status reports: Logged in using ChatGPT

    The problem is reproducible with the normal Codex startup:

    $ codex
    
    Error: account/read failed during TUI bootstrap: account/read failed: workspace routing discovery failed (code -32603)
    

    However, if I explicitly specify the log directory:

    $ mkdir -p ~/.codex/log
    $ codex -c log_dir="$HOME/.codex/log"
    

    Codex starts successfully.

    After exiting Codex, running plain codex again reproduces the same error.

    So the behavior is consistently:

    codex                                -> workspace routing discovery failed
    codex -c log_dir="$HOME/.codex/log" -> starts normally
    

    No other configuration is changed between these two tests.

    I initially suspected the proxy/network connection, but changing the network route did not change the behavior. The explicit log_dir setting is the only difference that consistently makes Codex start successfully.

    This may indicate that the log directory configuration is somehow affecting the workspace-routing/bootstrap process.

  6. yshoegazer-cmd commented on Oct 9, 2026

    @yshoegazer-cmd

    I have a closely related Windows stdio app-server failure, with both account/read and a minimal inference turn affected. I submitted desktop feedback separately; feedback ID 01a08a12-eea2-7f32-b3ef-d9d4730594cb (not a support ticket number).

    Environment: Windows; officially signed codex-cli 0.158.0-alpha.2.1, binary SHA-256 8F0554EDE25BBC5450921897C468B2E84635AA513C5017457997AF0954581F49; stdio app-server; existing ChatGPT sign-in in an app-specific Codex state directory. No injected token, account switch, raw CAD, or business tools. initialize succeeded and the client sent initialized before other requests.

    On 2026-10-09 around 06:34 UTC, one account/read with refreshToken=false returned JSON-RPC error.code=-32603; its message exactly matched workspace routing discovery failed. This account response had no additionalDetails, HTTP status, or provider trace/request ID available to the client.

    In the same task-owned process, a single trivial text-only gpt-6-astra/medium turn was accepted by thread/start and turn/start but emitted nine error notifications with codexErrorInfo=responseStreamDisconnected, then a final other; turn/completed.status=failed, with no answer. To inspect details that an earlier audit had discarded, a second task-owned app-server was started around 06:37 UTC for one inference turn only (no repeated account/read). The nine disconnected notifications had additionalDetails exactly workspace routing discovery failed; the final other event had null details and the same message. No HTTP status, system errno, or provider correlation ID was provided. Both processes exited cleanly. The two paths share surface text, but I cannot establish that they share an underlying cause.

    The client-side audit now separates official fields from local interpretations. An earlier local label suggesting a credential-store failure was triggered only by the word keyring in stderr and has been withdrawn. Restoring a local loopback proxy listener and separately removing inherited proxy environment variables from this task process did not resolve the observed account failure; this does not rule out all network or proxy causes. model/list alone is not evidence that an inference turn works.

    Could maintainers clarify (1) the underlying HTTP/transport/parse category behind get_accounts_check() for the 06:34 UTC account failure, (2) whether the inference stream's identical detail is propagated from the same workspace-discovery operation or is independent, and (3) a supported, credential-preserving recovery path or a structured diagnostic field? I do not want to infer authentication, proxy, capacity, or service root cause from -32603 alone.

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

    CLIapp-serverbugwindows-os

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions