release: v0.2.5808 — codedb_bundle schema fix + rerank-trace logger (#434, #436, #437)#439
release: v0.2.5808 — codedb_bundle schema fix + rerank-trace logger (#434, #436, #437)#439
Conversation
Adds a v0 trace logger that appends one JSON line per searchContent
invocation when enabled via .codedbrc (rerank_trace = true). Captures
{ts, query, results:[{path,line,score}]} so we can inspect the data
and decide whether online learning-to-rank from agent traces is worth
building.
Pure observation — does not change ranking behavior. Disabled by
default. Caps query at 256 bytes, results at 50 entries, and rotates
the file by truncate-clobber once it crosses 10 MB. All I/O errors
are swallowed; logging never breaks a search.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Pre-fix the multi-signal scoring loop only ran when result_list had more than one item — a micro-optimization that skipped sorting a single result. With the rerank-trace logger added in 54b6b72, this made single-result entries log score=0.0, making them indistinguishable from genuinely zero-confidence matches in offline analysis. The fix runs scoring unconditionally and keeps the sort guarded behind len > 1. Cost: a few µs per single-result search — negligible. Caught by end-to-end binary verification. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The bundle inputSchema advertises ops items with required: ["tool"]
and arguments as a bare {type: "object"}, so function-calling LLMs
emit {tool, arguments: {}} as the minimum-valid payload. This test
asserts "arguments" is in items.required so models are forced to
populate it.
Also exposes tools_list as pub for the test to introspect.
Fails on main; fix follows in next commit.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Stage 1 of the bundle-schema fix. Prior schema had ops items with
required: ["tool"] and arguments as a bare {type: "object"}, so
function-calling LLMs read {} as a valid arguments payload and
emitted {tool, arguments: {}} as the minimum-valid call. The empty
object then triggered the #424 inline-args fallback, which used the
op object itself as the args bag and surfaced as
"received keys: [tool, arguments]" from each sub-tool.
Adding "arguments" to items.required forces the model to populate
it. The runtime inline-args fallback at mcp.zig:1948 stays as a
backstop for non-conformant clients.
Stage 2 (discriminated oneOf over tool, binding arguments to each
sub-tool's inputSchema) is a follow-up — it requires turning the
hand-rolled tools_list literal into a builder.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Stage 2 of the bundle-schema fix. Stage 1 (#434) made `arguments` required at the items level, but the field is still a bare {type: "object"} so a schema-greedy model can satisfy `required` by emitting `arguments: {}`. This test asserts the items schema contains a discriminated `oneOf` with one branch per dispatchable codedb_* sub-tool, each pinning `tool` to a const and `arguments` to that sub-tool's actual inputSchema. Adds a stub `buildAugmentedToolsList` that returns the unaugmented schema so the test fails at runtime instead of as a compile error. The real builder lands in the fix commit. Fails on this branch; fix follows in next commit. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Stage 2 of the bundle-schema fix. Stage 1 (#434) made `arguments` required at the items level but left it as a bare {type: "object"}; a schema-greedy model could still satisfy the required check by emitting `arguments: {}`. Stage 2 binds the *contents* of arguments to each sub-tool's actual inputSchema via a discriminated oneOf on `tool` (const) → `arguments` (sub-tool inputSchema). Once a model picks `tool: "codedb_outline"`, the only matching branch requires arguments.path:string — there is no schema-minimal escape. `buildAugmentedToolsList` parses the existing tools_list literal once at server startup, mutates the bundle items to add the oneOf, and serializes back. No hand-maintained duplication — branches are generated from the per-sub-tool schemas already advertised. Falls back to the raw tools_list if augmentation fails (parse error / OOM) so clients still get a valid schema. codedb_bundle (recursive) and codedb_edit (write op) are excluded from the oneOf since handleBundle rejects them at runtime anyway. Schema payload roughly doubles (~12KB → ~24KB after augmentation, 19 branches across the dispatchable codedb_* tools). Test: tests.zig now asserts the augmented schema contains oneOf with branches that pin tool to a const and preserve each sub-tool's required args (codedb_outline branch must require `path`). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…434, #436, #437) Bundles three PRs: - #435 (Stage 1, #434): require `arguments` on bundle ops items - #438 (Stage 2, #437): discriminated oneOf per sub-tool - #436: opt-in rerank-trace logger for offline tuning + score-on-len-1 fix End-to-end Sonnet 4.6 verifies the schema constraint flows through to model output: bundle calls now arrive with populated, correctly- named `arguments` for each sub-op. 513/513 tests pass on the merged branch. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
💡 Codex ReviewLines 1876 to 1878 in d6ad9ca When ℹ️ 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". |
Summary
Bundles three PRs into the v0.2.5808 release:
argumentson bundle ops items so schema-greedy LLMs are forced to populate the wrapper.oneOfper sub-tool: each branch pinstoolto aconstand bindsargumentsto that sub-tool's actualinputSchema. Once a model pickstool: "codedb_outline"the only matching branch requiresarguments.path:string— no schema-minimal escape.rerank_trace = truein.codedbrc. Plus a tiny fix to makererankAndFinalizealways score even atlen 1(so single-result entries don't logscore=0.0).#435, #436, and #438 are superseded by this PR and should close on merge.
Validation
zig build test).argumentspayloads under no fix; wrong-keyname payloads under Stage 1 only) does not reproduce. Same task that previously emittedcodedb_wordwith{"query": "..."}(failing) now emits{"word": "..."}(succeeding) — the discriminated branch'srequired: ["word"]constraint flows through to model output.oneOfbranches. Acceptable cost for the constraint.Branch contents
Test plan
zig build test— 513/513 pass.codedb_bundleschema includesoneOfwith 19 branches, each pinningtoolto a const and bindingargumentsto the sub-tool's real schema.argumentspopulated correctly per sub-op.🤖 Generated with Claude Code