Pin how each durable engine runs `BackgroundTools` and keeps a background task across a mid-run approval wait
Part of #14429 and #12291; doesn't close either.
Stacked on #14462 (base durable-scenario-support, itself on #14437). Retarget to main after those land.
Why we make these changes
BackgroundTools had tests under only one durable engine before this PR: a Temporal replay test. This adds a pinning table of what every engine does with it today, surveyed on #14429, in two scenarios:
runs_in_background: does a background tool call return at once, with its result arriving later?survives_approval_wait: does a background task keep running while the run waits mid-run for an approval? This is the V1 bar in #14429.
The cells are the BackgroundTools rows of #14462's SCENARIO_SUPPORT table in tests/capability_cases.py. This PR adds the tests that check each of those cells under each engine.
| Engine | runs_in_background | survives_approval_wait |
|---|---|---|
| Temporal | supported | supported (since #13215 added its waiter) |
| DBOS | supported | broken, #14443 (#14522 adds its waiter) |
| Prefect, Azure Durable Task, Render | supported | refused (UserError) |
| AWS Lambda | limited: runs in the foreground | limited: runs in the foreground, so nothing is in flight during the wait |
| Absurd, pgtask | limited: runs in the foreground by default | refused (UserError) |
Each cell fails once the engine's behavior changes:
- broken: the cell has to match #14443's error, so a fix makes it fail.
- refused: the error has to match the
raisesregex. - limited: the result has to come back inline.
New public surface
None. Tests only.
Verification
tests/harness/background_tools/test_durable_engines.py: one scripted model and one set of tools run under each engine's own test harness. In the approval scenario, research is held by a gate until the approval is asked for, so the call really is in flight during the wait. Absurd and pgtask need Postgres and run in CI only.
What changes for existing users
Nothing.
PR decisions
- 2026-11-24: scenario cells kept out of
ENGINE_SUPPORT. Adding aBackgroundToolsrow there fails #14437'stest_every_cell_is_a_case_with_callsand its exemption meta-test, and a V1brokencell would contradict D1 onceBackgroundToolsgetscalls. Agreed with the #14437 author. - 2026-11-24: the
limitedcells check only that the result comes back inline, and they tolerate #14445's foreground warning without requiring it, so either PR can land first.
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.
š¤ Generated with Claude Code