Skip to content

Make the agent scenario matrix (aichat-matrix.ts) an assertable CI eval, not just an observation harness #1364

Closed

Description

@malibio

Overview

scripts/aichat-matrix.ts runs the #1329 end-to-end scenario matrix (greeting, schema creation, instance creation, list/query, update, empty-result, multi-type CRUD) and captures per-scenario results for a human to read — but its expect field is a prose string, not a machine assertion. It cannot fail CI on a behavioral regression.

Now that the full skill-mediated routing architecture has shipped (ADR-036: #1351, #1352, #1353, #1355, #1356, #1357), end-to-end agent behavior is the one layer without an enforced eval. This issue turns the matrix into assertable pass/fail, complementing the two evals that already exist.

Existing eval coverage (do not duplicate)

These are distinct layers: parser tests assert tool-call shape, routing-eval asserts skill selection, and this asserts the agent did the right thing end-to-end (right tool fired the right number of times with the right effect).

Problem Statement

  • aichat-matrix.ts GROUPS[].expect are descriptive strings ("exactly one create_schema, no extra related types"), parsed by humans, never asserted.
  • A regression in agent behavior (e.g. proactive extra schema creation, retry-on-empty, wrong tool) would not fail any automated check.

Proposed Solution

Add a machine-checkable expectation per scenario and a pass/fail runner (mirror routing-eval.ts's structure: per-case assertions, exit 0/1, optional baseline regression via an env-set baseline file). Expose as bun run eval:agent (or fold into the existing matrix script with an --assert mode).

Assertion model (account for the pull routing flow)

Under ADR-036's pull model the model calls search_skills before acting, so search_skills will appear in the tool sequence. Assertions must check for the TARGET tool, not total tool count. For each scenario assert on a small structured expectation, e.g.:

  • noTools (conversational) — no graph-action tools fired (search_skills tolerated only if the model over-routes; ideally none on greetings)
  • toolOnce: "create_schema" — the target tool fired exactly once (ignoring search_skills)
  • toolSequence: ["search_nodes", "update_*"] — search-then-update ordering
  • noRetry — the same failing tool is not called repeatedly (empty-result scenario)
  • noExtraTypes — exactly one create_schema, not several (no proactive related-type creation)

Scenarios to assert (from the current matrix)

  1. Greeting ("Hi there") → no graph-action tools, short reply
  2. Capability ("What can you do?") → no tools, concise, no trailing reasoning
  3. Schema creation ("Create an invoice tracking database") → create_schema exactly once, no extra types
  4. Instance creation ("Add an invoice for $500 due next Friday") → create_node against the new schema
  5. List/query ("List all my invoices") → search_nodes (type-filtered)
  6. Update ("Mark the $500 invoice as paid") → search-then-update
  7. Empty-result ("Find my invoice for one million dollars") → single statement, no retry
  8. Multi-type CRUD (book + contact create/instance/query) → one create_schema each, instances created, cross-type query

Acceptance Criteria

  • Each scenario has a structured, machine-checkable expectation (not a prose string).
  • A runner asserts per-scenario pass/fail and exits non-zero on any failure.
  • Assertions check for the target tool (tolerating the search_skills routing call), not raw tool count.
  • The empty-result and no-extra-types scenarios are explicitly asserted (the historically-regressing behaviors).
  • Exposed as a bun script; runnable locally and in CI against the upgraded engine.
  • Baseline-comparison mode (like routing-eval.ts) records and diffs results.
  • Documented in nodespace-docs/development/ alongside the routing-eval and prompt-dump tools.
  • Code passes bun run quality:fix.

Technical Specifications

Reference Files

Notes

Related Issues

Non-Goals

Activity

  1. malibio commented on Jul 5, 2026

    @malibio
    CollaboratorAuthor

    Architecture-review cross-link: automating agent-flow stuck-state coverage as e2e with a stub model is tracked in #1526, and the CI that would run it in #1495. This scenario matrix is the natural content for that suite.

  2. malibio commented on Jul 11, 2026

    @malibio
    CollaboratorAuthor

    Frontend baseline: 159 test files passed, 4031 tests passed (44.74s)

  3. self-assigned this
    on Jul 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions