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
test(agent): enforce the two-error composition contract instead of documenting it
The riskiest part of this PR is the #964 reconciliation (51c8b26), where two
error models were fused by hand. The contract that came out of it — one error
must satisfy errors.As(*TextGenError) for the label, errors.Is(sentinel) for
the ctx branches, and errors.As(*TextGenerationError) for the timeout
diagnostic — lived only in comments. Nothing failed if a return dropped its
evidence wrapper; timeoutDiagnostic would just quietly fall to its
no-information branch ("provider produced no output") with a blank stderr row.
All three of the serious bugs in this PR came from that seam, so the durable
fix is to make it fail loudly rather than rely on a reviewer noticing.
- assertComposition() asserts all three lookups at once, applied to the
CLIMissing and AuthFrom401 cases across all four injectable providers.
- A new CanceledCarriesSentinelAndEvidence case covers the ctx path, which had
zero coverage in the matrix: sentinel reachable, evidence populated, and the
captured stderr and partial-stdout byte count both correct. This is the path
where classification is meaningless, so evidence is the entire payload.
Mutation-verified: dropping withEvidence from the classified-failure return in
HandleTextGenResult now fails every provider with
"errors.As(*TextGenerationError) failed — evidence lost, timeout diagnostic
degrades silently". Before this commit the suite stayed green.
Test-only; no production change.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
0 commit comments