Repository navigation
Closed
Labels
app/codedb-bridgebin/codedb-bridge.mjs — stdio MCP bridge to the shared codedb daemonbin/codedb-bridge.mjs — stdio MCP bridge to the shared codedb daemoneffort/sSmall: expected under 2 hours of workSmall: expected under 2 hours of workkind/bugSomething isn't working (prefixed form of the classic bug label)Something isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)Ordinary priority (the default)source/creatorFiled by the new-issue-creator jobFiled by the new-issue-creator jobtask/triageQueue packet kind: verify, reproduce, and route this itemQueue packet kind: verify, reproduce, and route this item
Description
Problem
bin/codedb-bridge.mjs (new in PR #4171, for issue #4120) calls the codedb daemon with no timeout anywhere:
-
createHandler'scallToolawaits the fetch with no signal:bin/codedb-bridge.mjs:192—res = await fetchFn(\${daemonUrl}${mapped.route}`)`. -
mainwires the real fetch the same way:bin/codedb-bridge.mjs:251—fetchFn: (url) => fetch(url)— noAbortSignal.timeout(...), noAbortController, no deadline constant anywhere in the file.
A daemon that accepts the connection but never responds (wedged index rebuild, half-open socket, a daemon stuck behind a lock) therefore hangs that tools/call forever.
Why it matters
- The caller never gets an error it can act on — not even the bridge's own "daemon unreachable" message (
:194-199), which only covers a rejected fetch. The line-293 comment says "the caller times out on that one id", but nothing in the bridge ever resolves that id. - It defeats the bridge's own exit path:
main'smaybeExit(:261-262) refuses to exit whilepending !== 0, and a hung call never settles (:269-271). So after the MCP client closes stdin, the bridge process leaks indefinitely instead of exiting — exactly the per-session process accumulation the bridge was built to eliminate (codedb shared daemon + MCP bridge: one codedb serve per project root, lift the #2220 park in the new shape (#2225) #4120 / Determine how to not need multiple codedb instances — or replace codedb effectively #2225). - The shared-bridge design (mcpx can share one bridge across sessions,
:255-258) makes one wedged daemon call a standing leak for every session that touches it.
Evidence (verified this run)
Laptop probe ~/git/fleet/probe-2026-11-01-laneA-codedb/ (verbatim copy of bin/codedb-bridge.mjs from main 199a7d27, md5 ca05ede20d2ae1a4760297bbe9320c58 on both hosts, node v24.21.0):
createHandlerwith a never-resolvingfetchFn: thetools/callpromise was STILL-PENDING after 600 ms (and by construction pending forever — no timer exists in the code path).grepover the file: noAbortSignal,AbortController,timeout, orsetTimeoutoutside the tests.
Distinct from issue #2114 (mcpx's Go chat-completions proxy upstream timeout — a different component and language).
Acceptance criteria
- A daemon fetch is bounded by a deadline (a named constant; configurable via env if that fits the existing
CODEDB_DAEMON_URLconfig style). - On expiry the
tools/callreturns an MCP error result (isError: true) naming the daemon URL, the route, and the timeout — the caller can retry or restart the daemon. - After stdin closes, the bridge exits even if a call was hung (the hung call is aborted/settled, so
pendingreaches 0). - New test in
bin/codedb-bridge.test.mjs: a stub daemon/fetch that never responds produces the timeout error within a bounded, test-scale time; the existing slow-but-finite test (1.2 s daemon delay, PR feat(mcpx): codedb shared daemon + stdio MCP bridge — lift the #2220 park (#4120, #2225) #4171) and the stdin-close flush test still pass — pick the default deadline comfortably above legitimate slow daemon responses.
Metadata
Metadata
Assignees
Labels
app/codedb-bridgebin/codedb-bridge.mjs — stdio MCP bridge to the shared codedb daemonbin/codedb-bridge.mjs — stdio MCP bridge to the shared codedb daemoneffort/sSmall: expected under 2 hours of workSmall: expected under 2 hours of workkind/bugSomething isn't working (prefixed form of the classic bug label)Something isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)Ordinary priority (the default)source/creatorFiled by the new-issue-creator jobFiled by the new-issue-creator jobtask/triageQueue packet kind: verify, reproduce, and route this itemQueue packet kind: verify, reproduce, and route this item
Activity
dezren39 commentedon Nov 2, 2026
🤖 Agent note · filed
dezren39 commentedon Nov 2, 2026
🤖 Agent note · picked up
repo-health-code-pilot)bin/codedb-bridge.mjson current main and re-run the never-resolving-daemon probe, then post the triage verdict and route the fix.63 remaining items
dezren39 commentedon Nov 3, 2026
🤖 Agent note · handed off
dezren39 commentedon Nov 3, 2026
🤖 Agent note · picked up (resume)
dezren39(Drew), so this lane has not touched its diff.dezren39 commentedon Nov 3, 2026
🤖 Agent note · escalated (blocked: Drew decision required)
dezren39(Drew), at head311b466ba9e8759c53ad433cdcbcb80fc0fbb066. The basic guard succeeds and CodeRabbit is neutral, but the hard-stop ownership rule prohibits this lane from editing or merging that PR. Earlier 30-minute parks did not change ownership.developing-today commentedon Nov 8, 2026
Agent note — task 13402 done: PR #4561 merged, issue #4191 closed (lane code-w, direct, pr_shepherd)
held,user/owned,do-not-merge,do-not-auto-edit); PR fix(codedb-bridge): bound daemon fetch deadline #4561 carries none. Theuser/escalated,status/blockedandqueue/blockedlabels are removed as stale.queue/6349-4191-codedb-bridge-timeoutonto current main (d222177) in laptop worktree~/git/fleet/13402-4191-codedb-bridge; the only conflict was the test-file imports, resolved as the union of both sides. New head 8a5d50a.node --test bin/codedb-bridge.test.mjson the laptop — 17 passed, 0 failed (includes the new never-resolving-daemon timeout tests and main's codedb-bridge: null daemon response body crashes codedb_tree out of the handler (no JSON-RPC response sent) and reads as a successful "null" result on other tools #6917/bin+pm-stack: four entry points still use the pre-#2083 raw-path entry-point check — codedb-bridge, supabase/cloudflare exporters and the claimant installer silently no-op via any symlink #4325 tests).Closes #4191.