Repository navigation
Make the agent eval diagnostic before recording a baseline; revisit ADR-056's Scenario 5 claim - #1831
Conversation
Code Review SummaryThis is a well-scoped Phase A implementation: it stays strictly within "make the eval diagnostic," correctly defers baseline recording to #1800, and the design decisions called out as settled (debug-level raw logging, best-effort provenance, However, I built a minimal Rust harness against the actual Everything else — the tracing field additions, the FindingsCritical Issues
Suggested Improvements
Nitpicks
Verification performed
Given the two critical findings are both about silent data loss in exactly the mechanism this PR exists to make trustworthy (raw output capture), and the PR's own motivating principle is "every false result was invisible in aggregates," I'm requesting changes rather than approving as-is. This is very close — the fix is localized to the raw-output extraction path in two files and doesn't require touching the Rust side, the type additions, the provenance work, or the uniformity/exclusion logic, all of which are solid. |
malibio
left a comment
There was a problem hiding this comment.
Review status: REQUEST CHANGES (posted as a comment-type review because GitHub blocks request-changes on one's own PR). See the detailed review comment above for full findings — two critical, reproducible bugs in the raw-output log-scraping path (silent truncation on embedded newlines in aichat.ts's per-line scraper, and a separate delimiter-collision truncation in runner.ts's regex when the model's own text contains the literal substring "[tool]"). Both undermine the exact guarantee this PR exists to provide (that raw output is preserved verbatim for diagnosis) and are not caught by the existing test suite since runTurn's regex logic isn't exported/tested. Uniformity guard, empty-generation exclusion/baseline-comparison interaction, guidance provenance, and PR scope were all verified correct.
…mpty-generation exclusion, guidance provenance (closes #1764) The eval could not tell "the model failed" from "the harness failed" — both rendered as a low score, and the two known false results on record (a contaminated 11/12 baseline, and "no tools called" scenarios passing while every turn died on context overflow) were only caught by reading raw model output. This makes the harness diagnostic before any future baseline gets recorded against it: - Raw generation per ReAct iteration is now captured to a .trace.jsonl file alongside the results JSON (agent_loop.rs logs it at debug level so production's default info verbosity is unaffected). - A uniform 0%/100% pass rate across 4+ scored scenarios now aborts as an environment failure rather than writing a plausible results file. - The documented degenerate-empty-generation failure mode (model emits neither text nor a tool call) is now excluded from the pass/fail denominator instead of silently scoring as a model failure. - Provenance now records which seeded prompt/skill content a run actually measured (_seed.key/_seed.version read back via `node query`), since seeding only reseeds on daemon startup and a long-running daemon can silently serve stale guidance. - Stage 1's routing decision (query/clarify/clarify_suppressed/none/ unavailable/failed) and whether Stage 2's prompt actually carried a candidate block are now logged on every code path and surfaced per turn, closing the gap where a silently-skipped routing attempt looked identical to one that matched nothing. Verified the tool-call-parsing regression flagged during scoping (narrated JSON-array calls slipping past detection, per #1826) is already fixed in the production loop with its own unit coverage; no separate eval-side parsing gap exists since the eval only counts executed-tool log lines, never re-parses raw text itself. ADR-056's Scenario 5 claim and the honest 9/12 baseline were already addressed in earlier sessions on this issue; recording a fresh baseline remains gated on #1800 (create_schema description-inference deletion). Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_012qFMbS5rEGLQL6CCkg6Xjs
…review fixes for #1764) Code review on PR #1831 caught two bugs in the raw-output-trace plumbing added for #1764, both stemming from the same root cause: treating a field that can contain arbitrary model text as if it were bounded by ordinary line/marker delimiters. 1. scripts/aichat.ts split the daemon log slice on "\n" before scanning for the raw-generation marker. tracing's %-Display formatter writes the field verbatim, embedded newlines included, so any multiline generation was silently truncated at its first newline. 2. scripts/eval/runner.ts's regex used "\n[tool]" as a lookahead terminator, which broke if the model's own raw text happened to contain that literal substring (e.g. narrating "I'll use [tool] create_node..."). Fixed at the source: agent_loop.rs now JSON-encodes response_text before logging it, so the field is guaranteed to be exactly one line regardless of content. aichat.ts and runner.ts parse it back with JSON.parse instead of fragile lookahead regexes. While fixing this, found and fixed a related bug the review didn't catch: the tool-call-counting regex in runner.ts wasn't anchored to line start, so a [raw] line's embedded model text mentioning "[tool] create_node" was miscounted as a real tool call. Same fix applied to every other marker regex in parseTurnOutput for consistency, since all of them now share stdout with arbitrary model text. Extracted parseTurnOutput (runner.ts) and formatTurnLogLines (aichat.ts) as pure, exported functions so this parsing logic — where the bugs actually lived — is directly unit-testable without a daemon. Added 21 regression tests across two new test files covering multiline output, embedded markers, and the marker/tool-call interaction. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_012qFMbS5rEGLQL6CCkg6Xjs
b65fab7 to
57bf108
Compare
…le seeded-type list seed_prompt_nodes seeds nodes with root_node_type "agent-guidance", not "prompt" — the type was renamed under ADR-064/#1699's markdown-children refactor but the function name was never updated to match, which is exactly what caused a real bug: scripts/eval/preflight.ts's SEEDED_GUIDANCE_TYPES still listed "prompt" as a seeded type to verify guidance provenance against, so readGuidanceProvenance silently found zero prompt nodes on every run (the type genuinely doesn't exist anymore) while correctly finding the 8 seeded skills. Caught while running the actual Phase B baseline for #1764 against a fresh isolated daemon, where zero results for a type that should exist is exactly the "can't tell if this is the harness or reality" ambiguity #1764 exists to eliminate. Fixed both: the function now matches what it actually seeds, and the eval now checks "agent-guidance" (verified against a live daemon — 5 nodes: Core Identity, Workspace Context Template, Tool Strategy Guide, Response Formatting Rules, Tool Call Formatting) instead of a type that seeds nothing. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_012qFMbS5rEGLQL6CCkg6Xjs
…superseding the pre-#1800 e4b-1775-r3 figure Recorded against a purged, freshly-seeded isolated daemon (commit 57bf108) now that both remaining ADR-064 workstream gates have closed: #1811 (already resolved as a side effect of #1820) and #1800 (create_schema description-inference deletion, merged as #1833). Ran three full trials for variance characterization, as the issue requires, plus two routing-eval trials. Headline: 9/12 (median of 6/12, 9/12, 8/12 — mean 7.7/12), consistent with this suite's previously-documented 10/9/8 variance band. The committed file records run 2 with the other two summarized in other_runs_this_session and full detail in caveats, per the issue's "report enough repetitions to characterize variance, not a single number" requirement. Findings from reading the raw-output traces this issue's diagnostic harness now captures, not just the aggregate: - Scenario 6 (Update via indirect reference) failed in all three runs — the model asks the user for a node ID instead of calling resolve_query, despite resolve_query being confirmed present in the offered tool list every time. A genuine comprehension gap, not a routing or harness defect. Tracked by #1637. - create_schema JSON-truncation errors recurred across scenarios 3/8a/8b at 2/3 frequency each — the model emits genuinely malformed JSON on complex multi-field schemas ("EOF while parsing a value"), a real generation defect distinct from the #1800/coreValues class of prose-contradiction bug this suite previously found. - Zero "widget" placeholder leakage across all three runs' raw output and the full daemon log, per the issue's specific ask. Scenarios 4/8c/8d show no systematic INSTANCE-vs-TYPE regression. - Zero empty-generation exclusions and no uniformity-guard trips in any run — nothing here reads as a harness artifact. - Routing eval: 10/15 twice, with an IDENTICAL failure set both runs (not committed as a separate file here, but noted in caveats since the consistency across independent runs suggests systematic causes, and at least one failure looks like a scoring-heuristic gap rather than a model failure). scripts/results-e4b.trace.jsonl is the raw-output trace for the committed run, so any of the findings above can be re-verified from the actual model text without re-running the eval. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_012qFMbS5rEGLQL6CCkg6Xjs
Re-Review — PR #1831 (closes #1764)This is a re-review. The prior review (against Verdict: Approve. Both prior findings are genuinely closed, the fix is structurally stronger than a patch (moves the invariant to the Rust source instead of patching TS-side regexes), the new anchoring fix is correct with no legitimate-case regression, the rename is functionally complete, and the new tests directly regression-test both original bugs plus the new one found along the way. One trivial stale-comment nit remains. FindingsVerification of the two original criticals
New: tool-call-anchoring fix (found and fixed by the author, not the prior review)
|
malibio
left a comment
There was a problem hiding this comment.
Review status: APPROVE (posted as a comment-type review because GitHub blocks self-approval). See the detailed re-review comment above for full findings. Both prior critical findings (multiline raw_response truncation in aichat.ts, and the [tool]-substring delimiter-collision truncation in runner.ts) are verified closed by the JSON-encoding fix at the Rust source (agent_loop.rs), which is structurally stronger than a TS-side patch since it removes the invariant violation instead of working around it. The new tool-call-anchoring fix is correct with no legitimate multi-call-per-line regression (verified against how aichat.ts emits [tool] markers). The import.meta.main guard uses correct Bun semantics and does not break CLI usage via Bun.spawnSync. The seed_prompt_nodes -> seed_agent_guidance_nodes rename is functionally complete (one stale doc-comment reference noted as a nit, non-blocking). New regression tests directly target both original bugs plus the anchoring fix. results-e4b.json/.trace.jsonl are well-formed, small, and contain no sensitive data. Full test suite green: bun run test:scripts (64/64), bun run test (4112/4112), cargo test -p nodespace-agent --lib (371/371).
… reference results-e4b.json's scenario-6 caveat wrongly cited #1637 (closed) as already tracking the model-never-calls-resolve_query failure. #1637 was about resolve_query's return contract once called (fixed, confirmed working in this code — its own evidence cites 100% success on this exact phrasing when the tool IS called); the failure this baseline actually measured is the model not calling the tool at all, which #1637 did not observe under its own measurement conditions. Filed as its own issue, #1835, and corrected the caveat to explain the distinction plus separate run 1 (a cascade from scenario 4, a different failure) from runs 2-3 (the clean repro). Also fixes a doc comment in preflight.ts left referencing the old seed_prompt_nodes name after the prior commit renamed the function in prompt_assembler.rs but missed this comment — caught in re-review. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_012qFMbS5rEGLQL6CCkg6Xjs
Address-review summaryRan Review 1 (2 critical bugs: multiline raw-output truncation in Review 2 (re-review, verdict Approve) — found exactly one open item:
No recommendations skipped. Everything raised across both reviews is resolved. Verification:
Re-Review DecisionDecision: NO RE-REVIEW NEEDED Rationale: The only outstanding item across both prior reviews was a documentation-only nit (a stale comment, no logic change), already fixed and already covered by the second review's full-diff sanity pass before it approved. No new code paths were introduced by this pass — this is confirming and documenting that state, not making further changes requiring re-verification. |
Closes #1764