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
Commit b057f64
Browse filesBrowse the repository at this point in the historyBrowse files
fix(broker): bound broker handshake so a wedged broker can't hang the client (closes#29) (#30)
* fix(broker): bound broker handshake so a wedged broker can't hang the client (closes#29)
When the shared broker is wedged (connect accepted but initialize never
answered), BrokerCodexAppServerClient had no deadline on net.createConnection
or request("initialize"), so a second /codex:* command hung forever — the
broker-busy hang seen in upstream openai#509.
- Bound connect (2s default) and initialize (5s default) with a new
BROKER_HANDSHAKE_TIMEOUT_CODE ("EBROKERTIMEOUT"); both overridable via
brokerConnectTimeoutMs / brokerInitializeTimeoutMs options. Timers are
unref'd so they don't pin the event loop.
- withAppServer now falls back to a direct app-server on EBROKERTIMEOUT in
addition to BROKER_BUSY_RPC_CODE / ENOENT / ECONNREFUSED.
- RED-first: spawnWedgedServer helper + broker-client-initialize-timeout test
reproduces the hang (connect ok, no initialize answer → EBROKERTIMEOUT).
Follow-up (not in this PR): SpawnedCodexAppServerClient.initialize has the
same unbounded shape; a deeper fix would put requestTimeoutMs on
AppServerClientBase.request() and collapse the withAppServer OR-chain.
Co-Authored-By: Claude <[email protected]>
* fix(broker): make the EBROKERTIMEOUT direct-fallback reachable (cycle-review critical)
Codex adversarial review caught that the handshake timeout rejects inside
CodexAppServerClient.connect() — before `client` is assigned in withAppServer —
so the `client?.transport === "broker"` guard was always false for EBROKERTIMEOUT.
The fallback clause was dead code: a wedged broker made every withAppServer-backed
command throw after 5s instead of retrying directly.
Tag initialization errors with the chosen transport in connect(), and let the
fallback match on error.transport when client is still null. Adds an end-to-end
test (wedged broker → withAppServer → direct fallback via fake-codex).
Co-Authored-By: Claude <[email protected]>
---------
Co-authored-by: axisrow <[email protected]>
Co-authored-by: Claude <[email protected]>
0 commit comments