Move `uv.lock` to `dbos` 3.4.0 and launch `DBOS` from a FastAPI lifespan in the production example
This pull request was posted by Claude Code using claude-opus-5-5 on behalf of David.
Why we make these changes
dbos 3.0 removed the admin server, together with its run_admin_server config key, and the fastapi parameter of DBOS. pip install "pydantic-ai[dbos]" already resolves dbos 3.4.0, so the production docs example fails today with TypeError: DBOS.__new__() got an unexpected keyword argument 'fastapi'. This PR moves uv.lock from dbos 2.29.0 to 3.4.0 (uv lock --upgrade-package dbos, which also adds croniter) and fixes what 3.0 broke in the repo. No issue; #12555 depends on this PR.
New public surface
none
User-visible behavior
docs/production.md now launches DBOS from a FastAPI lifespan, the replacement in dbos's upgrade guide. The lifespan form also works on dbos 2.x:
-app = FastAPI()
-DBOS(fastapi=app, config={'name': 'support', 'system_database_url': 'sqlite:///support.sqlite'})
+DBOS(config={'name': 'support', 'system_database_url': 'sqlite:///support.sqlite'})
+@asynccontextmanager
+async def lifespan(app: FastAPI) -> AsyncIterator[None]:
+ DBOS.launch()
+ try:
+ yield
+ finally:
+ DBOS.destroy()
+app = FastAPI(lifespan=lifespan)
Verification
- The 18 DBOS test fixtures go through
without_admin_server, which setsrun_admin_server=Falseonly on dbos<3. Thedbos>=2.10.0floor stays, and CI'slowestlegs install it. test_dbos.pyno longer skips as "DBOS is not installed" on dbos 2.10.0. Two tests skip below the dbos version they need: 2.14 for the serializer test, and 2.27 for the child-workflow recovery test. Before 2.27, a recovered parent re-runs a completed async child workflow's body, so achild_workflowtool's code outside steps runs again (dbos-inc/dbos-transact-py#762; bisected: 2.26.0 fails, 2.27.0 passes).- dbos 3.4.0: pyright passes on every changed file, the production example passes lint and pyright, and every changed DBOS test module passes (
test_dbos.py218/218).cancel_own_workflow'sreturnislax no cover, because a workflow that cancels itself doesn't return fromcancel_workflow_asyncon 3.x. - dbos 2.10.0 (
lowest-direct, Python 3.12):test_dbos.pyhas 214 passed, 4 skipped and 0 failed. The other 17 modules passed before themainmerge. With the helper, no admin server listens on port 3001. - The docs example runs end to end on 3.4.0 and 2.10.0 with
TestModelthroughTestClient. No other API that dbos 3.0 removed is used in the repo.
What changes for existing users
The production example works again on dbos 3.x; library code is unchanged.
PR decisions
2026-11-04 · admin server off only on dbos<3, via one test helper · iter -
- Decision: tests/conftest.py::without_admin_server adds run_admin_server=False when dbos<3 and returns the config unchanged on 3.x; typed via a TYPE_CHECKING-only DBOSConfig subclass, no ignore or cast
- Why: floor stays dbos>=2.10.0, where the key defaults to True and 3.0 removed it; version gate follows the Version(version('temporalio')) precedent in tests/durable_exec/temporal/_shared.py
- Source: https://github.com/pydantic/pydantic-ai/tree/dbos-3-migration
- Session: e5d468cf-2ff1-4044-99d4-2b050bec08eb
2026-11-04 · production example uses a FastAPI lifespan · iter -
- Decision: DBOS(config=...) plus a lifespan that runs DBOS.launch()/DBOS.destroy(), replacing DBOS(fastapi=app)
- Why: dbos 3.0 removed the fastapi parameter; the lifespan form is dbos's documented replacement and also works on 2.x, so no version note is needed
- Source: https://docs.dbos.dev/python/upgrading
- Session: e5d468cf-2ff1-4044-99d4-2b050bec08eb
2026-11-04 · pre-push review 1 of 3 at 5a10bfe9782d822c2a573f260a99bc7e86898244 · iter -
- Decision: reserved: fresh haiku claude -p in a policy-base checkout of 1baa00fcf2, read-only tools, no fan-out
- Why: tree 5f0b336d70e3a5b57dbf2198ae33b982916b6539; scope 1baa00fcf2..5a10bfe97 (full branch); first review
- Source: https://github.com/pydantic/pydantic-ai/tree/dbos-3-migration
- Session: e5d468cf-2ff1-4044-99d4-2b050bec08eb
2026-11-04 · pre-push review 1 of 3 at 5a10bfe9782d822c2a573f260a99bc7e86898244 · iter -
- Decision: outcome: (4) docstring reworded to current condition in 5beb49cec; (1) invalid: lock changes no package metadata, websockets stays installed via google-genai/prefect/clai2, 3.4.0 test_dbos ran 0 skips; (2) CODER_DBOS in tests/harness/coder/test_durable_engines.py starts a 2.x admin server, pre-existing on main, outside the named fold set, reported to manager; (3) docs/durable_execution/dbos.md uses dbos's own default, works on 2.x and 3.x, skip
- Why: reviewed tree 5f0b336d70e3a5b57dbf2198ae33b982916b6539; push head 5beb49cec differs by a docstring-only delta (exempt: comments/docstrings only, no docs page), chained from reviewed 5a10bfe97
- Source: https://github.com/pydantic/pydantic-ai/tree/dbos-3-migration
- Session: e5d468cf-2ff1-4044-99d4-2b050bec08eb
2026-11-04 · CODER_DBOS admin server on dbos 2.x left as is · iter -
- Decision: skip: tests/harness/coder/test_durable_engines.py CODER_DBOS keeps dbos's default admin server
- Why: net-neutral: dbos 2.x default behavior, same as docs/durable_execution/dbos.md; after this PR it only occurs on the lowest leg
- Source: https://github.com/pydantic/pydantic-ai/pull/12568
- Session: e5d468cf-2ff1-4044-99d4-2b050bec08eb
2026-11-04 · test_dbos.py module skip on dbos 2.10.0 split to a follow-up PR · iter -
- Decision: not folded; a follow-up PR after this one merges fixes tests/durable_exec/test_dbos.py skipping entirely on dbos 2.10.0
- Why: pre-existing on main (DBOSDefaultSerializer import missing in 2.10); maintainer chose a separate PR
- Source: https://github.com/pydantic/pydantic-ai/pull/12568
- Session: e5d468cf-2ff1-4044-99d4-2b050bec08eb
2026-11-04 · test_dbos.py floor gap folded into this PR · iter -
- Decision: fold: test_dbos.py gates on pytest.importorskip('dbos') so a missing symbol fails loudly instead of skipping as 'DBOS is not installed', and only test_dbos_records_what_a_stream_produced_before_failing skips below dbos 2.14, which added serialize_exception and DBOSDefaultSerializer
- Why: David's decision via the manager: reproduces on main, test-only, serves the same goal (the suite runs across the declared dbos range), and this PR's 2.10 verification claim needs it
- Source: https://github.com/pydantic/pydantic-ai/pull/12568
- Session: e5d468cf-2ff1-4044-99d4-2b050bec08eb
- Supersedes: test_dbos.py module skip on dbos 2.10.0 split to a follow-up PR
2026-11-05 · pre-push review 2 of 3 at 6326f72d9a5af77e744e63f420e133fd9c097b29 · iter -
- Decision: reserved: fresh haiku claude -p in a policy-base checkout of 39c01ed97, read-only tools, no fan-out
- Why: tree 64f21f135041f61a0ebf218660b28a8c62f12c42; follow-up scope 5a10bfe97..5dc9cc69a (test_dbos.py floor fold, coverage pragma, docstring) plus a clean merge of main 39c01ed97 (exempt); prior finding 4 to verify
- Source: https://github.com/pydantic/pydantic-ai/pull/12568
- Session: e5d468cf-2ff1-4044-99d4-2b050bec08eb
2026-11-05 · pre-push review 2 of 3 at 6326f72d9a5af77e744e63f420e133fd9c097b29 · iter -
- Decision: outcome: (1) without_admin_server docstring reworded for clarity in da25335d02; (2) cancel comment narrowed to what is verified (3.4.0 uncovered in CI; 2.29 covered on main; 2.10 source has no preemptive cancellation, so cancel_workflow_async returns); reviewer's lowest-leg evidence did not apply since test_dbos.py skipped on that leg before this fold; prior finding 4 confirmed fixed
- Why: reviewed tree 64f21f135041f61a0ebf218660b28a8c62f12c42; push head da25335d02 differs by comment/docstring-only lines (exempt), chained from reviewed 6326f72d9a
- Source: https://github.com/pydantic/pydantic-ai/pull/12568
- Session: e5d468cf-2ff1-4044-99d4-2b050bec08eb
2026-11-05 · keep folding the test_dbos.py floor fix after the 2.10 child-workflow failure · iter -
- Decision: keep folding: bisect dbos 2.10..2.29 for the first version where test_dbos_child_workflow_tool_survives_recovery passes and gate it there like the 2.14 gate; MCP initialize timeouts are load flakes, not gated
- Why: David via the manager, 2026-11-05; chosen over splitting after the stop-condition report
- Source: https://github.com/pydantic/pydantic-ai/pull/12568
- Session: e5d468cf-2ff1-4044-99d4-2b050bec08eb
- Supersedes: stop-condition report: test_dbos_child_workflow_tool_survives_recovery fails on dbos 2.10.0
2026-11-05 · child-workflow recovery test gated at dbos 2.27 · iter -
- Decision: skipif dbos<2.27 on test_dbos_child_workflow_tool_survives_recovery, same shape as the 2.14 gate; reason cites dbos-inc/dbos-transact-py#762
- Why: bisect over 2.10.0..2.29.0 (each version layered with uv run --with, test in isolation, one retry): 2.26.0 fails, 2.27.0 passes; 2.27.0's 'Improve Behavior Consistency' (dbos-inc/dbos-transact-py#763) closes #762, a completed async workflow re-running its body when invoked again
- Source: https://github.com/dbos-inc/dbos-transact-py/issues/762
- Session: e5d468cf-2ff1-4044-99d4-2b050bec08eb
2026-11-05 · dbos<2.27 re-runs a child_workflow tool body on recovery · iter -
- Decision: recorded and reported only; no library or floor change in this PR
- Why: on dbos 2.10-2.26, a resumed parent invoking its completed child workflow re-runs the child's body (the tool body; steps still replay), per dbos-inc/dbos-transact-py#762; floor question is David's
- Source: https://github.com/dbos-inc/dbos-transact-py/issues/762
- Session: e5d468cf-2ff1-4044-99d4-2b050bec08eb
2026-11-05 · pre-push gate: 2.27 gate delta exempt · iter -
- Decision: no review dispatched for cea2c0fb2; exempt as a test-harness repair, chained from reviewed 6326f72d9a
- Why: delta since reviewed tree is test code only (one skipif plus comment/docstring lines); established expectation: the test passes on dbos>=2.27 (2.27.0/2.29.0/3.4.0 verified) and the gate names the dbos fix; affected tests run on 2.10.0 and 3.4.0
- Source: https://github.com/pydantic/pydantic-ai/pull/12568
- Session: e5d468cf-2ff1-4044-99d4-2b050bec08eb
2026-11-05 · dbos floor stays at 2.10.0 despite the <2.27 child_workflow re-run · iter -
- Decision: no floor change: keep dbos>=2.10.0; tell the child_workflow author on #12445 and on the open PRs whose DBOS path invokes a child workflow
- Why: David via the manager, 2026-11-05
- Source: https://github.com/dbos-inc/dbos-transact-py/issues/762
- Session: e5d468cf-2ff1-4044-99d4-2b050bec08eb
- Supersedes: dbos<2.27 re-runs a child_workflow tool body on recovery
2026-11-05 · second opinion: none · iter -
- Decision: no additional review surface after the clean douwebot approval on cea2c0fb2
- Why: David via the manager, 2026-11-05; David approves next, which starts CI Review
- Source: https://github.com/pydantic/pydantic-ai/pull/12568
- Session: e5d468cf-2ff1-4044-99d4-2b050bec08eb
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.