Skip to content

hotfix: v0.2.5809 — codedb_bundle oneOf is opt-in (fixes OpenAI strict-mode rejection)#440

Merged
justrach merged 1 commit intomainfrom
hotfix/0.2.5809-openai-compat
May 6, 2026
Merged

hotfix: v0.2.5809 — codedb_bundle oneOf is opt-in (fixes OpenAI strict-mode rejection)#440
justrach merged 1 commit intomainfrom
hotfix/0.2.5809-openai-compat

Conversation

@justrach
Copy link
Copy Markdown
Owner

@justrach justrach commented May 6, 2026

Summary

v0.2.5808 broke OpenAI-Responses-API-backed MCP clients (codex, forgecode, etc.). OpenAI's strict-mode tool-schema validator rejects oneOf outright:

Invalid schema for function 'mcp_codedb_tool_codedb_bundle': In context=('properties', 'ops', 'items'), 'oneOf' is not permitted.

This makes the entire codedb_bundle tool unusable on those clients. Anthropic accepts oneOf and benefits from the constraint, so the builder isn't going away — just gated behind an env var.

Change

  • Default: tools/list serves the raw schema with Stage 1's required: ["tool", "arguments"] only. Works on every MCP client.
  • Opt-in: CODEDB_DISCRIMINATED_SCHEMA=1 re-enables the augmented oneOf for Anthropic-backed clients (Claude Code, etc.) that want the stronger constraint.
  • buildAugmentedToolsList itself is unchanged; only the call site in pub fn run is gated.

Test plan

  • zig build test — 513/513 pass.
  • Stdio MCP probe against the new binary confirms no oneOf in the served bundle items by default; setting CODEDB_DISCRIMINATED_SCHEMA=1 brings it back.
  • forgecode / codex no longer rejects mcp_codedb_tool_codedb_bundle.

🤖 Generated with Claude Code

v0.2.5808 broke OpenAI-backed MCP clients (codex, forgecode, etc.):
their strict-mode tool-schema validator rejects `oneOf` outright with
`Invalid schema for function 'mcp_codedb_tool_codedb_bundle': 'oneOf'
is not permitted`, making `codedb_bundle` unusable on those clients.

Default to the raw schema (Stage 1's required: ["tool", "arguments"]
still applies). Set CODEDB_DISCRIMINATED_SCHEMA=1 on the codedb
process to opt back into the augmented oneOf for Anthropic-backed
clients that benefit from it.

The builder (`buildAugmentedToolsList`) is unchanged; only the call
site in `pub fn run` is gated on the env var.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@justrach justrach merged commit 0a32594 into main May 6, 2026
1 check failed
justrach added a commit that referenced this pull request May 7, 2026
The codedb_bundle tool has been a footgun across multiple stages:
  #434 — schema permitted empty arguments (Stage 1 fix: required arguments)
  #437 — Stage 2 oneOf augmentation broke OpenAI strict-mode (#440 hotfix)
  #441 — codedb_projects sub-op replay loop in planners

Even with all of the above, OpenAI clients still emit
{"tool":"codedb_*","arguments":{}} because the default schema's
arguments field is a bare {type:"object"} with no inner shape, and the
discriminated oneOf is opt-in only.

Disable codedb_bundle entirely until the schema can be reworked. The
dispatcher-side handler stays (so clients with cached schemas don't
crash), but the runtime tools/list response no longer advertises it.
CODEDB_BUNDLE_ENABLED=1 re-enables advertisement.

Asserts:
- buildToolsListResponse(.{ .bundle_enabled = false, ... }) omits
  codedb_bundle from the tools array
- codedb_search and codedb_outline are still advertised (sanity)
- buildToolsListResponse(.{ .bundle_enabled = true, ... }) re-includes
  codedb_bundle

Compile-fails on main (the function does not yet exist).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
justrach added a commit that referenced this pull request May 7, 2026
The codedb_bundle tool has been a footgun across multiple stages:
  #434 — schema permitted empty arguments (Stage 1 fix: required arguments)
  #437 — Stage 2 oneOf augmentation broke OpenAI strict-mode (#440 hotfix)
  #441 — codedb_projects sub-op replay loop in planners

Even with all of the above, OpenAI clients still emit
{"tool":"codedb_*","arguments":{}} because the default schema's
arguments field is a bare {type:"object"} with no inner shape, and the
discriminated oneOf is opt-in only.

Disable codedb_bundle entirely until the schema can be reworked. The
dispatcher-side handler stays (so clients with cached schemas don't
crash), but the runtime tools/list response no longer advertises it.
CODEDB_BUNDLE_ENABLED=1 re-enables advertisement.

Asserts:
- buildToolsListResponse(.{ .bundle_enabled = false, ... }) omits
  codedb_bundle from the tools array
- codedb_search and codedb_outline are still advertised (sanity)
- buildToolsListResponse(.{ .bundle_enabled = true, ... }) re-includes
  codedb_bundle

Compile-fails on main (the function does not yet exist).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
justrach added a commit that referenced this pull request May 7, 2026
Across multiple stages — #434 (empty-args), #437 (oneOf augmentation),
#440 (OpenAI strict-mode regression), #441 (codedb_projects replay) —
codedb_bundle has remained a footgun for OpenAI/codex/forgecode clients
because the default schema can't bind sub-tool arg shape without oneOf,
and oneOf is OpenAI-strict-incompatible.

Disable bundle advertisement in tools/list by default. Dispatcher-side
handler stays so cached-schema clients don't crash on call. Set
CODEDB_BUNDLE_ENABLED=1 to re-advertise.

Refactor: extract buildToolsListResponse(alloc, opts) — opts are
{ bundle_enabled, discriminated_opt_in }. run() reads the two env
vars (CODEDB_BUNDLE_ENABLED, CODEDB_DISCRIMINATED_SCHEMA) and passes
them into the builder.

Closes #443.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
justrach added a commit that referenced this pull request May 7, 2026
* test(mcp): issue-443 failing test for disabling codedb_bundle by default

The codedb_bundle tool has been a footgun across multiple stages:
  #434 — schema permitted empty arguments (Stage 1 fix: required arguments)
  #437 — Stage 2 oneOf augmentation broke OpenAI strict-mode (#440 hotfix)
  #441 — codedb_projects sub-op replay loop in planners

Even with all of the above, OpenAI clients still emit
{"tool":"codedb_*","arguments":{}} because the default schema's
arguments field is a bare {type:"object"} with no inner shape, and the
discriminated oneOf is opt-in only.

Disable codedb_bundle entirely until the schema can be reworked. The
dispatcher-side handler stays (so clients with cached schemas don't
crash), but the runtime tools/list response no longer advertises it.
CODEDB_BUNDLE_ENABLED=1 re-enables advertisement.

Asserts:
- buildToolsListResponse(.{ .bundle_enabled = false, ... }) omits
  codedb_bundle from the tools array
- codedb_search and codedb_outline are still advertised (sanity)
- buildToolsListResponse(.{ .bundle_enabled = true, ... }) re-includes
  codedb_bundle

Compile-fails on main (the function does not yet exist).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(mcp): disable codedb_bundle by default — v0.2.5811 (#443)

Across multiple stages — #434 (empty-args), #437 (oneOf augmentation),
#440 (OpenAI strict-mode regression), #441 (codedb_projects replay) —
codedb_bundle has remained a footgun for OpenAI/codex/forgecode clients
because the default schema can't bind sub-tool arg shape without oneOf,
and oneOf is OpenAI-strict-incompatible.

Disable bundle advertisement in tools/list by default. Dispatcher-side
handler stays so cached-schema clients don't crash on call. Set
CODEDB_BUNDLE_ENABLED=1 to re-advertise.

Refactor: extract buildToolsListResponse(alloc, opts) — opts are
{ bundle_enabled, discriminated_opt_in }. run() reads the two env
vars (CODEDB_BUNDLE_ENABLED, CODEDB_DISCRIMINATED_SCHEMA) and passes
them into the builder.

Closes #443.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

1 participant