Name the cause of a failed CI OpenCode run, and accept a `PR Review Checks` answer in one code fence
This pull request was posted by Claude Code using claude-opus-5-5 on behalf of David.
Why we make these changes
After #13158 merged, the first fresh PR Review Checks run on main (run 43074411511) fell back from OpenCode Go to DeepInfra, and every DeepInfra run exited 1 with no error text in the job log. Once the DeepInfra key was replaced, a rerun of the same jobs got DeepInfra answers, but all three checks failed with the generic The review answer does not match its schema. Both failures hide their cause. With this PR, the job log names it in both places, without printing model or provider text. A local run against DeepInfra returned the answer in a Markdown code fence, so PR Review Checks now also accepts an answer that one fence wraps whole.
New public surface
None. CI scripts only.
User-visible behavior
+OpenCode run on opencode-go/deepseek-v4.1-flash failed with error type provider.go-limit, status 429.
-OpenCode Go refused the run before its first step (provider.go-limit); retrying on DeepInfra.
+OpenCode Go refused the run before its first step; retrying on DeepInfra.
+OpenCode run on deepinfra/deepseek-ai/DeepSeek-V4.1-Flash failed with error type <type>, status <status>.
-ValueError: The review answer does not match its schema
+ValueError: The review answer was rejected: validation failed: json_invalid
-OpenCode threat detection attempt 1 failed: ValueError; retrying
+OpenCode threat detection attempt 1 failed: OpenCode review did not stop normally
- The failed-run line covers Go and DeepInfra at all three call sites: douwebot's OpenCode fallback,
PR Review Checksand gh-aw threat detection. A type prints only when it fully matches[a-z][a-z.-]*, the shape of every type OpenCode 2.2.5 sets (to-session-error.ts).error.messageandresponse.bodynever print. check_resultstrips one Markdown code fence that wraps the whole answer before validation, with the same rule as #13172 for douwebot. Text before or after the fence still fails, and the job log then namesjson_invalid.- A rejected answer names one of three things: a fixed message from
final_text, the sorted validation error types, or the exception's class name.rejection_reasonindouwebot_opencode_result.pyholds that rule. It never prints model text, because the answer can hold a private report.
Verification
test_go_failure_stays_on_goandtest_deepinfra_failure_names_its_error_type: what a failed Go or DeepInfra run prints, including a type with other characters, a malformed or undecodable stream and a timeout.test_answer_in_one_code_fence_is_unwrapped, andtest_rejected_answer_under_the_budget_fails_with_its_reasonandtest_undecodable_stream_names_only_its_error_type: the fence rule and thecheck_resultreasons.- The same paths through
PR Review Checksand threat detection (failed run, rejected stream).
bots.yml, pr-review-checks.yml and their scripts run from the default branch, so this PR cannot exercise its own change. PR Review Checks stays red on this PR for the same reason. The first real run is after merge.
What changes for existing users
Nothing for library users. In CI, job logs name failure causes, and a PR Review Checks answer in one code fence passes validation.
PR decisions
2026-11-11 · Fallback line no longer repeats the error type · iter -
- Decision: The fallback line reads 'OpenCode Go refused the run before its first step; retrying on DeepInfra.' without the type, because the failure line just above it names the type and status
- Why: Every failed run now prints its own type line, so repeating the type would print it twice
- Source: https://github.com/pydantic/pydantic-ai/actions/runs/43074411511
- Session: 780cb84b-e583-4cde-b4fd-5145d534dbd2
2026-11-11 · pre-push review 1 of 3 at 2e0a9b4c0b62573ab2aa9f0e69caa0fc5e233af4 · iter -
- Decision: reserved; dispatched (fresh claude -p haiku from policy-base d0ecbce70)
- Why: reviewed tree c65054b534068330cda9320ff8480041a8db2f35; scope d0ecbce706b9e60ce7d066c7ae413c85f181f514..2e0a9b4c0b62573ab2aa9f0e69caa0fc5e233af4 full branch; first review
- Source: https://github.com/pydantic/pydantic-ai/tree/opencode-run-error-type
- Session: 780cb84b-e583-4cde-b4fd-5145d534dbd2
2026-11-11 · pre-push review 1 of 3 at 2e0a9b4c0b62573ab2aa9f0e69caa0fc5e233af4 · iter -
- Decision: two findings, both dismissed with evidence: bool status (OpenCode sets status only from reason.http?.status, a number) and an unbounded ERROR_TYPE length (OpenCode sets type only from short fixed literals; a cap changes nothing for real types)
- Why: reviewed tree c65054b534068330cda9320ff8480041a8db2f35; scope d0ecbce70..2e0a9b4c0 full branch; light tier claude -p haiku from policy-base d0ecbce70; policy-base clean and unchanged after review
- Source: https://github.com/pydantic/pydantic-ai/tree/opencode-run-error-type
- Session: 780cb84b-e583-4cde-b4fd-5145d534dbd2
2026-11-11 · pre-push review 2 of 3 at 3c049d3b02f5c308b8e6191eb32a340aff188695 · iter -
- Decision: reserved; dispatched (fresh claude -p haiku from policy-base d0ecbce70)
- Why: reviewed tree 26e27fcbc437ee01680947355fabb9ede1041b1b; follow-up scope 2e0a9b4c0..3c049d3b0, full branch d0ecbce706b9e60ce7d066c7ae413c85f181f514..3c049d3b0 as context
- Source: https://github.com/pydantic/pydantic-ai/pull/13182
- Session: 780cb84b-e583-4cde-b4fd-5145d534dbd2
2026-11-11 · pre-push review 2 of 3 at 3c049d3b02f5c308b8e6191eb32a340aff188695 · iter -
- Decision: remediated in 173b23a6f: final_text docstring now limits the fixed-message claim to its own ValueErrors; workflows AGENTS.md also names the exception class name case
- Why: reviewed tree 26e27fcbc437ee01680947355fabb9ede1041b1b; follow-up scope 2e0a9b4c0..3c049d3b0; light tier claude -p haiku from policy-base d0ecbce70; policy-base clean after review
- Source: https://github.com/pydantic/pydantic-ai/pull/13182
- Session: 780cb84b-e583-4cde-b4fd-5145d534dbd2
2026-11-11 · exempt delta 3c049d3b0..173b23a6f · iter -
- Decision: pushed without a third review
- Why: chains from reviewed 3c049d3b0; delta is one docstring line plus one workflows AGENTS.md sentence applying review 2's exact findings; it touches only the documentation rung, changes no executable line, and makes the docs match the reviewed code
- Source: https://github.com/pydantic/pydantic-ai/pull/13182
- Session: 780cb84b-e583-4cde-b4fd-5145d534dbd2
2026-11-11 · PR Review Checks strips one whole-answer fence; douwebot path untouched · iter -
- Decision: David: check_result strips exactly one Markdown code fence that wraps the whole answer before ModelResult validation, with #13172's pattern; 'Prose before or after the fence still fails.' Do not touch review_result, which #13172 owns; do not supersede or comment on #13172; the strip lives in run_pr_review_check.py
- Why: Keeps one fence rule across both parsers and avoids a merge conflict with #13172; the rejection logging shows whether prose before the fence happens in real runs
- Source: https://github.com/pydantic/pydantic-ai/pull/13172
- Session: 780cb84b-e583-4cde-b4fd-5145d534dbd2
2026-11-11 · pre-push review 3 of 3 at de8f06bca03e680b80f4ca16dc64821dc5285910 · iter -
- Decision: reserved; dispatched (fresh claude -p opus from policy-base d0ecbce70)
- Why: reviewed tree 9465ef6df39e37f811f237994232fc9efc0835a1; follow-up scope 173b23a6f..de8f06bca, full branch d0ecbce706b9e60ce7d066c7ae413c85f181f514..de8f06bca as context; strong tier after two hosted-reviewed pushes
- Source: https://github.com/pydantic/pydantic-ai/pull/13182
- Session: 780cb84b-e583-4cde-b4fd-5145d534dbd2
2026-11-11 · pre-push review 3 of 3 at de8f06bca03e680b80f4ca16dc64821dc5285910 · iter -
- Decision: no findings; current at de8f06bca03e680b80f4ca16dc64821dc5285910
- Why: reviewed tree 9465ef6df39e37f811f237994232fc9efc0835a1; follow-up scope 173b23a6f..de8f06bca; strong tier claude -p opus from policy-base d0ecbce70; douwebot's UnicodeDecodeError finding verified; budget spent
- Source: https://github.com/pydantic/pydantic-ai/pull/13182
- Session: 780cb84b-e583-4cde-b4fd-5145d534dbd2
2026-11-11 · Shared fence helper skipped in this PR · iter -
- Decision: skip douwebot's Optional suggestion to move the fence regex into one helper in douwebot_opencode_result.py; a shared helper for check_result and review_result is a follow-up after both PRs merge
- Why: deliberate scope boundary: the strip lives in run_pr_review_check.py so this PR does not conflict with #13172, per the fence decision above
- Source: https://github.com/pydantic/pydantic-ai/pull/13182#discussion_r4543557534
- Session: 780cb84b-e583-4cde-b4fd-5145d534dbd2
2026-11-11 · exempt delta de8f06bca..3b5054616 · iter -
- Decision: merged upstream/main without conflicts; pushed without review (budget spent)
- Why: chains from reviewed de8f06bca; target-branch merge with no conflict resolution; git diff main...de8f06bca equals git diff main...3b5054616 with main freshly fetched
- Source: https://github.com/pydantic/pydantic-ai/pull/13182
- Session: 780cb84b-e583-4cde-b4fd-5145d534dbd2
Checklist
- No breaking changes in accordance with the version policy.
- Any permitted compatibility impact has a label, warning, migration and release note, and an exact API-check waiver if the gate reports it.
- PR title is fit for the release changelog.