You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Fixture: agent-matrix scenarios 3->4->6 key on a value the chain never persists; trace doesn't record offered tools/routed skill #1839
Split from #1835. Scenarios 3→4→6 of scripts/eval/fixtures/agent-matrix.ts form a chain keyed on a value that's never actually persisted, making Scenario 6 structurally unwinnable — and the eval trace can't show this because it doesn't record what tools/skills were offered per turn.
Problem Statement
The chain is broken. Scenario 3 creates a schema from "equipment my team checks out and whether it's been returned" — no cost/value field implied. Scenario 4 then logs "replacement cost 2400" against that schema and the model correctly replies that the schema doesn't support it. Scenario 6 asks to find "the 2400 one" — a value that was never stored anywhere. A model correctly declining to resolve an unresolvable reference gets scored as a failure.
The fixture's own comment (agent-matrix.ts:224-226) anticipated this class of gap for status but not for cost — it reasoned scenario 3 "plausibly carries a status field" without checking that scenario 6's actual discriminator is the amount, which nothing in scenario 3's prompt asks the schema to carry.
The trace can't diagnose this or anything like it.toolsOffered is an empty string on every scored turn in the committed trace — there's no record of which tools were actually offered or which skill (if any) was routed to, so an availability or routing claim about any scenario currently requires reading source rather than results.
Evidence
scripts/eval/fixtures/agent-matrix.ts:224-226 (the anticipated-but-incomplete comment)
scripts/results-e4b.trace.jsonl, commit 57bf1088 — toolsOffered empty on every turn
Fix the 3→4→6 chain so Scenario 6 keys on a value the chain actually persists — either scenario 3's prompt implies a cost/value field, or scenario 6's key changes to something scenario 4 actually stores. Whichever is chosen, verify it doesn't just relocate the same "prompt implies X, schema doesn't capture X" gap to a different field
Record the offered tool list and routed skill (if any) per turn in the trace output, so availability/routing claims are checkable from results without reading source
Re-run the affected scenario(s) after the fix to confirm the chain resolves correctly end to end
Architecture Impact
None — eval fixture and trace-observability fix only.
1. The trace bug is a dead scraper, not a missing field.scripts/aichat.ts:139 looks for a daemon log line containing scoped tool list with a selected_tools= field. That line exists nowhere in the Rust codebase — grep for either string returns zero hits in packages/agent/. So [tools offered] is never emitted and toolsOffered is "" on every turn, as observed.
Meanwhile [tools available]is emitted correctly, scraped from the real line Agent turn: system prompt and tools prepared (agent_loop.rs:660, carrying tool_names=) — but runner.ts never parses it into a TurnRecord, so it dies at the aichat/runner seam. The post-scoping tool list the eval actually wants is already in that log line: tools there is the output of routing::stage2_tools, i.e. already scoped to what the routed candidates permit.
The routed skill name is genuinely absent. agent_loop.rs:1720 logs candidates=<count> only; the names exist solely as an OTel span attribute (routing.candidates), which the eval cannot see — it scrapes the text log and has no exporter attached.
2. Scenario 7 keys on the same unpersisted field as scenario 6. The issue names 3→4→6, but scenario 7 (Do we have anything worth 90000 sitting out?) also discriminates on replacement cost — the same field scenario 3's prompt never asks the schema to carry. Fixing only scenario 6 relocates the gap to 7 rather than closing it, which is exactly what AC #1 warns against.
Proposed fix
Chain: widen scenario 3's prompt to imply a cost field, rather than re-keying 6 and 7 off the item name:
3: "...record of the equipment my team checks out, whether it's been
returned, and what each item costs to replace"
4: unchanged — "replacement cost 2400" now lands in a field that exists
6: unchanged — "The 2400 one came back" is now resolvable
7: unchanged — "anything worth 90000" is resolvable and correctly empty
Rationale for preferring this over re-keying: scenario 6 exists to test resolve_query routing on an indirect reference. Re-keying it to the laser cutter came back makes the referent a direct name match, resolvable by plain search_nodes string matching — the assertion would still pass but would test less. Keeping the cost discriminator preserves what the scenario is for. Cost is also the only field here that scenario 3 can plausibly carry and that 4 supplies a value for, so it does not just move the same prompt-implies-X gap elsewhere.
The existing comment at agent-matrix.ts:224-226 gets corrected in the same edit — it reasons about status and explicitly did not check the cost discriminator.
Trace: three changes, no new observability plumbing:
Delete the dead scoped tool list scrape in aichat.ts; [tools available] already carries the post-scoping list from the real log line.
Add tool_names from that line to routed_skills in agent_loop.rs:1720 — log the eligible candidate names (those clearing the score gate, i.e. the ones actually rendered into the prompt), not just the count.
Scrape both into TurnRecord in runner.ts and surface them per-turn in extra(). Note the current extra() takes turns[0] only, so a multi-turn scenario silently reports the first turn's offered set — that becomes per-turn.
Chain (AC #1). Widened scenario 3's prompt to imply the cost field, per the recommendation above. Verified against the live DB: the schema now persists it.
Also corrected the stale agent-matrix.ts:224-226 comment, which reasoned about status and explicitly had not checked the cost discriminator.
Trace (AC #2). The dead scoped tool list scrape is deleted; [tools offered] now comes from the real Agent turn: system prompt and tools prepared line (post-scoping, i.e. routing::stage2_tools's output). Added routed_skills to the two-stage routing overhead log in agent_loop.rs, naming the candidates that clear the score gate, and scraped it through to TurnRecord.routedSkills. extra() now records both per turn rather than turns[0] alone.
It works, and it immediately earned its keep — toolsOffered is populated on every turn where it was "" before:
So scenario 6's failure is not an availability problem — resolve_query was offered. The raw generation shows what actually happened: I need the ID for "the 2400 one" to mark it as returned. Could you please provide that node's URI? That claim is now checkable from results without reading source, which is exactly what AC #2 asked for.
Coverage note: both aichat.test.ts and runner.test.ts already fed [tools offered] through their fixtures but never asserted on it — which is how an always-empty field survived into committed traces. Both now assert it.
Full run on purged DB + freshly built daemon, gemma-4-e4b-q4km, n_ctx 32768: 9/12, matching the known-honest E4B baseline. Failures: 6, 8d, 8e.
Scenario 6 is still unwinnable, but the cause moved. Scenario 4's create_node passes no properties at all:
Tool executed tool=create_node is_error=false
args_preview={"content":"Laser Cutter Check Out Record","node_type":"equipment_item"}
The persisted node carries properties: {"equipment_item": {"_schema_version": 1}} — no cost, no date, no status. So "the 2400 one" still resolves to nothing. The schema-side gap is fixed; the value simply never reaches storage. Scenario 8c does the same ("Kind of Blue by Miles Davis" → no artist property), which is plausibly related to 8d/8e failing downstream.
Scenario 4 passes anyway.{kind: "toolOnce", tool: "create_node"} only counts the call, so a node that persists zero properties scores green. That is the same class of blind spot as the always-empty toolsOffered: an assertion that cannot see the thing it exists to check.
Add a property-count assertion so a zero-property create_node fails loudly. This is squarely AC #1's "verify it doesn't just relocate the same gap" — without it, this issue closes having moved the gap from the schema to the instance and declared victory. The eval drops to 8/12 by design: not a regression, but a break that was previously being hidden now reported honestly. Then file create_node omitting properties as its own issue, since fixing it means touching tool descriptions or agent guidance and needs its own measurement.
Alternatives, for the record: (b) fix the create_node behavior inside this PR — makes scenario 6 genuinely resolve, but exceeds this issue's stated "eval fixture and trace-observability fix only" and could run long; (c) document only and change no assertions — smallest diff, stays 9/12, but leaves a scenario scoring green while persisting nothing.
Proceeding on the recommendation unless redirected.
Agreed on (a) — tighten scenario 4's assertion here, file the create_node property-loss behavior separately. Same reasoning: this issue's own AC #1 says "verify it doesn't just relocate the gap," and shipping a schema fix that still lets a zero-property create_node score green would do exactly that while looking done.
The 9/12 -> 8/12 drop is the right outcome, not a regression to avoid. It's the same principle as #1764's whole premise: a number that goes down because a blind assertion got eyes is progress, not a step backward. Don't be tempted toward (c) to preserve the headline — a scenario scoring green while persisting nothing is worse than an honest 8/12.
On (b) — agreed it's out of scope here. create_node silently dropping user-supplied properties is a real, separate bug (echoed by scenario 8c's identical pattern — "Kind of Blue by Miles Davis" losing its artist), and it deserves its own root-cause pass rather than a same-PR patch. Given the 8c/8d/8e correlation you flagged, when you file it, include that connection explicitly — if 8d/8e's failures are downstream of 8c's property loss the same way 6's is downstream of 4's, fixing this one bug may clear three scenarios at once, which matters for how it gets prioritized.
One addition to the new issue when filed: name the mechanism, not just the symptom, if you can tell from the trace — is this a tool-schema issue (properties not being extracted from the user's message into the call), a guidance issue (nothing tells the model to populate properties on instance creation), or something else? That distinction determines whether it's an ADR-064 rule 1 (tool schema) or rule 5 (prose) fix, same framing as this whole workstream's other findings.
Scenario 3's prompt now implies the cost field. Verified against the live DB, not just the tool call:
schema get equipment_item
fields: [ is_returned (boolean), replacement_cost (number) ]
Also corrected the stale agent-matrix.ts:224-226 comment.
AC #2 — trace records offered tools and routed skill
The dead scoped tool list scrape is gone; [tools offered] now comes from the real "system prompt and tools prepared" line (post-scoping, routing::stage2_tools output). Added routed_skills to agent_loop.rs's routing log, naming the candidates that clear the score gate. Both recorded per turn rather than turns[0].
Verified populated in a real results file — 13 tools on every scored turn where it was previously "":
This immediately answered the issue's own availability question: resolve_querywas offered on scenario 6, so its failure is not availability. The raw generation shows the model asking the user for a URI instead.
routedSkills needed a second fix (7a449cb4). The first version required a quoted value; tracing emits it bare (routed_skills=Organization, Research & Search, Node Creation), so it matched nothing and came back empty on a full run — the same silent-empty state the dead scrape was in. Skill names contain spaces and commas, so the scrape now runs to end of line. The unit tests had passed throughout because their fixtures used the quoted form; fixtures now carry verbatim daemon output, and I validated the scraper against a real log rather than only fixtures:
[routed skills] Research & Search, Schema Creation, Organization
Clean full run (purged DB, freshly built daemon, gemma-4-e4b-q4km, n_ctx 32768): 8/12, exactly as predicted.
✗ 4. Instance creation
↳ create_node succeeded but persisted 0 property value(s), expected at least 1 —
the node was created without the particulars the prompt supplied
Scenario 4 previously scored green on this identical behavior. Failures are 4, 6, 8d, 8e; 6/8d/8e are the pre-existing ones. Implemented as agreed: minProperties on toolOnce, plus property_count on create_node's result folded into the existing result_field_count log field. Mirrors schemaCallsAreSound — same failure shape one level down.
Ruled in/out by reading the verbatim prompt via NODESPACE_PROMPT_DUMP rather than inferring. The tool schema is correct (properties offered, typed, documented), the field names reached the model (RELEVANT ENTITY TYPES: - equipment_item: Equipment Item (is_returned, replacement_cost)), and the Node Creation skill — confirmed routed via the new routed_skills marker — explicitly says to populate them, with a worked example. So it is ADR-064 rule 5 (prose), not rule 1. Two candidates named in the issue: the tool description's hedge ("Optionally pass 'properties' if the schema type has fields") competing with the skill's stronger instruction, or the skill's "IMMEDIATE ACTION REQUIRED / do not output planning text" urgency framing crowding out its own field-population rule — cf. #1827's dilution finding. The 8c/8d/8e correlation is called out there as you asked.
Tests
bun run test:all exits 0: frontend 4112 passed (171 files, = baseline), scripts 74 passed (was 68 — 6 new), skill 20 passed, Rust suites green (agent crate 371). quality:fix clean, no unrelated reformatting.
Outstanding
I wanted one more full run so the committed trace also carries the now-working routedSkills, but this machine is out of memory — swap pinned at ~7 GB/8 GB and free RAM down to 0.4 GB, and inference now fails at Decode Error -3 (Metal allocation) before any turn completes. Two runs died that way and a third hit an unrelated pre-existing llama.cpp crash (llama-grammar.cpp:940: GGML_ASSERT(!stacks.empty()) during constrained tool-call decoding, SIGABRT — reproduced on a build predating my changes, so not introduced here; worth its own issue if it keeps recurring).
This does not block the ACs: the 8/12 run above is complete and clean, and routedSkills is verified working against a real daemon log. It only means the archived trace's routedSkills column predates 7a449cb4. Happy to re-run when the machine is quieter — say the word.
Activity
malibio commentedon Jul 31, 2026
Frontend baseline: 171 test files passed, 4112 tests passed (45.73s).
malibio commentedon Jul 31, 2026
Findings before implementation
Two things are worse than the issue states.
1. The trace bug is a dead scraper, not a missing field.
scripts/aichat.ts:139looks for a daemon log line containingscoped tool listwith aselected_tools=field. That line exists nowhere in the Rust codebase — grep for either string returns zero hits inpackages/agent/. So[tools offered]is never emitted andtoolsOfferedis""on every turn, as observed.Meanwhile
[tools available]is emitted correctly, scraped from the real lineAgent turn: system prompt and tools prepared(agent_loop.rs:660, carryingtool_names=) — butrunner.tsnever parses it into aTurnRecord, so it dies at the aichat/runner seam. The post-scoping tool list the eval actually wants is already in that log line:toolsthere is the output ofrouting::stage2_tools, i.e. already scoped to what the routed candidates permit.The routed skill name is genuinely absent.
agent_loop.rs:1720logscandidates=<count>only; the names exist solely as an OTel span attribute (routing.candidates), which the eval cannot see — it scrapes the text log and has no exporter attached.2. Scenario 7 keys on the same unpersisted field as scenario 6. The issue names 3→4→6, but scenario 7 (
Do we have anything worth 90000 sitting out?) also discriminates on replacement cost — the same field scenario 3's prompt never asks the schema to carry. Fixing only scenario 6 relocates the gap to 7 rather than closing it, which is exactly what AC #1 warns against.Proposed fix
Chain: widen scenario 3's prompt to imply a cost field, rather than re-keying 6 and 7 off the item name:
Rationale for preferring this over re-keying: scenario 6 exists to test
resolve_queryrouting on an indirect reference. Re-keying it tothe laser cutter came backmakes the referent a direct name match, resolvable by plainsearch_nodesstring matching — the assertion would still pass but would test less. Keeping the cost discriminator preserves what the scenario is for. Cost is also the only field here that scenario 3 can plausibly carry and that 4 supplies a value for, so it does not just move the same prompt-implies-X gap elsewhere.The existing comment at
agent-matrix.ts:224-226gets corrected in the same edit — it reasons about status and explicitly did not check the cost discriminator.Trace: three changes, no new observability plumbing:
scoped tool listscrape inaichat.ts;[tools available]already carries the post-scoping list from the real log line.tool_namesfrom that line torouted_skillsinagent_loop.rs:1720— log the eligible candidate names (those clearing the score gate, i.e. the ones actually rendered into the prompt), not just the count.TurnRecordinrunner.tsand surface them per-turn inextra(). Note the currentextra()takesturns[0]only, so a multi-turn scenario silently reports the first turn's offered set — that becomes per-turn.Proceeding on this unless redirected.
malibio commentedon Jul 31, 2026
Baseline (worktree
issue-1839-matrix-chain-trace, branched from905c5fc3):Frontend: 4112 passed (171 files), 0 failed — 45.87s
Note: fresh worktree needed a one-off
bunx svelte-kit syncinpackages/desktop-app/before the firstbun run test, as documented in CLAUDE.md.malibio commentedon Jul 31, 2026
Implementation done; re-run surfaced a deeper break — scope decision needed
What landed
Chain (AC #1). Widened scenario 3's prompt to imply the cost field, per the recommendation above. Verified against the live DB: the schema now persists it.
Also corrected the stale
agent-matrix.ts:224-226comment, which reasoned about status and explicitly had not checked the cost discriminator.Trace (AC #2). The dead
scoped tool listscrape is deleted;[tools offered]now comes from the realAgent turn: system prompt and tools preparedline (post-scoping, i.e.routing::stage2_tools's output). Addedrouted_skillsto thetwo-stage routing overheadlog inagent_loop.rs, naming the candidates that clear the score gate, and scraped it through toTurnRecord.routedSkills.extra()now records both per turn rather thanturns[0]alone.It works, and it immediately earned its keep —
toolsOfferedis populated on every turn where it was""before:So scenario 6's failure is not an availability problem —
resolve_querywas offered. The raw generation shows what actually happened:I need the ID for "the 2400 one" to mark it as returned. Could you please provide that node's URI?That claim is now checkable from results without reading source, which is exactly what AC #2 asked for.Coverage note: both
aichat.test.tsandrunner.test.tsalready fed[tools offered]through their fixtures but never asserted on it — which is how an always-empty field survived into committed traces. Both now assert it.The re-run (AC #3) — and the problem
Full run on purged DB + freshly built daemon,
gemma-4-e4b-q4km, n_ctx 32768: 9/12, matching the known-honest E4B baseline. Failures: 6, 8d, 8e.Scenario 6 is still unwinnable, but the cause moved. Scenario 4's
create_nodepasses no properties at all:The persisted node carries
properties: {"equipment_item": {"_schema_version": 1}}— no cost, no date, no status. So "the 2400 one" still resolves to nothing. The schema-side gap is fixed; the value simply never reaches storage. Scenario 8c does the same ("Kind of Blue by Miles Davis"→ no artist property), which is plausibly related to 8d/8e failing downstream.Scenario 4 passes anyway.
{kind: "toolOnce", tool: "create_node"}only counts the call, so a node that persists zero properties scores green. That is the same class of blind spot as the always-emptytoolsOffered: an assertion that cannot see the thing it exists to check.Scope question
Recommendation: tighten scenario 4's assertion here, file the model-side behavior separately.
Add a property-count assertion so a zero-property
create_nodefails loudly. This is squarely AC #1's "verify it doesn't just relocate the same gap" — without it, this issue closes having moved the gap from the schema to the instance and declared victory. The eval drops to 8/12 by design: not a regression, but a break that was previously being hidden now reported honestly. Then filecreate_nodeomittingpropertiesas its own issue, since fixing it means touching tool descriptions or agent guidance and needs its own measurement.Alternatives, for the record: (b) fix the
create_nodebehavior inside this PR — makes scenario 6 genuinely resolve, but exceeds this issue's stated "eval fixture and trace-observability fix only" and could run long; (c) document only and change no assertions — smallest diff, stays 9/12, but leaves a scenario scoring green while persisting nothing.Proceeding on the recommendation unless redirected.
malibio commentedon Jul 31, 2026
Agreed on (a) — tighten scenario 4's assertion here, file the create_node property-loss behavior separately. Same reasoning: this issue's own AC #1 says "verify it doesn't just relocate the gap," and shipping a schema fix that still lets a zero-property create_node score green would do exactly that while looking done.
The 9/12 -> 8/12 drop is the right outcome, not a regression to avoid. It's the same principle as #1764's whole premise: a number that goes down because a blind assertion got eyes is progress, not a step backward. Don't be tempted toward (c) to preserve the headline — a scenario scoring green while persisting nothing is worse than an honest 8/12.
On (b) — agreed it's out of scope here.
create_nodesilently dropping user-supplied properties is a real, separate bug (echoed by scenario 8c's identical pattern — "Kind of Blue by Miles Davis" losing its artist), and it deserves its own root-cause pass rather than a same-PR patch. Given the 8c/8d/8e correlation you flagged, when you file it, include that connection explicitly — if 8d/8e's failures are downstream of 8c's property loss the same way 6's is downstream of 4's, fixing this one bug may clear three scenarios at once, which matters for how it gets prioritized.One addition to the new issue when filed: name the mechanism, not just the symptom, if you can tell from the trace — is this a tool-schema issue (properties not being extracted from the user's message into the call), a guidance issue (nothing tells the model to populate properties on instance creation), or something else? That distinction determines whether it's an ADR-064 rule 1 (tool schema) or rule 5 (prose) fix, same framing as this whole workstream's other findings.
Proceed as recommended.
malibio commentedon Jul 31, 2026
Implemented and verified; AC #3 satisfied, one addendum outstanding
Commits:
b5dfae81,7a449cb4. Filed the split-out bug as #1841.AC #1 — chain fixed
Scenario 3's prompt now implies the cost field. Verified against the live DB, not just the tool call:
Also corrected the stale
agent-matrix.ts:224-226comment.AC #2 — trace records offered tools and routed skill
The dead
scoped tool listscrape is gone;[tools offered]now comes from the real "system prompt and tools prepared" line (post-scoping,routing::stage2_toolsoutput). Addedrouted_skillstoagent_loop.rs's routing log, naming the candidates that clear the score gate. Both recorded per turn rather thanturns[0].Verified populated in a real results file — 13 tools on every scored turn where it was previously
"":This immediately answered the issue's own availability question:
resolve_querywas offered on scenario 6, so its failure is not availability. The raw generation shows the model asking the user for a URI instead.routedSkillsneeded a second fix (7a449cb4). The first version required a quoted value; tracing emits it bare (routed_skills=Organization, Research & Search, Node Creation), so it matched nothing and came back empty on a full run — the same silent-empty state the dead scrape was in. Skill names contain spaces and commas, so the scrape now runs to end of line. The unit tests had passed throughout because their fixtures used the quoted form; fixtures now carry verbatim daemon output, and I validated the scraper against a real log rather than only fixtures:AC #3 — re-run, and the assertion agreed above
Clean full run (purged DB, freshly built daemon,
gemma-4-e4b-q4km, n_ctx 32768): 8/12, exactly as predicted.Scenario 4 previously scored green on this identical behavior. Failures are 4, 6, 8d, 8e; 6/8d/8e are the pre-existing ones. Implemented as agreed:
minPropertiesontoolOnce, plusproperty_countoncreate_node's result folded into the existingresult_field_countlog field. MirrorsschemaCallsAreSound— same failure shape one level down.#1841 mechanism
Ruled in/out by reading the verbatim prompt via
NODESPACE_PROMPT_DUMPrather than inferring. The tool schema is correct (propertiesoffered, typed, documented), the field names reached the model (RELEVANT ENTITY TYPES: - equipment_item: Equipment Item (is_returned, replacement_cost)), and the Node Creation skill — confirmed routed via the newrouted_skillsmarker — explicitly says to populate them, with a worked example. So it is ADR-064 rule 5 (prose), not rule 1. Two candidates named in the issue: the tool description's hedge ("Optionally pass 'properties' if the schema type has fields") competing with the skill's stronger instruction, or the skill's "IMMEDIATE ACTION REQUIRED / do not output planning text" urgency framing crowding out its own field-population rule — cf. #1827's dilution finding. The 8c/8d/8e correlation is called out there as you asked.Tests
bun run test:allexits 0: frontend 4112 passed (171 files, = baseline), scripts 74 passed (was 68 — 6 new), skill 20 passed, Rust suites green (agent crate 371).quality:fixclean, no unrelated reformatting.Outstanding
I wanted one more full run so the committed trace also carries the now-working
routedSkills, but this machine is out of memory — swap pinned at ~7 GB/8 GB and free RAM down to 0.4 GB, and inference now fails atDecode Error -3(Metal allocation) before any turn completes. Two runs died that way and a third hit an unrelated pre-existingllama.cppcrash (llama-grammar.cpp:940: GGML_ASSERT(!stacks.empty())during constrained tool-call decoding, SIGABRT — reproduced on a build predating my changes, so not introduced here; worth its own issue if it keeps recurring).This does not block the ACs: the 8/12 run above is complete and clean, and
routedSkillsis verified working against a real daemon log. It only means the archived trace'sroutedSkillscolumn predates7a449cb4. Happy to re-run when the machine is quieter — say the word.Address review: count persisted properties, not requested ones (#1839)
Fixture: agent-matrix scenarios 3->4->6 key on a value the chain neve…