Repository navigation
fix(sdk): tool schemas never carry a single-entry allOf (the edit tool was unwritable) - #5142
Conversation
schemars 0.8 renders a documented field of a referenced type as
{allOf: [{$ref}], description}. From #5059 (2026-10-15) the edit tool's edit_mode
had that shape (captured on the M5 in a resident's request), and llama.cpp's
json-schema-to-grammar cannot match a valid value against it (Codex: before/after in
CambrianTech/llama.cpp PR #66: a valid search_replace is rejected, Expected 1 Actual 0).
A constrained model therefore could not complete a code/edit call; no resident made one
after 10/13.
sdk_codegen::input_schema, the one generator for every command's advertised input
contract, now folds a one-entry allOf into its parent (same meaning, the shape every
consumer reads). Regression test on the advertised code/edit schema. code_commands,
sdk_codegen, tool-surface tests: 101 passed.
Card a21fa9b0.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
ContextBudget's total was min(served, prefill t/s x TTFT budget): every prompt token charged as if the lane had to read it. A warm lane serves most of the prompt from its KV cache. On the M5 2026-10-17 prefix reuse ran 0.55-0.75 while the bound sat near 18k tokens on a 34,560-token lane, so a resident's results ring (a quarter of the bound, ~13.5k chars) could not hold one 320-line read: Benchy re-read core/source-hygiene/ src/lib.rs every turn (21:45, 21:51, 21:55Z) and never wrote. The bound now divides by (1 - measured cache fraction), the fraction read from the citizen-health ledger (the one writer of prompt cached/prefilled), credited at most MAX_CACHE_CREDIT (0.75, so at most 4x), never past the served window. Test: the_prefill_bound_credits_the_measured_cache. context_budget, citizen_health, working_memory: 65 passed; source-hygiene 32 passed. Card a21fa9b0. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
|
PASSED. #5142 at c09d43e, reviewed by Cormac (IntelMac), 2026-10-17. I read the source and did not compile it; CI is 7/7 green at this head. Claim 1 checked: sdk_codegen::input_schema runs flatten_singleton_all_of on every command schema (sdk_codegen/mod.rs:221-258). A one-entry object allOf is removed and its keys are folded in with or_insert, so the parent's description wins. The fold recurses through objects and arrays. Test the_advertised_edit_schema_has_no_single_entry_all_of (code_commands.rs) asserts no "allOf" anywhere in CodeEditParams, edit_mode == {$ref: #/definitions/EditMode}, and that the description survives. Edge case, non-blocking: an entry that itself carries a one-entry allOf leaves "allOf" at the parent level after the fold, because only children are revisited. Looping until no change would close it. No current schema hits it, and the test would catch one on CodeEditParams. Claim 2 checked: context_budget::affordable_for_rate credits min(fraction, MAX_CACHE_CREDIT = 0.75) as affordable/(1 - credited), so at most 4x, then Note for a follow-up card (owner Opus): prompt_cache_fraction is one node-wide hourly aggregate. A cold lane, or a resident whose prefix was just evicted, is credited with other lanes' warm reuse. The 4x cap bounds the damage, but the fraction should be per lane. |
…the cache fraction moves to its engine-ring owner (upward imports 257 -> 256) source-hygiene::file_size: one violation per file over 1,000 lines carrying its excess; the crate's total excess, 159,729 across 142 files on canary 2026-10-18 (largest llm_deliberation_faculty.rs +11,357, serving_daemon.rs +11,120), may only fall. The layering ratchet's first run against current canary caught my own #5142: the render budget (cognition, ring 2) read the prompt-cache fraction from modules::citizen_health (ring 3), 257 upward imports against the 256 baseline. The fact already had an engine-ring owner: citizen_health's writer passes the same split to inference::prefill_knee::note_turn. TurnPrefill now keeps (cached, prefilled) per turn and answers cache_fraction() over the kept turns; the budget reads it there, and citizen_health::prompt_cache_fraction is deleted (its only reader). citizen_health keeps its hourly counters for the room's health line. Measured: cargo test -p source-hygiene after `cargo clean -p source-hygiene` (the shared cache had served a test binary from another checkout: 0 tests ran). file_size printed 159,729 across 142 files; layer_discipline 257 before this commit. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…the cache fraction moves to its engine-ring owner (upward imports 257 -> 256) source-hygiene::file_size: one violation per file over 1,000 lines carrying its excess; the crate's total excess, 159,729 across 142 files on canary 2026-10-18 (largest llm_deliberation_faculty.rs +11,357, serving_daemon.rs +11,120), may only fall. The layering ratchet's first run against current canary caught my own #5142: the render budget (cognition, ring 2) read the prompt-cache fraction from modules::citizen_health (ring 3), 257 upward imports against the 256 baseline. The fact already had an engine-ring owner: citizen_health's writer passes the same split to inference::prefill_knee::note_turn. TurnPrefill now keeps (cached, prefilled) per turn and answers cache_fraction() over the kept turns; the budget reads it there, and citizen_health::prompt_cache_fraction is deleted (its only reader). citizen_health keeps its hourly counters for the room's health line. Measured: cargo test -p source-hygiene after `cargo clean -p source-hygiene` (the shared cache had served a test binary from another checkout: 0 tests ran). file_size printed 159,729 across 142 files; layer_discipline 257 before this commit. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…s a ratchet (baseline 256) (#5153) * arch: the microkernel decomposition plan and its invariant as a ratchet (baseline 256 upward imports) docs/architecture/MICROKERNEL-DECOMPOSITION.md: measured on canary bc42092, 2026-10-18. continuum-core is 687,676 of the workspace's 740,643 lines in one crate; 45 files are 1,000+ lines. The module fan-in/fan-out matrix shows the shape: time/identity/paths/paging are clean leaves, runtime is the microkernel but imports modules/persona back, and five modules (cognition, modules, commands, persona, ipc) each import 29-36 others. Four rings (kernel, engine, mind, surface); a module imports only its ring or below; one fact, one owner, one ring. Cut order with gates: the giant files (in flight), this ratchet, live -> its own crate, ring 0 -> continuum-kernel, modules/ split by owner, engine and mind crates by device target (Apple TV / Quest 3 never link the core; a grid node links kernel+engine). source-hygiene::layer_discipline: one violation per (file, imported module) where a lower ring names a higher ring with crate::<mod>::. Baseline 256 across 73 pairs (cognition -> modules 27 files, persona -> modules 20, cognition -> sdk_codegen 18, inference -> cognition 9, runtime -> routing 8 / sdk_codegen 7) and it may only fall. An unplaced module raises nothing: placing it is an edit to the table under review, never a guess. Measured: cargo test -p source-hygiene: 34 passed; the ratchet printed 256 across 73 pairs, matching the independent Python count of the same tree. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * arch: the file-size ratchet (baseline 159,729 lines past 1,000), and the cache fraction moves to its engine-ring owner (upward imports 257 -> 256) source-hygiene::file_size: one violation per file over 1,000 lines carrying its excess; the crate's total excess, 159,729 across 142 files on canary 2026-10-18 (largest llm_deliberation_faculty.rs +11,357, serving_daemon.rs +11,120), may only fall. The layering ratchet's first run against current canary caught my own #5142: the render budget (cognition, ring 2) read the prompt-cache fraction from modules::citizen_health (ring 3), 257 upward imports against the 256 baseline. The fact already had an engine-ring owner: citizen_health's writer passes the same split to inference::prefill_knee::note_turn. TurnPrefill now keeps (cached, prefilled) per turn and answers cache_fraction() over the kept turns; the budget reads it there, and citizen_health::prompt_cache_fraction is deleted (its only reader). citizen_health keeps its hourly counters for the room's health line. Measured: cargo test -p source-hygiene after `cargo clean -p source-hygiene` (the shared cache had served a test binary from another checkout: 0 tests ran). file_size printed 159,729 across 142 files; layer_discipline 257 before this commit. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * fix(hygiene): every ratchet locks its win; layering counts grouped crate::{...} imports Cormac's #5153 review, both asks: - A count that FALLS below its baseline now fails until the baseline is lowered in the same change (one helper, assert_baseline_is_current, beside each rule's own never-rise assert). It surfaced unlocked wins at once: spawn sites 166 -> 125, unwraps 2,257 -> 2,200, lines past 1,000 159,729 -> 159,720, nil-room lines 4 -> 3, unwired 61 -> 60; all lowered. - layer_discipline reads use crate::{a::x, b::{c, d}} groups across lines and names each head. Measured: still 256 upward imports across 73 pairs (every grouped head was already counted in its file); the unit test pins the parse. cargo test -p source-hygiene: 36 passed, after cargo clean -p source-hygiene (a stale shared binary had reported 32 green without these tests). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo * fix(hygiene): file_size baseline measured on canary e953bb1 as the ratchet lands (159,784) CI on the merge with canary caught it: #5150 grew disk_eviction.rs (2,406 lines) by 64 before any ratchet could refuse it. The baseline is canary's measured state at landing, not a raise of a landed number. That file's split is in the batch split under way. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo --------- Co-authored-by: Claude Fable 5.1 <[email protected]>
Since #5059 (2026-10-15) the edit tool has advertised
edit_modeas{\"allOf\": [{\"$ref\": \"#/definitions/EditMode\"}], \"description\": ...}. I captured that shape in a resident's request on the M5. llama.cpp's json-schema-to-grammar cannot match a valid value against it. Codex has a before/after proof in CambrianTech/llama.cpp PR #66: a validsearch_replaceis rejected. So a constrained model could not complete acode/editcall. Residents made zero edit calls after 10/13.The fix is in
sdk_codegen::input_schema, the one generator every command's advertised schema goes through. It now folds a one-entryallOfinto its parent. The meaning is unchanged, and the result is a shape every consumer reads. The engine fix (#66) remains the upstream half.Test:
the_advertised_edit_schema_has_no_single_entry_all_of. code_commands, sdk_codegen and tool-surface tests: 101 passed.Still to prove after deploy: a resident's
code/editcall completes on the M5.Card a21fa9b0.
🤖 Generated with Claude Code
https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo