Repository navigation
Closed
Copy link
Labels
bugSomething isn't workingconnectBuilt-in plugin: connectpartial-reproBug partially reproduced; some claims unverified; see linked reportremoteMulti-device, LAN/tailnet access, notifications
Description
Summary
A bb thread whose context has grown large (about 841k of 1M tokens) fails every turn with:
API Error: 504 bb connect: timed out waiting for the tunnel client.
Model calls from the host go through the Account Pool proxy on the bb server, and they reach it through the bb Connect relay. The relay gives up when response headers haven't arrived 30 seconds after it opens the stream. A large model request can't return headers in that time, so the thread can never complete another turn. Small requests on the same path work.
Evidence
- Request path. The Claude Code session environment sets
ANTHROPIC_BASE_URL=http://127.0.0.1:<port>/api/v1/plugins/account-pool/http, so every model call goes to the Account Pool plugin on the bb server. In the affected setup the server runs remotely, so that call crosses the Connect relay. - The timeout.
proxyHttparms aRESP_HEAD_TIMEOUT_MS = 30_000timer when it opens the stream. That is beforepumpRequestBodyuploads the body, so the upload time counts against the 30 seconds. - Work before headers. After the body arrives, the Account Pool parses the whole request and may wait up to
MAX_INLINE_HOLD_MS = 20_000for quota. Only then does it call Anthropic and wait for upstream headers. - Observed. On one thread at about 841k estimated context tokens, 4 consecutive turns each ran 6–9 minutes and ended with the 504 above, which fits Claude Code retrying the 504 several times. A fresh thread on the same project, host and pool works normally.
Not yet measured: the actual time to response headers for a request this size. The causal link to context size is strongly supported but not proven.
Impact
- Once a thread is this large, it can't run any more turns. "Continue" and retry fail the same way.
- Compaction doesn't help: it sends the same large context through the same path and hits the same timeout. The only workaround is to abandon the thread and start a new one.
- The error text calls it a temporary server-side issue and points to status.claude.com, so users keep retrying something that will never succeed.
Suggested fix
- In Connect, start the response-header timer only after the request body has finished uploading, so upload time doesn't count against it.
- Give long-running model-API traffic (the Account Pool HTTP route) a much longer header timeout than 30 seconds, or none, since a model API can legitimately take longer than that to start responding.
- Open question: should the host's model traffic go through the remote relay at all? Talking to the pool or to the provider more directly would remove this failure mode. This is an architecture decision, separate from the two changes above.
Related
- Add Connect response-timeout diagnostics to investigate intermittent mobile 504s #3998 adds diagnostics for intermittent mobile 504s on the same timeout path, and explicitly keeps the 30-second timeout unchanged. This issue is a reproducible case where the timeout itself is the cause.
BB-Thread-ID: thr_d58s3peww2
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingconnectBuilt-in plugin: connectpartial-reproBug partially reproduced; some claims unverified; see linked reportremoteMulti-device, LAN/tailnet access, notifications
Activity
bb-slop-cop commentedon Oct 4, 2026
🚨 SLOP COP 🚨 ·
new-issue-autopilotbug,remote, andconnect.partial-repro.Allow Codex voice requests to use the transcription budget (#5020)
sms-yui commentedon Oct 20, 2026
Another symptom with the same root cause: GPT Image 2 never works through the Account Pooler from a remote machine. Unlike the large-context case, it doesn't depend on request size; every image edit fails.
What happens
A Codex thread on a remote macOS host calls the built-in
image_gentool. Codex routes it through the Account Pooler (model_provider = "bb-account-pool", base URL…/api/v1/plugins/account-pool/http/v1), and that call crosses bb Connect to reach the bb server. Every call fails:image_gencalls failed after 139–154 s each. That fits Codex retrying several 30 s failures. No call produced an image.Why
POST /v1/images/generationsand/v1/images/edits(server.ts#L440-L452).RESP_HEAD_TIMEOUT_MS = 30_000. Voice transcription is the only exception (90 s, Allow Codex voice requests to use the transcription budget #5020)./v1/responsesstreams, so it returns headers quickly and normal turns work. That's why most pooled traffic doesn't hit this.headersTimeoutof 300 s (upstream-transport.ts#L4). I found no other timeout under 300 s on this path (host-daemon proxy, tunnel client, server).Options for the timeout-budget decision
I prototyped two fixes on a fork. Neither has run against a deployed gateway, but they may help scope the decision:
sms-yui:scott/connect-image-head-timeout): 360 s forPOSTto the two pooled image routes. It's small, but it hardcodes a plugin route into Connect. Hub failover across accounts can still exceed it, and the relay socket sits silent for minutes.sms-yui:scott/connect-head-pending):head-pendingframe every 10 s while it waits for the origin's response head.streamToolCallResponsedoes for plugin tools (Keep interactive plugin tools past the Connect timeout #1084, tool-calls.ts#L25). It needs no Connect change, but an upstream error that arrives after the early headers can no longer return its real status code.Workaround:
bb pool bypass <thread>on the image thread routes it with the host's own provider login and avoids Connect.Environment
bb thread log. I didn't reproduce this onmain, but the code paths cited are unchanged at0eac33e06.BB-Thread-ID: thr_5dph4qkdqg
Keep bb connect up under large uploads and wait for slow responses on…