Skip to content

[all] replay committed histories only from each plugin's current major - #565

Merged
campoy merged 6 commits into
mainfrom
replay/major-scoped-histories
Nov 16, 2026
Merged

campoy merged 6 commits into
mainfrom
replay/major-scoped-histories

Conversation

@campoy

@campoy campoy commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

What was changed

Replay is promised only within a major version now. A history recorded on a 1.x release must replay on every later 1.x release, and nothing is promised from 1.x to 2.x. So why does CI still replay 1.x histories on code that's heading to 2.0? It shouldn't, and this PR stops it.

  • Each plugin's committed histories move into a folder per major, histories/<major>.x/.
  • Each replay test gets a REPLAY_MAJOR constant (ReplayMajor in C#) and loads only that folder. Older majors' folders stay in the repo, but they don't replay.
  • AGENTS.md gets the rule, next to the one about gating history changes.

A plugin's current major is the major of its next release. Here's what I used:

Plugin Latest release Current major Replays Kept, not replayed
python/openai_agents 1.1.0, then Breaking: commits 2 4 histories in 2.x/ 12 in 1.x/
typescript/openai-agents 1.24.0 on npm (published from the SDK repo), then Breaking: commits 2 1 in 2.x/ 4 in 1.x/
typescript/vercel-ai-sdk 1.0.0, then Breaking: commits 2 none 3 in 1.x/
python/google_genai 1.0.0rc1 1 1 in 1.x/ 1 in 0.x/
typescript/strands-agents none from this repo (npm has 1.21.0 to 1.24.0 from the SDK repo); 2.0.0 next 2 4 in 2.x/ 1 in 1.x/
typescript/google-adk 0.1.0; 1.0.0 next 1 2 re-recorded in 1.x/ 2 in 0.x/
python/google_adk 0.0.1; 1.0.0 next 1 none 7 in 0.x/
python/strands_agents 0.1.0; 1.0.0 next 1 4 in 1.x/ 5 in 0.x/
python/deepagents 0.0.3; 1.0.0 next 1 none 3 in 0.x/
java/google-adk, dotnet/microsoft-agent-framework, python/microsoft_agent_framework below 1.0, not 1.0 next 0 all, in 0.x/ none

A history recorded on main before a breaking fix goes with the release whose behavior it recorded. So the five OpenAI Agents Python histories from before #204, #373 and #426, and the four TypeScript ones from before #373, are 1.x histories. Strands Python's four MCP histories were recorded after #190 moved its MCP Activities to temporalio-mcp, code that 0.1.0 never had, so they're 1.x histories too. Strands TypeScript's hello-agent-before-model-config was recorded before #158, so it has 1.24.0's behavior and is a 1.x history. Its other four were recorded after #158, so they're 2.x.

Tests that replayed only older-major histories go: Vercel AI SDK's three committed-history tests, Google GenAI's legacy_ascii_files replay, Google ADK Python's two replay tests with their workflows, Strands Python's test_legacy_history_replay.py and test_model_context_overflow_legacy_replay.py, Deep Agents' test_legacy_cache_replay.py, and Strands TypeScript's test that its history from before #158 fails to replay. The OpenAI Agents lists keep only the current major's files. Google ADK TypeScript's replay test checks a live run against a checked-in fixture, so I recorded its two fixtures again into 1.x/ with its own UPDATE_ADK_HISTORIES=1.

go/googleadk doesn't change: it has no committed histories, and its replayer tests replay runs the same test just recorded.

Why?

We decided that replay is promised only within a major. But CI still replayed 1.x histories, so a fix for 2.0 had to keep 1.x runs replaying behind a patch, even though we don't promise that. With this PR, the next one can remove those patches from OpenAI Agents Python before 2.0.0 ships.

Checklist

  1. No issue.

  2. How was this tested:

    • Python, for each of the six plugins: make sync, make format, make lint, and the tests that read committed histories (3, 7, 43, 11, 4 and 42 passed).
    • TypeScript, for each of the four plugins, in Docker with Node 24: make sync, make lint, and the test files that read committed histories.
    • check_conventions.py passes, and detect_changes.py selects the 12 plugins.
    • After moving the 1.0-next plugins to major 1: Google ADK Python make format, make lint and make test (321 passed, 6 skipped); Google ADK and Strands TypeScript make lint and their replay tests, in Docker with Node 24.
    • After moving Strands Python and Deep Agents to major 1 and merging main: make lint and make test for both (277 and 261 passed).
    • After moving Strands TypeScript to major 2: make lint and its two replay test files, in Docker with Node 24 (8 passed).
    • Java and .NET didn't run locally (no JDK or .NET SDK on this machine). CI runs them.
  3. Any docs updates needed? AGENTS.md has the rule. The Microsoft Agent Framework Python histories README says where recordings go now.

Replay is promised only within a major version. Each plugin's committed
histories now live in a folder per major, `histories/<major>.x/`, and a
`REPLAY_MAJOR` constant in its replay tests picks the one folder that
replays. Older majors' folders stay in the repo.

AGENTS.md gets the rule, next to the one about gating history changes.
Strands TypeScript, Google ADK Python and Google ADK TypeScript ship 1.0
next, so their current major is 1.

- Strands TypeScript has no release from this repository, so its five
  histories are on the 1.x line: they move to 1.x/ and keep replaying.
- Google ADK Python's seven histories record 0.0.1's behavior, so they
  stay in 0.x/, and the two tests that only replayed them go, with their
  workflows.
- Google ADK TypeScript's two fixtures record 0.1.0, so they stay in 0.x/.
  Its replay test records them again into 1.x/ with
  UPDATE_ADK_HISTORIES=1, as it does for any refresh.
Both ship 1.0 next, so their current major is 1.

- Strands Python: the four MCP histories recorded on main after the MCP
  Activities moved to temporalio-mcp go to 1.x/ and keep replaying. The
  five recorded on 0.1.0's code stay in 0.x/, and the two test files that
  only replayed them go.
- Deep Agents: all three histories were recorded on 0.x code, so they stay
  in 0.x/, and test_legacy_cache_replay.py, which only replayed them, goes.
@campoy
campoy marked this pull request as ready for review November 16, 2026 16:10
@campoy
campoy requested a review from a team as a code owner November 16, 2026 16:10
@campoy campoy changed the title Replay committed histories only from each plugin's current major [all] replay committed histories only from each plugin's current major Nov 16, 2026
npm already has @temporalio/strands-agents 1.24.0 from the SDK repo, so
its next release is 2.0.0, not 1.0.0. The four histories recorded after
#158 move to 2.x/. The one recorded before #158 has 1.24.0's behavior,
so it stays in 1.x/ and no longer replays, and the test that checked it
fails goes away.
@campoy
campoy merged commit 6f0ef04 into main Nov 16, 2026
131 of 133 checks passed
@campoy
campoy deleted the replay/major-scoped-histories branch November 16, 2026 18:15

@DABH DABH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR moves the files correctly and CI is green. My main questions are about which major some histories belong to: Strands TypeScript's REPLAY_MAJOR, and the histories that now sit in a current major's folder but are asserted to fail replay. The rest is about replay coverage on the majors about to ship, plus a few leftovers. Details inline. Thanks!


// Replay is promised only within a major (see AGENTS.md), so only the histories
// in the current major's folder replay.
const REPLAY_MAJOR = 1;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be 2? npm already has @temporalio/strands-agents 1.21.0 to 1.24.0, and check_policy refuses a version below the newest published one, so 1.0.0 can't be next. With the Breaking: commits since 1.24.0 this looks like the OpenAI Agents TypeScript case.

const history = await loadHistory(
path.resolve(__dirname, '../../src/__tests__/histories/hello-agent-before-model-config.json')
);
const history = await loadHistory(path.join(histories, 'hello-agent-before-model-config.json'));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This history is asserted to fail replay. Should it go to an older folder with its test removed, like the Strands Python pre-config ones?


# Replay is promised only within a major (see AGENTS.md), so only the histories
# in the current major's folder replay.
REPLAY_MAJOR = 1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Three of the four histories in 1.x/ are only loaded inside pytest.raises(NondeterminismError) in test_mcp.py. Should they live outside the current major's folder, since AGENTS.md says a major's histories must replay?

Comment on lines 36 to 40
# Recorded on this version, with the patch marker: the run gets its own agent back.
"caller-agent-marker-workflow-history.json",
"customer-service-workflow-history.json",
"hello-workflow-history.json",
"input-guardrail-workflow-history.json",
"output-guardrail-workflow-history.json",
"research-workflow-history.json",
"run-model-provider-workflow-history.json",
# Recorded on main at ea04762 with the workflow worker stopped, so
# that one activation resolves a stateful MCP call together with
# another activity (gather) or with a workflow cancel (cancel).
"stateful-mcp-cancel-workflow-history.json",
"stateful-mcp-gather-workflow-history.json",
"stateful-mcp-gather-wait-workflow-history.json",
# Recorded on this version, with the patch marker.
"stateful-mcp-cancel-wait-marker-workflow-history.json",
"stateful-mcp-gather-wait-marker-workflow-history.json",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Three of these four, and the one TypeScript 2.x/ history, carry markers of patches that are due to come out before 2.0.0. Will they be recorded again without the markers then?

"tools-workflow-history.json",
],
)
async def test_replay(file_name: str) -> None:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The late-import check at the end of this test now runs for four workflows only, and no other test has it. Could the dropped scenarios (handoffs, guardrails, research, agents as tools) be recorded on main into 2.x/ so the check still covers them?

Comment thread AGENTS.md
- If something doesn't work in the framework itself, because it's unsupported or because of a framework bug, the plugin doesn't have to make it work either. Document the limit in the README. Fix framework bugs upstream, not with a plugin workaround, and raise the dependency floor once the fix ships.
- Run the framework's own code and hook in through its extension points. Don't copy its objects or depend on their private fields; copies drift from upstream.
- A behavior change that can alter recorded histories must be gated with a patch, or called out as breaking in the PR with guidance for in-flight runs. This takes precedence over the rules above.
- Replay is promised only within a major version. Histories from releases of the same major must replay on every later release of that major; across majors there is no promise. A gate that only keeps an older major's runs replaying is removed before the next major ships. Committed replay histories go in a folder per major (`histories/<major>.x/`, `0.x/` below 1.0), and each replay test's `REPLAY_MAJOR` constant names the plugin's current major, the major of its next release, so CI replays only that folder. Older majors' folders stay in the repo.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the rule for a history recorded on main between releases be written here? The PR body has one, but the folders don't apply it the same way: OpenAI's such histories went to the previous major and Strands Python's went to the next.

Comment thread AGENTS.md
- If something doesn't work in the framework itself, because it's unsupported or because of a framework bug, the plugin doesn't have to make it work either. Document the limit in the README. Fix framework bugs upstream, not with a plugin workaround, and raise the dependency floor once the fix ships.
- Run the framework's own code and hook in through its extension points. Don't copy its objects or depend on their private fields; copies drift from upstream.
- A behavior change that can alter recorded histories must be gated with a patch, or called out as breaking in the PR with guidance for in-flight runs. This takes precedence over the rules above.
- Replay is promised only within a major version. Histories from releases of the same major must replay on every later release of that major; across majors there is no promise. A gate that only keeps an older major's runs replaying is removed before the next major ships. Committed replay histories go in a folder per major (`histories/<major>.x/`, `0.x/` below 1.0), and each replay test's `REPLAY_MAJOR` constant names the plugin's current major, the major of its next release, so CI replays only that folder. Older majors' folders stay in the repo.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are the older folders kept for? For Deep Agents, Strands Python and Google ADK Python's stateful MCP histories, the workflows that replay them are deleted here, so nothing in the tree can use the files.


// Replay is promised only within a major (see AGENTS.md), so only the histories
// in the current major's folder replay.
const REPLAY_MAJOR = 1;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a second copy of REPLAY_MAJOR for the plugin, and a bump that misses it keeps loading the old folder with no error. Could the major live once per plugin, say in plugin.toml, where check_conventions.py can check it against the folders?

Comment on lines +3 to +5
``tests/histories/<major>.x/stateful-mcp-*-workflow-history.json`` were
recorded with these workflows, and ``test_openai_replay.py`` replays the
current major's on this version.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

StatefulMcpGatherWorkflow and StatefulMcpCancelWorkflow have no history left to replay. Same for the gather and cancel workflows in the TypeScript stateful-mcp-replay.ts, and modelNextToPlainActivityWorkflow in Vercel AI SDK. Drop them, as was done for Google ADK Python?

# Recorded histories

`tests/test_replay.py` replays every `*.json` file in this directory through a `Replayer` configured with the plugin. The files were recorded by `tests/record_histories.py` from the workflows the suite runs, with scripted chat clients and the in-process MCP server.
`tests/test_replay.py` replays every `*.json` file in the folder of the plugin's current major, `<REPLAY_MAJOR>.x/` (`REPLAY_MAJOR` is set in `tests/record_histories.py`), through a `Replayer` configured with the plugin. The files were recorded by `tests/record_histories.py` from the workflows the suite runs, with scripted chat clients and the in-process MCP server.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The plugin README (line 510) and the .NET README (line 595) still describe the flat histories folder. Update those too?

campoy added a commit that referenced this pull request Nov 16, 2026
…586)

## What was changed

The next Vercel AI SDK release is 2.0.0, so its current major is 2, and
replay is promised only within a major. Two patches only keep 1.x runs
on their old paths, so let's remove them before 2.0:

- `vercel-ai-sdk-download-urls-in-model-activity` (#468): the model
always reports that it supports every URL, so URL parts always go to the
model Activity, which downloads them.
- `vercel-ai-sdk-abort-signal-cancels-model-activity` (#470): a caller's
`abortSignal` always cancels the model Activity.

The README drops both patch notes and says which 1.x runs don't replay.

## What will you notice? (Breaking)

Two kinds of 1.x run don't replay on 2.0. Let them finish on 1.x Workers
before you upgrade, or keep them there with Worker Versioning:

- A run in which an `experimental_download` function scheduled an
Activity for a URL. On 2.0 the model call comes first: `[TMPRL1100]
Activity type of scheduled event 'downloadNotes' does not match activity
type of activity command 'invokeModel'`.
- A run in which a signal aborted while a model or embedding call ran.
On 1.x the abort sent no command, and on 2.0 it cancels the Activity, so
sdk-core fails the replay with `Fatal error in workflow machines:
ActivityMachine in state ScheduledActivityCancelCommandCreated says the
transition is invalid`.

A run on a `main` build since #468 or #470 that took the new path
recorded the marker, so it doesn't replay either. No release wrote those
markers.

## Why?

We decided that replay is promised only within a major, and that a gate
that only protects an older major's runs is removed before the next
major ships. The Vercel AI SDK plugin's next release is 2.0.0, so these
gates go before it.

## Checklist

1. No issue.

2. How was this tested:
- `make sync`, `make lint` and `make test` for
`typescript/vercel-ai-sdk`, in Docker with Node 24: 133 tests passed.
- Replay: the three 1.x histories that #565 stops replaying, run through
the replay tests #565 removes, on #565 and on this PR. On #565 all three
replay. On this PR, the `experimental_download` and abort histories fail
as above, and the one with a model call next to a plain Activity still
replays.

3. Any docs updates needed? The README changes are here.
campoy added a commit that referenced this pull request Nov 16, 2026
…before 1.0 (#585)

## What was changed

Google ADK Python ships 1.0 next, so its current major is 1, and replay
is promised only within a major (the rule #565 adds to AGENTS.md). The
`google_adk.activity-as-tool-var-args` patch from #486 only keeps runs
from before that fix passing an Activity's empty `*args` as one extra
argument, so let's remove it before 1.0.

`activity_as_tool` now always spreads an Activity's `*args`. The tests
stop checking the old path and the patch marker.

This PR doesn't need #565: no committed history reaches this gate.

## What will you notice? (Breaking)

Not much. A run that started before #486 now passes `*args` the new way
at its next such tool call, so its Activity gets no extra empty-tuple
argument. Its history still replays: replay doesn't compare Activity
arguments.

A run on a `main` build since #486 that called such a tool recorded the
marker, so it doesn't replay on this build. Its next Workflow Task fails
with `[TMPRL1100] Non-deprecated patch marker encountered`, and the run
stops making progress. No release wrote that marker.

### What should you do?

Never ran a `main` build of Google ADK Python since #486? Then nothing.

If you did, find the open runs that recorded the marker first. The
Python SDK adds every patch it records to the `TemporalChangeVersion`
search attribute, so this lists them:

```
temporal workflow list --query "TemporalChangeVersion = 'google_adk.activity-as-tool-var-args' AND ExecutionStatus = 'Running'"
```

No results? You're done. Otherwise, pick one:

1. **Let them finish, before you deploy.** Keep your current Workers
until those runs close, or pin them to the old Worker Deployment Version
with Worker Versioning. Then send new runs to this build.
2. **Reset them, after you deploy.** In each run's history, find the
first `MarkerRecorded` event for `google_adk.activity-as-tool-var-args`
and the `WorkflowTaskCompleted` event just before it. Reset to that
event:

   ```
temporal workflow reset --workflow-id <id> --event-id <that
WorkflowTaskCompleted event ID> --reason "drop google_adk var-args
marker"
   ```

The new run keeps everything before that point and runs the rest again
on this build. So the `*args` tool Activity that recorded the marker
runs again, and so does every Activity after it, model calls included.
Signals that arrived after that point are reapplied by default. Only
reset when those Activities are safe to run twice.

Reset only once this build is deployed: an older Worker would record the
marker again.

## Why?

We decided that replay is promised only within a major, and that a gate
that only protects an older major's runs is removed before the next
major ships. Google ADK Python's next release is 1.0, so this gate goes
before it.

## Checklist

1. No issue.

2. How was this tested:
- `make format`, `make lint` and `make test` for `python/google_adk` on
Python 3.12: 324 passed, 6 skipped.
- Replay, across builds. On Workers with no Workflow cache, I recorded a
tool call to an Activity with `*args` and one to an Activity without, on
`main` and on this PR. On `main` I also recorded the `*args` call with
`workflow.patched()` returning `False` for this gate, which is what a
run from before #486 does. Then I replayed every one on both builds,
along with a history with a renamed Activity.
- On this PR, only the `*args` run from `main`, which has the marker,
fails, with `[TMPRL1100] Non-deprecated patch marker encountered`, and
so does the renamed Activity. The old-path run replays.
   - Rollback to `main`: everything recorded on this PR replays.
- The reset steps above, on a local dev server with a small stand-in
Workflow (not `activity_as_tool`). A Worker that calls
`workflow.patched()` for this gate before its second Activity, like
`main`, recorded the marker. Then a Worker without that call, like this
PR, failed with TMPRL1100. The `TemporalChangeVersion` query found the
run. `temporal workflow reset` to the `WorkflowTaskCompleted` before the
marker finished it on the new Worker with no marker, and ran exactly one
Activity again: the one after the marker. After that, the query found
nothing. I didn't try the Worker Versioning option.

3. Any docs updates needed? No. The README doesn't mention the patch.
campoy added a commit that referenced this pull request Nov 16, 2026
…watch gate before 2.0 (#587)

## What was changed

The next OpenAI Agents TypeScript release is 2.0.0, so its current major
is 2, and replay is promised only within a major. The
`openai-agents-stateful-mcp-session-watch` patch from #373 only keeps
1.x runs scheduling operations without a schedule-to-start timeout the
old way, so let's remove it before 2.0. Such operations always watch
their session now. #566 removes the same gate from the Python plugin.

The `2.x/` caller-cancel history had the patch marker, so I recorded it
again without it as `stateful-mcp-caller-cancel.json`. Why? A history
with a marker and no matching `patched()` call fails replay with
`[TMPRL1100] Non-deprecated patch marker encountered`.

The README drops the marker note and says which 1.x runs don't replay.

## What will you notice? (Breaking)

Some 1.x runs with stateful MCP operations that had
`scheduleToStartTimeout: 0` don't replay on 2.0. For example, a run
whose caller cancelled operations on two servers, one of them with
`scheduleToStartTimeout: 0`, fails with `[TMPRL1100]` because its
follow-up Activities come in another order. Let such runs finish on 1.x
Workers before you upgrade, or keep them there with Worker Versioning.

A run on a `main` build since #373 that scheduled such an operation
recorded the marker, so it doesn't replay either. No release wrote that
marker.

## Why?

We decided that replay is promised only within a major, and that a gate
that only protects an older major's runs is removed before the next
major ships. OpenAI Agents TypeScript's next release is 2.0.0, so this
gate goes before it.

## Checklist

1. No issue.

2. How was this tested:
- `make lint` and `make test` for `typescript/openai-agents`, in Docker
with Node 24: 335 tests passed. Lint shows the same 8 warnings as on
#565, in files this PR doesn't touch.
- Replay, across builds. I recorded the caller-cancel run on #565 and on
this PR with #373's recorder, which keeps both sessions open and cancels
the caller while both calls are queued. Then I replayed both, the four
committed 1.x histories, the committed `2.x/` marker history and a
history with a renamed Activity on both builds.
- On this PR, only these fail, each with `[TMPRL1100]`: the run from
#565 and the committed marker history (`Non-deprecated patch marker
encountered`), the 1.x caller-cancel history, and the renamed Activity.
The other three 1.x histories replay (a gather with and without
`scheduleToStartTimeout: 0`, and a cancel with it), and so does this
PR's run.
- Rollback to #565: this PR's caller-cancel run fails with
`[TMPRL1100]`, because the old path resumes the follow-ups in the other
order.

3. Any docs updates needed? The README changes are here.
campoy added a commit that referenced this pull request Nov 16, 2026
…replaying (#566)

## What was changed

Three patches on `main` exist only to keep runs from before their fixes
replaying. No release wrote their markers: PyPI has 1.0.0 and 1.1.0, and
both shipped before these fixes. With replay promised only within a
major (#565), 2.0.0 doesn't need them. So let's remove them before it
ships:

- `openai_agents.refuse-run-model-provider` (#204): `Runner.run` always
refuses `RunConfig.model_provider`.
- `openai-agents-stateful-mcp-session-watch` (#373): a stateful MCP
operation with neither a schedule-to-start nor a schedule-to-close
timeout always watches its session.
- `openai_agents.run-caller-agents` (#426): runs always use your agents,
not copies. `_convert_agent` goes, and so do
`test_model_conversion_loops` and the four run-state tests that called
it directly.

The three 2.x histories that had markers are recorded again without
them, as `caller-agent-workflow-history.json`,
`stateful-mcp-cancel-wait-workflow-history.json` and
`stateful-mcp-gather-wait-workflow-history.json`. Why? A history with a
marker and no matching `patched()` call fails replay with `[TMPRL1100]
Non-deprecated patch marker encountered`.

The Python README drops the marker notes and says which 1.x runs don't
replay. The TypeScript README keeps its note on
`openai-agents-stateful-mcp-session-watch`: TypeScript has its own copy
of that gate, and this PR doesn't touch it.

This also takes `workflow.patched()` out of every `Runner.run`. That
call is what exposed the sdk-core bug where a run whose first Update was
rejected fails its own replay.

## What will you notice? (Breaking)

These 1.x runs don't replay on 2.0. Let them finish on 1.x Workers
before you upgrade, or keep them there with Worker Versioning. For the
release notes:

- A run that passed its own `RunConfig.model_provider` (#204). On 1.x it
ran on the Worker's provider. On 2.0 its replay fails with the
`ValueError` that refuses the provider.
- A run in which a stateful MCP operation with
`cancellation_type=WAIT_CANCELLATION_COMPLETED` and neither timeout
finished in the same Workflow Task as another Activity (#373). On 2.0
the operation resolves one step later, so the run schedules its next
Activities in another order (`[TMPRL1100]`).
- A run whose next step depended on getting its own agents back, not
copies, such as asking again for a permanent approval (#426)
(`[TMPRL1100]`).

A run on a `main` build that reached one of these gates recorded its
marker, and it doesn't replay either. No release wrote those markers.

Rolling back to 1.x isn't promised either: histories of 2.0 runs that
hit the last two cases fail on 1.1.0 with `[TMPRL1100]`.

## Why?

We decided that replay is promised only within a major, and that a gate
that only protects an older major's runs is removed before the next
major ships. These three only protect runs from before their fixes, so
they go before 2.0.0.

## Checklist

1. No issue.

2. How was this tested:
- `make format`, `make lint` and `make test` for `python/openai_agents`
on Python 3.12: 618 passed, 2 skipped.
- Replay, across builds. I recorded finished runs on Workers with no
Workflow cache (a hello agent, `CallerAgentWorkflow`, and the four
stateful MCP replay shapes, with and without
`WAIT_CANCELLATION_COMPLETED`), plus a `CallerAgentWorkflow` run still
waiting on its model Activity. I recorded them on `main`, on this PR,
and the stateful MCP ones on 1.1.0 too. Then I replayed each of them,
and the committed histories, on every build.
   - On this PR, only these fail:
- the three 1.x cases above: the committed 1.x `caller-agent`
(`[TMPRL1100]`), `run-model-provider` (the plugin's `ValueError`) and
`stateful-mcp-gather-wait` (`[TMPRL1100]`) histories, and the
`WAIT_CANCELLATION_COMPLETED` gather recorded on 1.1.0 (`[TMPRL1100]`);
- every history with a marker: the three committed on `main` and all
seven recorded on `main` (every `main` agent run records
`openai_agents.run-caller-agents`), each with `[TMPRL1100]
Non-deprecated patch marker encountered`.

The other nine committed 1.x histories replay, and so do the 1.1.0
cancel runs, with and without `WAIT_CANCELLATION_COMPLETED`, and the
1.1.0 gather run without it. Everything recorded on this PR replays on
it.
- Rollback: this PR's histories on `main` and on 1.1.0. The caller-agent
and `WAIT_CANCELLATION_COMPLETED` gather histories fail with
`[TMPRL1100]`; the rest replay, including the waiting run. I didn't
carry a live run from one build to another.
- Control: a history with a renamed Activity fails with `[TMPRL1100]` on
every build.

3. Any docs updates needed? The README changes are here. The 2.0.0
release notes should list the replay cases above.
campoy added a commit that referenced this pull request Nov 17, 2026
…gate before 1.0 (#575)

## What was changed

Strands Python ships 1.0 next, so its current major is 1, and replay is
promised only within a major (the rule #565 adds to AGENTS.md). The
`strands-agents.context-window-overflow-recovery` patch from #146 only
keeps runs without its marker on the old path. Those are 0.x runs, so
let's remove it before 1.0.

A model Activity that fails with a context window overflow now always
raises `ContextWindowOverflowException` in the Workflow, so Strands
reduces the conversation and calls the model again. The overflow test no
longer checks for the marker.

This PR doesn't need #565: no committed history reaches this gate.

## What will you notice? (Breaking)

A 0.x run whose Workflow got a model overflow as an `ActivityError`
fails replay on 1.0 with `[TMPRL1100]`. In practice that adds nothing
new: every 0.x agent run already fails replay on 1.0, at the model
config read from #194 (`invoke_model` where 1.0 schedules
`strands_get_model_config`).

A run on a `main` build since #146 that hit an overflow recorded the
marker, so it doesn't replay either. No release wrote that marker.

It breaks the other way too. A run that hits an overflow on this version
doesn't record the marker, so it fails replay with `[TMPRL1100]` on a
`main` build that has the gate. Runs that never hit an overflow replay
on both.

### What should you do?

The README now says this next to the other upgrade notes:

- Let runs that hit an overflow before you upgrade finish on their
original workers, or keep them there with Worker Versioning.
- Don't roll workers back to an earlier version while runs that hit an
overflow on this version are open. Use Worker Versioning if you need to
roll back.
- Runs that never hit an overflow need nothing new.

## Why?

We decided that replay is promised only within a major, and that a gate
that only protects an older major's runs is removed before the next
major ships. Strands' next release is 1.0, so this gate goes before it.

## Checklist

1. No issue.

2. How was this tested:
- `make format`, `make lint` and `make test` for `python/strands_agents`
on Python 3.12: 282 passed, 1 skipped. After the README change, `make
sync`, `make lint` and `make test` on Python 3.13: 282 passed, 1
skipped.
- Replay, across builds. On Workers with no Workflow cache, I recorded a
run that recovers from an overflow, a run whose model always overflows
inside a Workflow that catches `ActivityError` and runs a fallback
Activity, and a plain run. I recorded them on `main` and on this PR. On
`main` I also recorded both overflow runs with `workflow.patched()`
returning `False` for this gate, which is what a Workflow without the
gate (0.x) does. Then I replayed every one on both builds, along with
#146's fallback history (recorded on 0.1.0's code) and a history with a
renamed Activity.
- On this PR, only these fail, each with `[TMPRL1100]`: the two old-path
runs, the two overflow runs from `main` (`Non-deprecated patch marker
encountered`), #146's 0.x history (at the model config read, as on
`main`), and the renamed Activity. Everything recorded on this PR
replays, and so does the plain run from `main`.
- Rollback to `main`: this PR's two overflow histories fail with
`[TMPRL1100]`; the plain one replays.

3. Any docs updates needed? Yes, and they're in this PR. The Strands
README now says what happens to runs that hit an overflow, and how to
upgrade and roll back with them open.
campoy added a commit that referenced this pull request Nov 17, 2026
…artbeat timeout (#520)

## What was changed

`TemporalModel` now gives both model Activities, `invoke_model` and
`invoke_model_streaming`, a 10-second `heartbeat_timeout` when
`activity_config` doesn't set one.

- A timeout you set wins, and `heartbeat_timeout=None` turns heartbeats
off.
- Both Activities heartbeat on a timer at half the timeout. Before,
`invoke_model` never heartbeat, and `invoke_model_streaming` heartbeat
once per streamed response. The timer waits before its first beat, so a
call shorter than 5 seconds sends none.
- The timer uses `loop.call_later`, not a task like `temporalio-mcp`
does. Why? A task only starts its sleep at the block's first `await`, so
anything that blocks the event loop before then pushes every beat back.
Building the model runs before that `await`, and so does `LiteLlm`'s
import of `litellm` on its first call, which took 3.4 seconds when I
measured it. With a task, a 6-second block would miss the first
heartbeat.
- The `TemporalModel` docstring and the README say what the default
does, what it costs, how to turn it off, and how to upgrade and roll
back.

`activity_as_tool` and `activity_node` run your own Activities, so they
don't change. MCP isn't in this PR either.

## Why?

Without a heartbeat timeout, a cancel never reaches a running model
call, so it runs to the end. And a lost worker goes unnoticed until the
60-second start-to-close timeout. #491 has the details, and the
measurements behind 10 seconds.

Couldn't you set `heartbeat_timeout` yourself? Well, not really:
`invoke_model` never heartbeat. A 2-second model call with a 1-second
heartbeat timeout failed with:

```
ActivityError: Activity task timed out
TimeoutError: activity Heartbeat timeout
```

With this change, it returns.

## Breaking change

Replay isn't the problem. When core replays a scheduled Activity, it
only compares its ID and type. #565 removed the test that replays the
four 0.x histories, since 1.0.0 is next, so I ran it once against this
branch: all four still replay.

But a passing replay doesn't mean mixed versions work. The timeout is
recorded when the model Activity is scheduled. What happens when a
Worker on an earlier version runs it? That Worker never heartbeats from
`invoke_model` (and from `invoke_model_streaming` only when a response
arrives), so a call longer than 10 seconds fails with a heartbeat
timeout. Retries keep the recorded timeout, so they fail the same way,
and rolling back doesn't clear it either.

I checked this on a local dev server, with a 12-second call scheduled
the way `TemporalModel` does it:

| Activity body | `heartbeat_timeout` | Result |
|---|---|---|
| no heartbeat, as before | 10 s | `TimeoutError: activity Heartbeat
timeout` after 10.02 s |
| no heartbeat, 2 attempts | 10 s | both attempts saw 10 s and timed
out, 21.04 s in total |
| this PR's timer | 10 s | returned after 12.02 s |
| no heartbeat, as before | `None` | returned after 12.03 s |

The README has the steps for in-flight runs:

- To upgrade, put this version on every Worker that runs model
Activities before any Workflow Worker. If the same Workers run both,
deploy with `heartbeat_timeout=None` in `activity_config`, and remove
that setting in a later deploy.
- To roll back, first deploy this version with `heartbeat_timeout=None`,
wait until the model calls scheduled before that deploy finish, and then
roll back.
- Runs pinned with Worker Versioning avoid both cases when their model
Activities use the Workflow's task queue.

There are two more costs:

- A call that didn't set `heartbeat_timeout` now heartbeats. In Temporal
Cloud, that's at most one Action every 8 seconds of a running call.
- A model that blocks the worker's event loop for longer than 10 seconds
now fails with a heartbeat timeout. I read the model classes ADK 2.12
registers (Gemini, Gemma, Apigee, Claude, OpenAI, LiteLlm and OCI), and
none blocks the loop that long. The longest block I found is that first
`litellm` import.

## Checklist

1. Closes #519

2. How was this tested:
- `test_single_agent` now reads the heartbeat timeouts from History: 10
seconds for both model calls, and none for the `activity_as_tool` call.
Without the change it fails with `assert [None, None, None] ==
[datetime.timedelta(seconds=10), None, datetime.timedelta(seconds=10)]`.
- In `test_multi_agent`, the writer agent now sets
`heartbeat_timeout=None`. It gets no heartbeat timeout, and the other
two agents get 10 seconds. Without the change it fails with `assert
[None, None, None] == [datetime.timedelta(seconds=10),
datetime.timedelta(seconds=10), None]`.
- A new `test_model_activities_heartbeat_on_a_timer` runs both model
Activities with a 1-second heartbeat timeout. A fast call that streams
three responses sends no heartbeat, and a slow call, whose model waits
for a heartbeat, returns. Without the change, the fast streaming call
fails with `assert (3 > 0) == False` (one heartbeat per response), and
both slow calls time out waiting for a heartbeat.
- The mixed-version table comes from a one-off script against a local
dev server (Temporal CLI 1.10.0). It isn't part of the suite.
- After rebasing on main, `make lint` and `make test` (321 passed, 6
skipped) pass locally, on Python 3.12 with uv 0.13.5.

3. Any docs updates needed?
The docstring and the README are updated here. The release notes should
call this out as breaking, with the upgrade and rollback steps and how
to turn heartbeats off.
DABH added a commit that referenced this pull request Nov 17, 2026
This PR brings back `tests/test_legacy_cache_replay.py`, which replays
the three committed Deep Agents histories, now from
`tests/histories/0.x` with `REPLAY_MAJOR = 0`.

#565 removed the test on the premise that Deep Agents ships 1.0 next.
Deep Agents goes out as Public Preview with a 0.x version in this wave,
so 0 stays the current major and those histories have to keep replaying
(AGENTS.md, "Replay is promised only within a major version"). No source
changes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants