feat(0.31.0): backend-integrity guard#65
Merged
Conversation
…ent failure When a canonical eval reports "0/N passed", today there's no way to tell whether the agent failed every persona or whether the LLM backend was never actually called. We hit this running a 4-vertical parallel eval — legal-agent's default sandbox backend returned hard-coded 33-char strings from a "legal-sandbox-stub" model, and the eval dutifully reported 0/36 as if it were an agent-quality problem. Adds: - summarizeBackendIntegrity(records) → BackendIntegrityReport Inspects RunRecord token usage + costUsd. Verdict: 'real' | 'mixed' | 'stub'. Also flags uncosted records (output tokens but costUsd=0 — the gtm/creative cost-ledger gap we just found). - assertRealBackend(records, opts) — throws BackendIntegrityError on pure stub-mode runs. opts.allowMixed=false also rejects partial-failure runs (recommended for CI gates). - BackendIntegrityError extends AgentEvalError with code 'backend_integrity' so consumers can pattern-match. Pure functions, no I/O. 12 new tests cover stub/real/mixed/uncosted verdicts, the empty-input edge case, the partial-usage-propagation edge case, and the error shape. Total suite: 130 files, 1208 tests passing. Next step (separate PR): wire `assertRealBackend(records)` into each agent's canonical eval immediately after the records-write block so a misconfigured backend fails the run with a clear diagnosis instead of silently scoring 0%.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When a canonical eval reports `0/N passed`, today there's no way to tell whether the agent failed every persona or whether the LLM backend was never actually called. We hit this running a 4-vertical parallel eval — legal-agent's default sandbox backend returned hard-coded 33-char strings from a `legal-sandbox-stub` model and the eval reported `0/36` as if it were an agent-quality problem.
This PR adds a pure substrate primitive to differentiate the cases.
What's new
Pure functions, no I/O.
Test plan
Follow-up
Separate PR wires `assertRealBackend(records)` into each agent's canonical eval (tax/legal/gtm/creative) immediately after the records-write block, so a misconfigured backend fails the run with a clear diagnosis instead of silently scoring 0%.