Pin how each durable engine runs `BackgroundTools` and keeps a background task across a mid-run approval wait

Merged
DO
10d ago
+490-1

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.

Engineruns_in_backgroundsurvives_approval_wait
Temporalsupportedsupported (since #13215 added its waiter)
DBOSsupportedbroken, #14443 (#14522 adds its waiter)
Prefect, Azure Durable Task, Rendersupportedrefused (UserError)
AWS Lambdalimited: runs in the foregroundlimited: runs in the foreground, so nothing is in flight during the wait
Absurd, pgtasklimited: runs in the foreground by defaultrefused (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 raises regex.
  • 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 a BackgroundTools row there fails #14437's test_every_cell_is_a_case_with_calls and its exemption meta-test, and a V1 broken cell would contradict D1 once BackgroundTools gets calls. Agreed with the #14437 author.
  • 2026-11-24: the limited cells 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