Skip to content

fix(mcp): reject codedb_projects in bundle — v0.2.5810 (#441)#442

Merged
justrach merged 2 commits intomainfrom
fix/issue-441-bundle-no-projects
May 6, 2026
Merged

fix(mcp): reject codedb_projects in bundle — v0.2.5810 (#441)#442
justrach merged 2 commits intomainfrom
fix/issue-441-bundle-no-projects

Conversation

@justrach
Copy link
Copy Markdown
Owner

@justrach justrach commented May 6, 2026

Summary

Block codedb_projects from being a valid codedb_bundle sub-op. It's a global directory enumeration that planners replay when they see it once — recent-message attention bias on resumable clients (graff, etc., that ship delta + previous_response_id) amplifies the loop. Mirroring the existing rejections of codedb_bundle (recursive) and codedb_edit (write).

Fixes #441.

Change

  • handleBundle in src/mcp.zig rejects codedb_projects with error: codedb_projects not allowed in bundle.
  • buildAugmentedToolsList excludes codedb_projects from the discriminated oneOf branches (matching the dispatcher-level rejection).
  • Standalone calls to codedb_projects outside a bundle are unchanged — it's still a useful tool when a global listing genuinely is what's wanted.

Test plan

  • zig build test — 515/515 pass. Two new tests (issue-441: bundle rejects codedb_projects sub-op, issue-441: codedb_projects branch is excluded from augmented oneOf) fail on main and pass with the fix.

🤖 Generated with Claude Code

justrach and others added 2 commits May 7, 2026 02:52
codedb_projects lists every indexed project on the machine — a
global directory enumeration unrelated to the current repo.
Planners that see a previous bundle calling codedb_projects tend
to replay the same shape (e.g. 5x codedb_projects in one batch),
making it a pattern-amplification footgun.

Two tests:
- handleBundle dispatcher must reject codedb_projects with an
  explicit error, mirroring codedb_bundle (recursive) and
  codedb_edit (write op) rejections.
- buildAugmentedToolsList oneOf branches must not advertise
  codedb_projects, so opt-in clients aren't tempted to use it.

Both fail on this branch; fix follows in next commit.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
codedb_projects lists every indexed project on the machine — a
global directory enumeration unrelated to whatever repo the agent
is working on. When a planner sees a previous bundle that called
codedb_projects, it tends to replay the same shape (5x
codedb_projects in one batch), and recent-message attention bias
amplifies it on continuation (graff and other resumable clients
ship the delta + previous_response_id, so the prior assistant
message dominates planner context).

Block it at the dispatcher, mirroring codedb_bundle (recursive)
and codedb_edit (write op) rejections. The discriminated oneOf
(opt-in via CODEDB_DISCRIMINATED_SCHEMA=1) also drops the
codedb_projects branch. Standalone calls outside a bundle are
unchanged.

515/515 tests pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@justrach justrach merged commit f1c1c10 into main May 6, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mcp: codedb_bundle dispatcher should reject codedb_projects (planner-replay footgun)

1 participant