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 - #1843
Conversation
…ill per turn (#1839) The eval's `toolsOffered` was empty on every scored turn because scripts/aichat.ts scraped a daemon log line -- "scoped tool list" with `selected_tools=` -- that has never existed in the codebase. The real line ("Agent turn: system prompt and tools prepared", carrying post-scoping `tool_names`) was already being scraped under a second marker name that the runner never parsed, so it died at the aichat/runner seam. One marker now, fed by the line that exists. The routed skill was genuinely unrecorded: the routing log carried only a candidate count, with the names reachable solely as an OTel span attribute the eval cannot see. `routed_skills` now names the candidates clearing the score gate -- the ones actually rendered into Stage 2's prompt. Scenario 3's prompt implied no cost field, yet scenarios 4, 6 and 7 all key on a replacement cost, making 6 and 7 unwinnable and scoring a correct refusal as a failure. Scenario 3 now implies the field. Keeping cost as scenario 6's discriminator is deliberate: re-keying to the item name would make the referent a direct string match that plain search_nodes resolves, and the resolve_query assertion would pass while testing less. Re-running then showed the gap had only moved. create_node persists a bare shell -- content and type, none of the user's particulars -- so "the 2400 one" is still unresolvable, and scenario 4 scored green throughout because `toolOnce` counts the call and nothing else. create_node now reports `property_count` on its result (folded into the existing `result_field_count` log field, alongside create_schema's `fields`), and `minProperties` asserts on it. Scenario 4 fails as a result: the eval goes 9/12 -> 8/12, reporting a break it was previously hiding rather than a new regression. The underlying prose bug is filed separately as #1841. Both aichat.test.ts and runner.test.ts already fed `[tools offered]` through their fixtures without ever asserting on it, which is how an always-empty field reached committed traces unnoticed. Both now assert it. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01AvsJJC6NgtJuNz8fTYA163
The scrape required a quoted value, but tracing quotes a string field only when it must, and it does not here: the value arrives bare as `routed_skills=Organization, Research & Search, Node Creation`. The pattern matched nothing, so `routedSkills` came back empty on every scenario of a full eval run — the same silent-empty state the dead `scoped tool list` scrape was in, reintroduced by the fix for it. Skill names contain both spaces and commas, so no delimiter short of the line end is safe; agent_loop.rs emits this field last for that reason. The unit tests passed throughout because their fixtures used the quoted form — they asserted the scrape against a shape the daemon never produces. Fixtures now carry verbatim daemon output, including a case with both separators, and the scrape is verified against a real log rather than only against fixtures. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01AvsJJC6NgtJuNz8fTYA163
Pragmatic Code Review — PR #1843Review Type: Initial Review SummaryA genuinely net-positive change that does the harder version of the job. The core insight — that the eval was scoring green on assertions structurally incapable of seeing what they claimed to check — is correct, and the fix pursues it to the honest conclusion (9/12 → 8/12) rather than preserving the headline number. The commit messages and code comments are unusually good: they explain why the shape is what it is, and commit I verified the load-bearing claims rather than accepting them:
Standards check: no lint suppression added, no Two findings are worth addressing before merge; neither is a security or correctness risk to the product, both are correctness risks to the measurement instrument, which is this PR's entire subject matter. Requirements Check
Code Review Findings🟡 Important1. 📁 let property_count = properties.as_object().map(|o| o.len()).unwrap_or(0);This is computed from the merged request map, before The consequence runs in both directions, and both are bad for an instrument whose purpose is to distinguish "recorded the particulars" from "persisted a bare shell":
The fix is nearly free, because This matters more than a normal off-by-semantics nit because the PR's own framing is "the result is the executor's report of what it persisted, while args are only the model's report of what it asked for" ( Principle: an observation must be taken at the boundary it claims to describe. Measuring the input and labeling it the output is the same class of error as the dead 2. The 📁 My reproduction (above) shows real output is The scrape happens to survive, and I verified this explicitly: The optional-quote pattern tolerates both, so there is no bug today. But the fixtures are asserting against a shape reality does not produce, which is precisely the condition the PR's own commit message identifies as the root cause of the The PR fixed the instance and left the class. The trailing Suggested fix: update these fixtures to the verbatim unquoted daemon form, exactly as Principle: a test fixture is a claim about the real world. When it diverges, the test stops measuring the system and starts measuring itself — the specific failure mode this entire PR is about. 🟢 Suggestions3. 📁 The change from extra: fixture.extra?.(scenario, [scored]),
I checked this doesn't break anything: Fine either way, but worth being explicit in the comment that this is anticipatory rather than describing current behavior, or the next reader will look for the multi-turn path and not find it. (Alternatively — this is arguably YAGNI, and 4. 📁 The TypeScript side of both features is now well covered (6 new tests, including the excellent "spaces and commas" and "absent vs empty" cases). The Rust side — the producer of the log field and the result field — has none. This is what let the quoted/unquoted mismatch reach a full eval run: the only tests were downstream of the format, so nothing asserted the emitted string. A single test asserting Principle: test at the boundary you own. A contract asserted only by its consumer's fixtures is not asserted at all. 5. 📁 I initially expected this to be a problem and concluded it isn't. The two shapes are disjoint ( The residual risk is naming: "field count" now means schema fields defined for one tool and property values supplied for another. A third tool returning a 6. 📁 Flagging explicitly since the no-backward-compatibility rule is strict here: these are fine, and should stay. The rule targets code paths — dual-mode support, deprecation shims, migration layers. These comments describe data: results and baseline JSON files that are immutable historical records of inference runs, some of which cost minutes of GPU time and cannot be regenerated identically (different model state, different DB). Treating a missing
7. 📁 I checked this against ADR-064 rule 4 (tool results carry facts, not procedures) and against sibling tools. Worth a light watch rather than a change: RecommendationCOMMENT — approve-worthy in substance; two items worth a quick pass first. This is careful work on the instrument the rest of the agent workstream depends on, and it holds itself to a standard most eval fixes don't: it re-ran, discovered its own fix had only moved the gap, and then went and closed the new one instead of shipping. The self-reported Before merge I'd suggest:
Findings 3–7 are optional. Nothing here is a security, data-integrity, or product-correctness risk, and the 8/12 conclusion stands regardless. Reviewed by an AI reviewer — final merge call is the author's. |
malibio
left a comment
There was a problem hiding this comment.
Initial review posted above. Recommendation: COMMENT — net positive and approve-worthy in substance; two items worth a quick pass before merge (property_count measured pre-persistence; tool_names fixtures still encode a quoted shape the daemon never emits). Final merge call is the author's.
Finding 1 (Important). `property_count` was computed from the merged argument map before create_node ran, so it answered "what did the model ask for" while claiming to report what persisted. Creation is not pass-through — schema defaults are applied and keys are normalized into the type's namespace — so the two disagree in both directions, and both hurt: a default can inflate the count past `minProperties: 1` and produce the false pass the assertion exists to prevent. It now reads `output.node_data`, create_node's own re-fetch of the stored node, already flattened out of the namespace with `_schema_version` filtered. Verified live: a create carrying label + status reports property_count=2 against a node storing exactly those two. The old comment in agent_loop.rs already drew this distinction — "the result is the executor's report of what it persisted, while args are only the model's report of what it asked for" — and the field had landed on the wrong side of it. Finding 2 (Important). Fixtures encoded `tool_names="..."`, `tool="..."` and `args_preview="..."` in quoted form; tracing emits all three bare. No live bug, but this is the exact defect class the previous commit fixed, left in place one line away from it. Captured the real shapes off a running daemon and replaced the hand-written ones, with a file-level note to copy from a real log rather than write fixtures by hand. Finding 4 (Suggestion). The routed_skills rendering had no Rust-side test — only downstream TS fixtures asserted its format, which is what let the quoting mismatch reach a full eval run. Extracted it as routing::routed_skill_names and tested it, including that it names the same set render_candidates_for_prompt writes into the prompt. Finding 3 (Suggestion). Marked extra()'s per-turn arrays as anticipatory. Skipped finding 5 (rename result_field_count): the reviewer confirmed the conflation is sound — disjoint shapes, per-tool interpretation — so this is a naming change rippling into an unrelated log field and its scraper for no behavioral gain. Revisit if a third tool feeds the field. Findings 6 and 7 were validated as correct with no action requested. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01AvsJJC6NgtJuNz8fTYA163
Review feedback addressed — commit
|
Closes #1839