Name the cause of a failed CI OpenCode run, and accept a `PR Review Checks` answer in one code fence

Merged
DS
22d ago
+267-56

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 Checks and 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.message and response.body never print.
  • check_result strips 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 names json_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_reason in douwebot_opencode_result.py holds that rule. It never prints model text, because the answer can hold a private report.

Verification

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 -

2026-11-11 · pre-push review 1 of 3 at 2e0a9b4c0b62573ab2aa9f0e69caa0fc5e233af4 · iter -

2026-11-11 · pre-push review 2 of 3 at 3c049d3b02f5c308b8e6191eb32a340aff188695 · iter -

2026-11-11 · pre-push review 2 of 3 at 3c049d3b02f5c308b8e6191eb32a340aff188695 · iter -

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 -

2026-11-11 · pre-push review 3 of 3 at de8f06bca03e680b80f4ca16dc64821dc5285910 · iter -

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.

https://claude.ai/code/session_01NXARKfdj4w2o6rhpQuEJaz