Support frozen Render `Retry` options in the snapshot test
This pull request was posted by Claude Code using claude-opus-5-5 on behalf of David.
Closes #12338
Render 1.7.0 makes Retry a frozen dataclass. The task-options snapshot test fails while changing max_retries, before it reaches its assertion. Replace the retry value through the mutable Options object with dataclasses.replace(); the existing rejection assertion remains in place.
This changes test setup only. Public behavior and the render>=1.2.0 dependency range stay the same. Docs N/A: no public API or behavior change.
Verification on Python 3.12:
- Reproduced the original pass with Render 1.2.0 and
FrozenInstanceErrorwith 1.7.0. - The changed test file passes all 9 tests with Render 1.7.0 and BlockBuster enabled.
- Render suite: 155 passed, 3 existing external-runtime skips on both 1.2.0 and 1.7.0, using the canary's
BLOCKBUSTER_ENABLED=false. - Focused Pyright passes on both SDK versions;
make format lintand the pre-commit complexity hook pass. - A separate MCP metadata-import BlockBuster failure in an isolated Render-only run also reproduces on unchanged main.
- After merging
main, the changed test file passes all 9 tests on Render 1.2.0 and 1.7.0.
PR decisions
2026-11-03 · pre-push review 1 of 3 at 370a74429f063869dd4ffef7e8c0387f4edad1f7 · iter -
- Decision: reserved
- Why: tree bbda3abcb71483a6057d6fca27e4b8617f4dfd4a; full branch 6b3df9a7ba0d3f36197df1b7ba6b59bf631cf879..370a74429f063869dd4ffef7e8c0387f4edad1f7
- Source: https://github.com/pydantic/pydantic-ai/tree/codex/12338-render-options-snapshot
- Session: 01a1a073-1e66-74ad-92cb-caf46ccd80fa
2026-11-03 · Keep the fix in the test setup · iter -
- Decision: Replace the frozen Retry value inside mutable Options; leave runtime code and dependency ranges unchanged
- Why: Current main passes with Render 1.2.0 and fails only during test setup with 1.7.0; the existing UserError snapshot assertion passes after replacement
- Source: https://github.com/pydantic/pydantic-ai/issues/12338
- Session: 01a1a073-1e66-74ad-92cb-caf46ccd80fa
2026-11-03 · pre-push review 1 of 3 at 370a74429f063869dd4ffef7e8c0387f4edad1f7 · iter -
- Decision: Dismissed nested Retry-copy coverage finding with a baseline mutation probe; candidate unchanged
- Why: The unchanged main test passes with _snapshot_options replaced by a shallow dataclasses.replace on Render 1.2.0 because its timeout mutation already forces rejection; the proposed repair does not remove existing deep-copy regression protection
- Source: https://github.com/pydantic/pydantic-ai/blob/6b3df9a7ba0d3f36197df1b7ba6b59bf631cf879/tests/harness/render/test_operation_backend.py
- Session: 01a1a073-1e66-74ad-92cb-caf46ccd80fa
2026-11-03 · adopted PR #12339 at 2026-11-03 · iter -
- Decision: Branch-context bootstrapped from existing PR + issue(s). Decisions prior to this entry are backfilled from resolved threads.
- Why: PR predates the branch-context setup
- Source: https://github.com/pydantic/pydantic-ai/pull/12339
- Session: c86fe447-01d1-4f8b-8ec3-61d2ecef9637
2026-11-03 · exempt delta at 81075bf2588567f966b46af3d7a6bcbd767bb45f · iter -
- Decision: Target-branch merge with no conflict resolution; no pre-push review dispatched
- Why: Chains from reviewed 370a74429f063869dd4ffef7e8c0387f4edad1f7; git diff upstream/main...370a744 equals git diff upstream/main...81075bf (main e2d290bea freshly fetched); tree 2b1663fd2edcc22a78fdc53b3893021941c292e3; budget 1 of 3 used
- Source: https://github.com/pydantic/pydantic-ai/pull/12339
- Session: c86fe447-01d1-4f8b-8ec3-61d2ecef9637
2026-11-03 · Package Label failures on 370a744 superseded · iter -
- Decision: No rerun; both failed runs were label-event runs from an intermediate label state, and the later label-event run passed
- Why: Job 125803766193 failed before any pkg label existed; job 125811033077 failed while test-suite and bug were both set; job 125811468212 passed on the final labels
- Source: https://github.com/pydantic/pydantic-ai/actions/runs/41604679937/job/125811468212
- Session: c86fe447-01d1-4f8b-8ec3-61d2ecef9637
2026-11-03 · Sprites stderr-timeout failure on 81075bf treated as new flake · iter -
- Decision: Reran failed jobs once; attempt 2 passed; not fixed in this PR
- Why: test_timeout_reads_stderr_back_over_a_slow_exec is timing-bound (timeout=0.5, exec_latency=1.5), unrelated to the Render test, absent from known flakes; main CI at e2d290bea green; PR changes no package versions
- Source: https://github.com/pydantic/pydantic-ai/actions/runs/41726667191/job/126233237022
- Session: c86fe447-01d1-4f8b-8ec3-61d2ecef9637
2026-11-03 · douwebot label and draft state owners · iter -
- Decision: Agent applies douwebot once the current head is green and self-reviewed; the PR stays draft until David marks it ready
- Why: David chose 'Workers label it' and: 'Do not mark a draft PR ready: David does that himself.'
- Source: https://github.com/pydantic/pydantic-ai/pull/12339
- Session: c86fe447-01d1-4f8b-8ec3-61d2ecef9637
2026-11-03 · final metadata check at 81075bf · iter -
- Decision: Kept: attribution line added as first body line. Rejected: replace chore with bug
- Why: Every recent merged dsfaccini PR opens with the aica-identity line; Package Label CI requires chore and forbids bug when test-suite is set (job 125811033077)
- Source: https://github.com/pydantic/pydantic-ai/actions/runs/41604543728/job/125811033077
- Session: c86fe447-01d1-4f8b-8ec3-61d2ecef9637
2026-11-03 · second-opinion review surface · iter -
- Decision: None; David marks the PR ready and merges it
- Why: David chose: "None" for the second opinion
- Source: https://github.com/pydantic/pydantic-ai/pull/12339
- Session: c86fe447-01d1-4f8b-8ec3-61d2ecef9637
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.
Summary by cubic
Closes #12338: fixes the task-options snapshot test to work with Render 1.7.0, where Retry is now a frozen dataclass.
Render 1.7.0 makes Retry immutable, so the test's max_retries mutation raised FrozenInstanceError before reaching its assertion. The test now replaces the Retry value inside the mutable Options object with dataclasses.replace(), keeping the existing rejection assertion intact. This is a test-setup-only change; public behavior and the render>=1.2.0 dependency range are unchanged.