Repository navigation
Description
Summary
After updating bb-app 0.0.32 → 0.33.0 (headless Linux server install via npx bb-app@latest), every Claude Code turn fails with:
JSON-RPC request timed out: turn/start
The Claude Code CLI process spawns and initializes fine, then sits idle forever; the bridge never forwards the turn. Rolling back to 0.0.32 (same machine, same DB, same Claude Code version) fully resolves it.
While debugging I found that the bridge silently drops any request that fails schema validation, which converts whatever the underlying mismatch is into an undebuggable 30s timeout instead of a JSON-RPC error. Filing this both as the regression report and as a request to make that failure mode loud.
Environment
- bb-app: 0.33.0 (broken), 0.0.32 (works) — server install,
npx bb-app@<ver> --data-dir ... --server-port ...under a systemd user unit, accessed via browser over Tailscale - OS: Ubuntu 24.04, Node v24.16.0
- Claude Code CLI: 2.1.217 (
~/.local/bin/claude) - Bundled agent SDK (from the 0.33.0 bridge): 0.3.197
- Custom skills injected via
BB_INHERITED_SKILLS_ROOTS
Symptom detail
- Server log:
Live ready turn command failed/Live thread start command failed, errJSON-RPC request timed out: turn/start(status 502,command_failed, retryable false) — fromcallHostOnlineRpcWithRetry - Host-daemon log:
online host RPC failed, typeturn.submit, same timeout, thrown from the daemon bundle's RPC timeout handler - Affects both resumed threads and brand-new threads (
thread.startpath fails identically) - First turn after the update failed differently (sandbox deps missing — fair enough,
bubblewrap/socatweren't installed; installing them fixed that error), after which every turn produced the timeout above
What I ruled out
- Claude Code CLI is healthy. Reproducing the bridge's exact spawn (same flags incl.
--resumeof the same session,--plugin-dir,--settings, stream-json in/out) responds withsystem/initin ~2s and answers turns normally. - The control protocol is healthy. Driving the CLI manually: it answers
control_request: initializepromptly and replies with a proper error response to unknown control subtypes. - The SDK pairing is healthy. A minimal script against
@anthropic-ai/[email protected](the version the 0.33.0 bridge bundles) + CLI 2.1.217, resuming the same session in the same cwd, completes a turn in ~8s. - No stuck buffers. With the deadlock live: bridge and CLI both idle in
epoll_wait, andss -xpshows Recv-Q/Send-Q of 0 on all three stdio socketpairs in both directions — each side believes it's the other's turn. - The bridge's
turn/starthandler replies immediately when it executes (queuePromptInputs+sendResult), and requests are dispatched fire-and-forget, so the observed timeout means the request never reached the handler.
The silent drop
packages/agent-runtime/src/claude-code/bridge/bridge.ts (handleLine):
const request = decodeClaudeCodeJsonRpcRequest(parsed);
if (!request) return;decodeClaudeCodeJsonRpcRequest returns null on any zod validation failure, and the bridge drops the line without replying. The daemon then times out with no indication of what was wrong. Same pattern for the no-default switch in handleRequest (unknown methods are also dropped silently).
I didn't manage to pin down which field in my daemon→bridge requests fails validation before I rolled back (custom skills roots and thread state from the pre-0.33.0 DB are the machine-specific suspects), but the schema-drop behavior means any daemon/bridge disagreement — version skew, migration edge case, unexpected thread state — presents as this same opaque timeout.
Suggested fix
- In
handleLine, when the envelope parses as a request butclaudeCodeCommandSchemavalidation fails, reply with a JSON-RPC error (e.g.-32602) carrying the zod issue summary, and log it — the daemon would then surface the real cause instantly instead of a 30s timeout. - Add a
defaultcase inhandleRequestreturning-32601for unknown methods.
Happy to provide logs or re-test a fix build — the broken 0.33.0 state is reproducible on this machine (I kept the migrated DB).
Activity
SawyerHood commentedon Jul 22, 2026
I think I have a fix! One question:
if you start a thread with
full accessdoes it work? I think this might be related to not having bubblewrap installed on you machine.Can you try installing it for your distro?
https://github.com/containers/bubblewrap
Will also give you a PR to test soon!
SawyerHood commentedon Jul 22, 2026
Thanks for this — the debugging writeup made it much faster to track down, and you were right that the silent drop is the real problem. #859 has a fix.
Your analysis was also right that a well-formed
turn/startwas vanishing before the handler, and there is a specific mechanism for it beyond theif (!request) return:Both directions number their outgoing requests with a plain integer counter from 1 —
runtime.ts:230on the daemon side,bridge.ts:298(toolCallRequestIdCounter) on the bridge side, incremented per forwarded tool call and per permission request. They share one id space. AnddecodeBridgeJsonRpcResponseaccepted an inbound request as a success response, because the response schemas are non-strict (so the extramethod/paramspass) andresult: z.unknown()also matches a missing key.handleLinechecks the response branch first, so a request whose id collided with an outstanding tool call or permission request settled that pending promise with garbage and returned before reaching the request decoder.That lines up with your forensics: the bytes were consumed off the socketpair (hence
Recv-Q/Send-Q0), the bridge was idle because it thought it had handled a response, and the handler never ran.What's in the fix:
method, per the JSON-RPC spec and matching what the daemon side already does. This also covers the pi and acp bridges, which share the decoder and the same counter pattern.-32602with the zod issue summary on a params mismatch (logged to stderr, which the runtime captures into provider diagnostics), and-32601for an unknown method. The known-method list is derived from the schema union so it can't drift.bubblewrap/socat— was a separate regression. Replace permission modes with approval presets #797 migratedreadonlyandworkspace-writedefaults toaccept-edits, andaccept-editsenables the Claude SDK OS sandbox where 0.0.32'sreadonlymapping did not. The SDK defaultsfailIfUnavailabletotrue, so an install that previously defaulted toreadonlylost every session on a host without the deps. That now degrades gracefully instead of aborting the session.One honest caveat: I can't prove from here that the id collision was your trigger. It needs a turn where a tool call or permission request is outstanding when the daemon sends its next request — plausible with custom skills and permission prompts, but not something I can confirm without your logs. It is the only mechanism I found that reproduces your exact forensics.
Since you kept the migrated DB and can still reproduce: a re-test on a build of #859 would be very useful. If something still fails, it should now come back as a JSON-RPC error naming the field or method instead of a 30s timeout — which pins the real cause immediately either way. That diagnostic is the part I'd most like to see output from.
amadad commentedon Jul 22, 2026
Update: this appears healthy so far after upgrading Claude Code from 2.1.217 to 2.1.218.
A few details/corrections from testing:
bubblewrap0.9.0 andsocat1.8.0 are installed. Installing them fixed the initial missing-sandbox-dependency error, but the later timeout had still reproduced.JSON-RPC request timed out: turn/start, including after restarting bb. So the observed failure was not limited to bb's sandboxed permission mode.claude-fable-5Full Access thread passed its first turn, a second turn, and an explicit stop/resume cycle. Normal use also seems okay so far.I can't reproduce the Fable failure on 2.1.218 yet. This makes the Claude Code version relevant, although I don't know whether 2.1.218 fixed the underlying mismatch or whether an older persisted session can still trigger it.
One additional data point: Codex has intermittently produced the analogous
JSON-RPC request timed out: thread/resumeafter bb reaped an idle provider session, under both Full Access and Auto. Retrying later can succeed. That may be separate, but it suggests resume/reconnect handling is worth checking independently of Bubblewrap.I still think the proposed JSON-RPC error response for schema-invalid/unknown requests would be valuable: even if the current compatibility issue is resolved, silently dropping a request turns future version skew into an opaque timeout.
Happy to test the PR/build if useful.
amadad commentedon Jul 22, 2026
I read through #859. The ID-collision mechanism fits the observed pattern better than the Claude Code upgrade alone:
thread/resumetimeouts, which is consistent with the shared decoder path you fixed.So I would not treat the successful 2.1.218 test as proof that the underlying issue is gone—it may simply have changed timing or started a clean session.
Please send a canary/build install command when available. I can retest against the migrated database with a tool/permission request followed by an immediate colliding turn, plus resumed Fable and Codex sessions. Since
bubblewrapandsocatare now installed here, that test should isolate the bridge fix from the sandbox-dependency regression.SawyerHood commentedon Jul 22, 2026
@amadad you can just checkout that PR and run
pnpm iandpnpm startStop the Claude Code bridge from silently dropping requests (#859)
amadad commentedon Jul 24, 2026
Working now!
acp bridge: reply to unknown and invalid requests instead of dropping…
pi: canonical Provider Bridge Protocol, second conformant bridge
claude-code: canonical Provider Bridge Protocol, the flagship migration
Report pi and ACP turn acceptance on consumption (#2021)