Repository navigation
feat(mcpx): codedb shared daemon + stdio MCP bridge — lift the #2220 park (#4120, #2225) - #4171
Conversation
…park in the new shape (#4120) One codedb serve daemon per project root (user systemd unit codedb-code.service for ~/git/code) replaces one index-holding codedb mcp process per session (~1.1 GB RSS warm each, #2225). bin/codedb-bridge.mjs is a stateless stdio MCP shim forwarding the daemon-backed tools (tree/outline/symbol/search/word/hot/deps) to http://127.0.0.1:7719/explore/*; arguments the daemon cannot honour are rejected by name per the #3352 contract. .mcpx.json moves codedb from disabledMcpServers to mcpServers via the bridge, CODEDB_NO_TELEMETRY=1 retained.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 25 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ebcb0917be
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…ocking (PR #4171 Codex P2) The stdio read loop awaited each daemon call, so one slow search blocked every later request in a bridge process that mcpx may share across sessions. Requests now dispatch independently and responses correlate by JSON-RPC id; the process exits only once stdin is closed and all pending calls settle. Regression test spawns the bridge against a delayed stub daemon and asserts a ping is answered before the slow search.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8fb94c2a7e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
… Codex P2) process.exit(0) could discard pipe-queued stdout when stdin closed with a request pending, truncating the final (possibly multi-MB tree) response. Responses now settle in their write callbacks, and exit is queued behind an empty write that fires only after all prior output flushed. Regression test: stub daemon returns a ~2 MiB tree after a delay, client closes stdin immediately, full response must arrive and parse.
|
Codex Review: Didn't find any major issues. Swish! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Implements the #2225 determination (task 5226) in the shape it chose: one shared
codedb servedaemon per project root + a thin stdio MCP bridge, lifting the PR #2220 park. Closes #4120 and #2225 on merge.What changed
bin/codedb-bridge.mjs— stateless stdio MCP shim (no index, no state) exposing the daemon-backed codedb tools and forwarding tohttp://127.0.0.1:7719. Per the Design: unknown means stop — one strict argument contract for the repo's operator scripts #3352 argument contract, arguments the daemon cannot honour (project,regex:true,scope:true,compact:true) are rejected by name, never silently ignored;max_results/limitare honoured by slicing.bin/codedb-bridge.test.mjs— 6 node tests (URL parsing, route mapping, strict-argument rejection, handler, forwarding, error surfacing). All pass:node --test bin/codedb-bridge.test.mjs→ 6/6..mcpx.json— codedb moves fromdisabledMcpServerstomcpServers(node /home/user/git/code/bin/codedb-bridge.mjs,CODEDB_NO_TELEMETRY=1retained). The now-emptydisabledMcpServersblock is removed.Daemon surface (verified live, codedb 0.2.2)
The daemon's routes are under
/explore/(the #2225 note's bare/treeetc. 404):GET /health,/explore/tree,/explore/outline?path=,/explore/symbol?name=,/explore/search?q=,/explore/word?q=,/explore/hot,/explore/deps?path=. No route exists for read/edit/changes/status/snapshot/bundle/projects/index, so the bridge does not advertise those tools. Stale-index behaviour: the daemon tracks the live tree — tree output changed between calls minutes apart with no restart, while back-to-back calls are identical.Daemon unit (laptop, operational — not in this diff)
~/.config/systemd/user/codedb-code.service:ExecStart=/home/user/bin/codedb /home/user/git/code serve,CODEDB_NO_TELEMETRY=1,Restart=always, enabled + active;/healthreturns{"status":"ok"}.Verification (laptop, ~/git/code, fixed query set)
codedb mcpstdio: searchIdentityStore45 = 45 results (same path:line set), word 45 = 45, symbol 2 = 2 (identity.rs:95 struct_def, :119 impl_block), outline ofpkgs/id/src/web/mod.rs— all 50 daemon symbol names present in direct output, hot 10/10 files present. Tree bodies match modulo the direct server's header line and live-index drift between sequential runs.psshowed exactly one codedb process — the systemd daemon (~2.0 GB RSS cold-loaded for the code root, the single shared cost that replaces ~1.1 GB warm per session).Known limit
codedb servebinds the fixed port 7719, so a second per-root daemon cannot coexist yet; this PR ships the code root only, per the issue scope ("add further primary roots only as needed"). Additional roots need codedb port configurability first.Refs: task 6027, #2225 determination, PR #2220 (the park this lifts).
Need help on this PR? Tag
@codesmith-botwith what you need.