fix: validate structured output across providers#44
Merged
Conversation
b30b75e to
809ae33
Compare
e43a071 to
54a7f40
Compare
ebarti
added a commit
that referenced
this pull request
Jul 10, 2026
## What - reject blank task, session, MCP, tool, artifact, and result identities - require positive execution hints and finite non-negative budgets/counts - reject ambiguous session start/resume state, duplicate MCP names, and conflicting tool filters - canonicalize sequence value fields while rejecting scalar strings - add AgentResult.is_success - represent unknown Usage and cost as None while preserving reported zero - preserve partial provider telemetry without inventing cache counts - fix Claude resume result fallback when the SDK omits its session id ## Why Several invalid or ambiguous states were constructible, and missing telemetry was indistinguishable from a real zero. ## Root cause The frozen dataclasses provided immutability but did not own their cross-field invariants, while adapter coercion helpers normalized missing and malformed counters to zero. ## Checks - 321 passed, 12 skipped - independent domain audit completed - ruff check src tests - mypy - uv lock --check - wheel and sdist build ## Compatibility This intentionally rejects previously accepted invalid constructor inputs and changes unknown Usage fields from zero to None. ## Stack - Base: #44 - Next: #46
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.
What
Why
Vendor schema requests are not proof that a returned value conforms. Each adapter previously accepted any parseable JSON as success.
Root cause
Provider translators stopped after native output or JSON parsing and never applied the requested schema locally.
Checks
Stack