Skip to content

Breaking: openai_agents: run your agents, not copies, so permanent approvals carry over - #426

Merged
campoy merged 5 commits into
fix/openai-agents-0.24from
fix/openai-agents-run-agent-without-copy
Nov 10, 2026
Merged

campoy merged 5 commits into
fix/openai-agents-0.24from
fix/openai-agents-run-agent-without-copy

Conversation

@campoy

@campoy campoy commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

What was changed

What if the plugin ran your agents, and not copies of them? That's this PR. It also means a permanent approval sticks across runs again on openai-agents 0.23 and 0.24.

This PR is stacked on #422, so the diff here shows only this PR's changes.

  • TemporalOpenAIRunner runs your agents as you wrote them. It no longer copies the agent graph to put a Temporal model stub in each agent. Why was the copy there? To swap in Temporal's model. But the plugin's RunConfig.model_provider already turns every model name into the model Activity, so nothing else is needed.
  • RunConfig.model stays a name too. The same provider turns it into the model Activity, so the SDK applies that model's default settings, as it does without the plugin.
  • When the model Activity swaps an agent's implicit default settings for the defaults of the model its provider picks (openai_agents: align implicit model settings with the model a custom provider resolves #178), it keeps the extra arguments that a SandboxAgent's capabilities add, such as the compaction threshold.
  • A run that already ran an agent before this change keeps running on copies until it ends. A run takes the new path only when it records the openai_agents.run-caller-agents patch marker, so _convert_agent stays for the older runs. openai_agents is GA, so open runs must keep replaying.
  • The runner still refuses an agent whose model is a Model object when the run starts, for the starting agent and every agent in its handoffs, recursively. Agents behind handoff(), as_tool() or a custom on_invoke_handoff are only reachable through private SDK fields (Handoff._agent_ref, FunctionTool._agent_instance), or only known at handoff. So the call_model_input_filter the plugin installs refuses them just before their model call instead. That keeps new runs off private fields.

Why?

From openai-agents 0.23, a permanent approval, approve(..., always_approve=True), belongs to the agent that owns the tool (openai/openai-agents-python#5144). The plugin made a new copy of the agent on every run, so a later run with the same agent and context asked for approval again. #422 supports 0.23 and 0.24 but leaves this open. Without copies, the approval stays on your agent, as it does without the plugin. The TypeScript plugin made the same move in #270.

What will you notice? (Breaking)

  • Hooks, callbacks, guardrails and dynamic instructions get your own agent objects, not copies, and RunResult.last_agent and the agents in a RunState are yours. agent.model there is the name you set, not a stub. So careful: anything a hook or callback changes on an agent changes your agent.
  • A permanent approval covers later runs of the same agent with the same context, on openai-agents 0.23 and 0.24 too.
  • An agent behind handoff(), or one a custom on_invoke_handoff returns, whose model is a Model object fails when it's about to call its model, not when the run starts. An agent behind as_tool() fails when its nested run starts. In both as_tool() cases, the error goes back to the parent model as the tool's output, as upstream does for any failed nested run.
  • With RunConfig.model set, an agent left at its default model settings now sends the run model's defaults, as upstream: none for gpt-4o, reasoning.effort: medium and verbosity: low for gpt-5.4-pro. Before, it sent the defaults of its own model, or of the default model.
  • A SandboxAgent whose Compaction capability sets no policy now gets the compaction threshold for its model, as upstream: the run's model, else the agent's, else the default model. Before, the stub hid the name, so the fixed 240,000 applied, and an agent with no model sent no threshold at all. An explicit Compaction(policy=...) on an agent with no model applies again; since openai_agents: align implicit model settings with the model a custom provider resolves #178 it was dropped.
  • One SandboxAgent object can't serve two runs at the same time: the second run fails with upstream's SandboxAgent '...' cannot be reused concurrently across runs. Before, each run had its own copy.

All of this applies to runs that run their first agent after the upgrade. A run that already ran an agent keeps its copies and all of its old behavior until it ends, including asking again for a permanent approval.

Model calls keep the same Activity type. With RunConfig.model set, their summary is now the agent's name, as for other runs, where it was empty.

What about replay? Open runs replay. Replay doesn't compare Activity inputs or summaries, so a run that now sends different model settings replays and continues with them. A run that ran an agent before the upgrade has no patch marker, and Python keeps the first patch decision for the whole run, so it stays on copies. A run that hadn't run an agent yet records the marker at its first agent run. Once a run records the marker, the code before this change can't replay it (Non-deprecated patch marker encountered), so a rollback fails for those runs. Let them finish before rolling back, or use Worker Versioning.

Checklist

  1. Fixes [Feature Request] openai_agents: support openai-agents 0.23 and 0.24 #416. Depends on openai_agents: support openai-agents 0.23 and 0.24 #422.

  2. How was this tested:

  • New: test_always_approve_covers_later_runs_of_the_same_agent (plain, Agent handoff and handoff(); streamed and not) extends ResumeRunStateWorkflow. It approves with always_approve=True, resumes, then runs the same agent again with the same context and new tool call IDs. Does it catch the bug? Against openai_agents: support openai-agents 0.23 and 0.24 #422's code, which still copies agents, all 6 cases fail on 0.23.1 and 0.24.0 (the second run stops for approval). On 0.22.0 they pass either way, because 0.22 doesn't tie approvals to an agent.
  • test_capture_filter_returns_user_result_unchanged also checks that the filter refuses a Model object.
  • New: test_prepare_workflow_run_refuses_model_objects_reachable_through_handoffs checks the early refusal through a handoff loop.
  • New replay histories for CallerAgentWorkflow, whose next command depends on getting its own agent back: one recorded on main (copies, no timer) and one recorded here (marker, timer). Both replay. Does the gate matter? With the gate turned off, the main history fails with [TMPRL1100] Nondeterminism error: Timer machine does not handle this event.
  • New: test_run_model_gets_its_own_default_settings (a gpt-5.4-pro run model on an agent with no model) and test_alignment_keeps_extra_args, from openai_agents: keep RunConfig.model as a name so the run model's defaults apply #458.
  • The release-check reproductions of the run-model settings and sandbox compaction defects match native in every case: a run model on an agent with no model or with its own model, the guide's gpt-5.6-sol example with and without OPENAI_DEFAULT_MODEL, and a SandboxAgent with no model, with gpt-4o, with an explicit policy, and with a run model.
  • test_model_conversion_loops and the four run-state tests that call _convert_agent directly stay, since older runs still use it.
  • Before the review changes: make sync, make lint and make test (Python 3.13) pass with openai-agents 0.22.0, 0.22.1, 0.22.2, 0.22.3, 0.23.1 and 0.24.0, each locked in a scratch copy (0.23.0 was never on PyPI). make build, check_wheel.py and check_conventions.py pass.
  • With the review changes and openai_agents: keep RunConfig.model as a name so the run model's defaults apply #458: make lint and make test pass with the locked 0.24.0 (561 passed, 1 skipped). CI runs the locked 0.24.0.
  1. Any docs updates needed? No. The README doesn't describe the agent copies.

The Workflow runner no longer copies the agent graph to put a Temporal
model stub in each agent. The plugin's RunConfig.model_provider already
turns every model name into the model Activity, so the SDK now runs the
caller's agents as they are. This also drops the fix-ups of the private
FunctionTool._agent_instance and Handoff._agent_ref fields.

From openai-agents 0.23, a permanent approval (always_approve=True)
belongs to the agent that owns the tool. With a new copy on each run, a
later run with the same agent and context asked again. Without copies
the approval stays on the caller's agent, as it does without the plugin.

The input filter the plugin installs now refuses an agent whose model is
a Model object just before that agent calls its model, instead of when
the run starts.

The tests that called the removed copy directly go: with no copy they
would only test the SDK.
…t-without-copy

Brings in #422's head d714998, which merged main at 3363a79. The only conflict was the ModelSummaryProvider import in test_openai_run_state.py: keep main's public import and drop the _convert_agent import this branch removed.
@campoy
campoy marked this pull request as ready for review November 5, 2026 01:36
@campoy
campoy requested a review from a team as a code owner November 5, 2026 01:36

kwargs["run_config"] = run_config
return _convert_agent(self.model_params, starting_agent, None), run_config
return run_config

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.

Suggested change
return run_config
# Refuse a Model object up front for every agent reachable through public
# fields. Agents behind handoff(), as_tool() or a custom on_invoke_handoff are
# only reachable through private SDK fields, so the call_model_input_filter
# refuses them just before their model call instead.
pending: list[Agent[Any]] = [starting_agent]
checked: set[int] = set()
while pending:
agent = pending.pop()
if id(agent) in checked:
continue
checked.add(id(agent))
if agent.model is not None and not isinstance(agent.model, str):
raise ValueError(
"Temporal workflows require a model name to be a string in the agent."
)
pending.extend(h for h in agent.handoffs if isinstance(h, Agent))
return run_config

Can we keep the early refusal where public fields allow it? The copy used to refuse an agent whose model is a Model object when the run started; this PR moves that to the moment the agent calls its model. A read-only check in _prepare_workflow_run can get most of the early failure back without touching private fields:

  • starting_agent.model
  • every Agent reachable through agent.handoffs, recursively (track visited agents, since handoff graphs can loop)

Both are public, and they cover the usual setups: one agent, or agents that hand off to each other by listing them in handoffs.

For the rest, the filter's late check is the backstop, and I think that's acceptable as long as we say so: handoff(agent) keeps its target in Handoff._agent_ref, as_tool() keeps its agent in FunctionTool._agent_instance, and a custom on_invoke_handoff can return any agent. Reaching the first two would bring back the private-field dependency this PR removes, and the third is only known at handoff. Could the filter's docstring (or a comment by the early check) note that agents behind handoff(), as_tool() and custom on_invoke_handoff are checked late on purpose, to avoid depending on private SDK fields?

For as_tool(), the nested run goes through _prepare_workflow_run too, so the starting-agent check refuses it before the nested model call. The default failure_error_function still returns that error to the parent model as the tool's output. That matches upstream, but it would be worth a line in the breaking-change notes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done. The runner now refuses a Model object when the run starts, for the starting agent and every Agent in handoffs, with a visited set for loops. I put the check at the top of _prepare_workflow_run, next to the other agent checks, so it fails before any setup. It also lets _TemporalModelStub through, because a nested run on the copy path (see your patch comment) gets a copy with a stub.

The comment by the check says why agents behind handoff(), as_tool() and a custom on_invoke_handoff are checked late. The breaking notes now say an as_tool() agent fails when its nested run starts, and the error goes back to the parent model as the tool's output.

# A Model object would run in the Workflow, so it is refused before the call.
agent.model = ScriptedModel(_banker_reply)
with pytest.raises(ValueError, match="model name to be a string"):
no_filter.call_model_input_filter(_call_data(agent))

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.

Suggested change
no_filter.call_model_input_filter(_call_data(agent))
no_filter.call_model_input_filter(_call_data(agent))
def test_prepare_workflow_run_refuses_model_objects_reachable_through_handoffs():
target = Agent(name="target", model=ScriptedModel(_banker_reply))
middle = Agent(name="middle", handoffs=[target])
starting = Agent(name="starting", handoffs=[middle])
middle.handoffs.append(starting) # a loop must not recurse forever
runner = TemporalOpenAIRunner(ModelActivityParameters())
with pytest.raises(ValueError, match="model name to be a string"):
runner._prepare_workflow_run(starting, {})

Test that we can reject asap for invalid model

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added as you wrote it, right after the filter test.

)

kwargs["run_config"] = run_config
return _convert_agent(self.model_params, starting_agent, None), run_config

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 replay section of the PR desc says runs that depend on agent-mutating hooks, or that use one SandboxAgent in two runs at once, can fail with [TMPRL1100], and suggests draining or Worker Versioning. Could we gate the change behind a patch instead, as _prepare_workflow_run already does for openai_agents.refuse-run-model-provider? workflow.patched() is memoized per workflow, so if workflow.patched("openai_agents.run-caller-agents"): return starting_agent, run_config else _convert_agent(...) keeps workflows started before 2.0 on copies for their whole lifetime, and new workflows run the caller's agents. That also keeps in-flight runs on their current model settings, which otherwise change mid-conversation without a replay failure. _convert_agent would stay until the patch is deprecated and removed in a later release.

One catch: on the copy path every agent's model is a _TemporalModelStub, so the new call_model_input_filter check needs to let _TemporalModelStub through, or it refuses the workflows the patch protects.

A major version tells users the API changed, but upgrading still replays in-flight workflows on the new code, and many users of this plugin have long-running approval workflows they can't easily drain.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good call, done. openai_agents is GA, so open runs have to keep replaying.

  • A new run records openai_agents.run-caller-agents and runs your agents. A run that already ran an agent before the upgrade stays on copies until it ends, so _convert_agent and its tests are back.
  • The filter lets _TemporalModelStub through, as you pointed out.
  • Two new replay histories for a small workflow whose next command depends on getting its own agent back: one recorded on main and one recorded here with the marker. Both replay. With the gate turned off, the main one fails with [TMPRL1100], so the test shows the gate is doing the work.

I rewrote the replay section of the description to match.

openai_agents is GA, so runs that are already open must replay. A run
now runs the caller's agents only once it records the
openai_agents.run-caller-agents patch marker. Runs started without it
keep running on copies with model stubs until they end, so _convert_agent
and its tests come back for them. The input filter lets those stubs
through.

The runner also refuses a Model object when the run starts again, for the
starting agent and every agent in handoffs. Agents behind handoff(),
as_tool() or a custom on_invoke_handoff are only reachable through
private SDK fields, so the filter still refuses them just before their
model call.

Two new replay histories cover the gate: one recorded on main, which runs
copies, and one recorded here with the marker. Without the gate, the main
history fails with [TMPRL1100].
The squash of the RunConfig.model change dropped the import, which the
copy path for older runs still uses.

@campoy campoy left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks, ptal


kwargs["run_config"] = run_config
return _convert_agent(self.model_params, starting_agent, None), run_config
return run_config

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done. The runner now refuses a Model object when the run starts, for the starting agent and every Agent in handoffs, with a visited set for loops. I put the check at the top of _prepare_workflow_run, next to the other agent checks, so it fails before any setup. It also lets _TemporalModelStub through, because a nested run on the copy path (see your patch comment) gets a copy with a stub.

The comment by the check says why agents behind handoff(), as_tool() and a custom on_invoke_handoff are checked late. The breaking notes now say an as_tool() agent fails when its nested run starts, and the error goes back to the parent model as the tool's output.

# A Model object would run in the Workflow, so it is refused before the call.
agent.model = ScriptedModel(_banker_reply)
with pytest.raises(ValueError, match="model name to be a string"):
no_filter.call_model_input_filter(_call_data(agent))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added as you wrote it, right after the filter test.

)

kwargs["run_config"] = run_config
return _convert_agent(self.model_params, starting_agent, None), run_config

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good call, done. openai_agents is GA, so open runs have to keep replaying.

  • A new run records openai_agents.run-caller-agents and runs your agents. A run that already ran an agent before the upgrade stays on copies until it ends, so _convert_agent and its tests are back.
  • The filter lets _TemporalModelStub through, as you pointed out.
  • Two new replay histories for a small workflow whose next command depends on getting its own agent back: one recorded on main and one recorded here with the marker. Both replay. With the gate turned off, the main one fails with [TMPRL1100], so the test shows the gate is doing the work.

I rewrote the replay section of the description to match.

@campoy
campoy changed the base branch from main to fix/openai-agents-0.24 November 10, 2026 00:01
@campoy
campoy added this pull request to stack #459 November 10, 2026 00:02
@campoy
campoy merged commit 96bbc34 into main Nov 10, 2026
143 checks passed
@campoy
campoy deleted the fix/openai-agents-run-agent-without-copy branch November 10, 2026 01:29
campoy added a commit that referenced this pull request Nov 16, 2026
#565)

## 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.
campoy added a commit that referenced this pull request Nov 16, 2026
Replay is promised only within a major, so 2.0 doesn't need the three
patches that only kept runs from before their fixes replaying:
openai_agents.refuse-run-model-provider (#204),
openai-agents-stateful-mcp-session-watch (#373) and
openai_agents.run-caller-agents (#426). Every run now takes the new path:
RunConfig.model_provider is refused, stateful MCP operations without a
timeout watch their session, and runs use your agents, not copies.

_convert_agent and the tests that only covered the agent copies go too.
The three 2.x histories that had patch markers are recorded again without
them, since a marker with no matching patched() call fails replay.
campoy added a commit that referenced this pull request Nov 16, 2026
Replay is promised only within a major, so 2.0 doesn't need the three
patches that only kept runs from before their fixes replaying:
openai_agents.refuse-run-model-provider (#204),
openai-agents-stateful-mcp-session-watch (#373) and
openai_agents.run-caller-agents (#426). Every run now takes the new path:
RunConfig.model_provider is refused, stateful MCP operations without a
timeout watch their session, and runs use your agents, not copies.

_convert_agent and the tests that only covered the agent copies go too.
The three 2.x histories that had patch markers are recorded again without
them, since a marker with no matching patched() call fails replay.
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.
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.

[Feature Request] openai_agents: support openai-agents 0.23 and 0.24

2 participants