Repository navigation
cal: ASSEMBLE says what its budget dropped - #213
Conversation
|
Added: the console now shows CAL warnings — closing the gap I flagged above rather than leaving it as a follow-up. It was never W017-specific: the console dropped all seventeen ( Shown above the result in the console's existing warning style. The Verified in a real browser against Silence keeps its meaning: a query that warns about nothing still shows nothing. No README screenshot is affected — the five shots are graph, workflow, runs, suggestions and analytics; the Query page is not among them, so no re-shoot.
|
33b0d4f to
c081920
Compare
ASSEMBLE applies a token budget whether or not the caller writes one (DEFAULT_BUDGET_TOKENS, 4000; parser ceiling 16000), and when it bound it discarded the tail of each source in silence. The payload actively hid it: total_available reported the POST-budget count, so `grains.len() == total_available` held for a truncated assembly exactly as it did for a complete one. Measured on a real memory, 229 matching grains came back as 80 with warnings: None. That is the same cut RECALL has announced as CAL-W015 since 1.5.1, made silently. A host composing a prompt from an assembly had no way to detect that its rules, its policies or its recent turns were trimmed — it would publish a number produced from a truncated prompt and never know. Three changes: - CAL-W017 when the budget drops grains, naming the sources and the counts, and distinguishing a budget the caller wrote from the default that applied because none was — the two lead to different fixes. - total_available is the PRE-budget count. Per-source grain_count still reports what survived, so the drop is computable rather than announced only in prose. - docs/cal-reference.md states the default and the ceiling where BUDGET is documented. Neither number appeared there, so "no BUDGET clause" read as "no budget". The default itself stays. An unbudgeted assembly that returned everything could overflow the context window it is being composed for, which is the worse failure; and progressive disclosure degrading a section is the point of having a budget at all. Silence was the defect, not the number. The post-dedup 2000-grain cap already warned for itself, so its tail is folded into the omitted set for ELEMENT_OMIT without double-reporting. Tests seed 200 grains past the default — the small parity fixture that let this ship is exactly why the bug was invisible — and pin that a budget which fits stays silent, so silence keeps meaning "nothing was cut". Claude-Session: https://claude.ai/code/session_01JEcv3k8mMwZ5YAa26jdLc2
Every other surface honours the contract that silence means the query did what you asked (docs/cal-reference.md §5): the bindings and the MCP tool return `warnings`, the CLI prints them to stderr. The console received them from POST /api/cal and dropped them on the floor -- all seventeen, W001 through W017, not just the new one. That is the worst surface to lose them on. It is where a person reads an answer, and a warning is precisely the news that the answer is a window rather than the whole match. The result this commit's own CAL-W017 describes -- 70 of 200 grains -- rendered as a plain "70 memories" with nothing to say the other 130 existed. Shown above the result, in the console's existing warning style. The CAL-Wnnn code is stripped in plain mode and kept in Developer mode: the code is developer chrome, but "130 of 200 grains dropped" is news for whoever is reading. A query that warns about nothing still shows nothing, so silence keeps its meaning here too. No README screenshot is affected -- the five shots are graph, workflow, runs, suggestions and analytics; the Query page is not among them. Claude-Session: https://claude.ai/code/session_01JEcv3k8mMwZ5YAa26jdLc2
…sed heading Two mechanical defects that reached main through #212 and #215. Ten `'"'"'` sequences -- shell single-quote escaping -- had leaked verbatim into CHANGELOG.md and docs/cal-reference.md, so prose read "a tool'"'"'s input" where it should read "a tool's input". And rebasing this branch past #215 appended a second `### Fixed` under `## [Unreleased]` rather than merging into the first. One heading now, entries in order. Claude-Session: https://claude.ai/code/session_01JEcv3k8mMwZ5YAa26jdLc2
c081920 to
9951f02
Compare
|
Rebased onto Shell-escaping artifacts. Ten A duplicate Verified the two PRs' |
Closes #208.
The bug
ASSEMBLEapplies a token budget whether or not the caller writes one —DEFAULT_BUDGET_TOKENSis 4000 — and when it bound it discarded the tail of each source in silence. The payload actively hid it:total_availablereported the post-budget count, so a truncated assembly was arithmetically indistinguishable from a complete one —grains.len() == total_availableheld either way.Reproduced on a seeded memory (200 grains,
LIMIT 400, noBUDGETclause):This is the same cut
RECALLhas announced asCAL-W015since 1.5.1, made without saying so. A host composing a prompt from an assembly had no way to detect that its rules, its policies or its recent turns were trimmed — it would publish a number produced from a truncated prompt and never know. That is what happened inareev-bench: wrapping a selection in anASSEMBLEreturned 79 of 229 error grains, and the small parity fixture was too small to notice.The fix
1.
CAL-W017when the budget drops grains, naming the sources and the counts, and distinguishing a budget the caller wrote from the default that applied because none was — the two lead to different fixes:The labels matter: "130 grains went" is not actionable on a four-source assembly without knowing which section lost them.
2.
total_availableis the pre-budget count. Each source'sgrain_countstill reports what survived, so the drop is computable rather than announced only in prose. The console already renderstotal_available > shownas "N match in total", so it starts telling the truth for assemblies with no change there.3. Docs state the numbers.
docs/cal-reference.mdnow gives the 4000 default and the 16000 ceiling whereBUDGETis documented — neither appeared there, so "noBUDGETclause" read as "no budget".On the ticket's open question
The issue asks whether an unbudgeted
ASSEMBLEshould default to no trimming. I kept the default, deliberately:Silence was the defect, not the number.
Detail
The post-dedup 2000-grain cap already warns for itself, so its tail is folded into the omitted set for
ELEMENT_OMITwithout double-reporting under W017.Tests
crates/areev-cal/tests/assemble_budget_visibility.rs, four cases:total_availableis 200 not 70,CAL-W017present, naming[e]and the default;BUDGET 4000names itself, not the default;ASSEMBLEis whole (the control: if plainRECALLalso came back short, the assembly's cut would not be the budget's doing).The fixture seeds 200 grains past the default on purpose — a fixture too small to bind is exactly why this shipped.
cargo test --workspace: 134 suites green.cargo clippy --workspace --all-targets: clean.Known gap, not introduced here
The console's Query page does not display CAL warnings — any of them, W001 through W017. The warning does reach
POST /api/cal's payload; it is the UI that drops it. That is a pre-existing gap across all seventeen warnings rather than something this PR adds, and closing it is a console change (with the screenshot re-shoot that implies), so I left it out. Worth its own issue if wanted.Docs
docs/cal-reference.md§3.1 (theBUDGETdefault, the ceiling, and the warning),ERROR_CODES.md(CAL-W017, append-only),crates/areev-cal/CLAUDE.md,CHANGELOG.md.https://claude.ai/code/session_01JEcv3k8mMwZ5YAa26jdLc2