Repository navigation
Breaking: decode OpenAI Agents streamed model events with their type in every Worker process, and accept an explicit OpenAIPayloadConverter on temporalio 1.35 - #230
Conversation
…very Worker process The streaming model Activity's result was decoded with the type the SDK reads from its signature, which drops TResponseStreamEvent's discriminator. When an event failed strict validation, the lenient fallback then chose the event class from a process-wide openai cache, so a Worker process that had not parsed such an event itself (another Worker, or one after a restart) read response.completed as another event and the run stalled. The Workflow now gets the result undecoded and decodes it with the full type. Results that pass strict validation decode as before. For a result that fails it, a patch marker records the new decoding, and runs that decoded such a result before this change keep the old decoding on replay.
… full type, without a version gate Answer the review of the previous commit and drop its version gate. Schedule the streaming model Activity by name with result_type=list[TResponseStreamEvent]. The SDK then decodes the result through the configured payload converter, in the Activity's serialization context, and the lenient fallback keeps the Annotated discriminator. The previous commit decoded strictly valid results with its own TypeAdapter, which skipped a converter with its own wire form. test_streaming_uses_configured_payload_converter covers that. Fixes add no version gates for now, so every run decodes with the full type. Remove the openai_agents.stream-events-discriminator patch, the SDK type it kept for earlier runs, and the replay test and History that only checked it. Breaking change: a streamed run recorded before this version whose result failed strict validation, decoded in a process without openai's cached discriminator, got ModelBehaviorError. If its Workflow caught it and took another path, its replay now decodes the result correctly, takes the normal path and fails with a non-determinism error. Let those runs finish before you upgrade, or use Worker Versioning.
DABH
left a comment
There was a problem hiding this comment.
Review at head a35eac0 (two commits over c664a34; main is at 4bcde9a and the diff applies to it cleanly). make lint is clean, and make test passes 384 of 384 on the head and 427 of 427 on main with the diff applied. On main's source the new drifted-event test fails with ModelBehaviorError: Model did not produce a final response! and the converter test passes, as the body says. I checked replay against a dev server, recording Histories on main and replaying them on main plus this diff with the openai cache empty and filled. The Histories: a valid stream; a drifted response.completed caught with a timer fallback; the same drift decoded in a process whose cache was already filled; the drift with ModelBehaviorError in workflow_failure_exception_types; and a valid turn followed by a caught drifted turn. I also left a run stuck on main, its Workflow Task failing on the drifted result; it completed with the expected answer once a Worker on the new build, in a fresh process, took it. Valid results replay, and so do drifted results that main had decoded correctly. Drifted results that main decoded wrongly fail with [TMPRL1100] whatever the new process's cache holds, as the Breaking change paragraph says. On main the same Histories already replay differently from process to process: the caught-fallback History fails on main once the cache is filled, and the filled-cache History fails on main with an empty cache. Rollback behaves the same way: a drifted run recorded on the new build replays on main only where the cache is filled. So a gate keeping the old decoding could not have made those runs replay reliably, and dropping it gives up nothing main had.
Also verified:
- The
ActivityTaskScheduledevent is the same on both builds (type, id, input bytes, headers, summary, options). Of the interceptor input, onlyarg_typeschanges, and nothing reads it. - 31 realistic valid events decode to identical classes, field sets and dumps. The two TypeAdapters have equal core schemas, and the
Annotatedhint is hashable, so the adapter cache still hits. - For drifted streams built by openai's own stream parser, the new decode reproduces the Activity's class tree in all seven scenarios tried: a missing usage field, a message without an id, and unknown item, annotation, content part, web-search action and event types. Main's decode in a fresh process differs in six of them.
- No other path in the plugin decodes an openai union through a stripped hint.
Dropped after checking:
- The
annotated_typessandbox warning: main has it too. - The
cache_write_tokensprecondition: openai 3.33.0 still requires the field, and the test fails loudly if that changes. - The class-level
contextslist: safe under xdist. - The one-time cost of building openai's discriminator map inside the activation: about 0.2 s, once per process, and the Activity's parser pays it too.
The TypeScript plugin passes stream events through as plain JSON (fromSerializedStreamEvent), so it never had this process dependence and there is no parity gap. Not re-run: the body's live checks on the gated builds. The stuck-run recovery above is their head equivalent.
Severity: P1 = wrong result or stuck run in realistic use; P2 = correctness or robustness in an edge case; P3 = docs, tests, cleanup.
Where the problems cluster: the source change is right. It fixes stuck runs and, as the probe in the comment on the execute_activity call shows, silently wrong answers. What is left sits around it:
- an older check in
_data_converterthat the new converter test trips on the SDK release the nightly installs; - an upgrade note that covers only one of the groups of runs whose replay changes, and that lives only in text the squash merge drops.
Commenting rather than approving: as it stands, merging turns the openai_agents nightly red and leaves the replay change undocumented in the repository; with the one-line converter fix folded in (or landed first) and the note in the README, I would approve.
PR body:
- "breaking old histories is accepted with the plugins' 1.0 releases" does not fit this plugin, which has shipped 1.0.0 and 1.1.0. The break lands in its next major, and the Streaming section's Experimental label is the better justification.
- The last line still says the PR is a draft while the breaking change and the backport question are open, but it is marked ready.
- On the backport: the copy bundled in temporalio 1.34.0 still schedules with
execute_activity_method(temporalio/contrib/openai_agents/_temporal_model_stub.py:281-282), so it has the same bug. That belongs in the SDK repository and does not block this PR.
| Base64TextJSONConverter.contexts.clear() | ||
| config = client.config() | ||
| config["data_converter"] = DataConverter( | ||
| payload_converter_class=Base64TextPayloadConverter |
There was a problem hiding this comment.
P2: this test fails on temporalio 1.35.0, the newest SDK the plugin allows and the one the nightly lane installs, so merging it as is turns the openai_agents nightly red. The cause is an older check in _data_converter that now rejects every explicitly configured OpenAIPayloadConverter.
temporalio 1.35.0 (released 2026-10-28) wraps DataConverter.payload_converter in _TemporalTransferTypePayloadConverter. So isinstance(converter.payload_converter, OpenAIPayloadConverter) at _temporal_openai_agents.py:295 is false for Base64TextPayloadConverter and for OpenAIPayloadConverter itself.
Evidence:
- On a copy of main plus this diff synced with
make sync-latest(temporalio 1.35.0, openai 3.33.0, openai-agents 0.22.3, pydantic 2.14.1), this test fails at line 507 withValueError: The payload converter must be of type OpenAIPayloadConverter.The other 426 tests pass. - On that set,
_data_converter(DataConverter(payload_converter_class=OpenAIPayloadConverter))raises the same error. It passes on the locked 1.34.0. - The last nightly (2026-10-30) already installed 1.35.0 (
Updated temporalio v1.34.0 -> v1.35.0in its log) and was green for openai_agents, so this would be its only failure.
Outside the tests, the same check fails Client construction for anyone on a fresh install who names the class explicitly, for example next to a codec, and the error message tells them to do exactly that.
Fix: compare the class, elif not issubclass(converter.payload_converter_class, OpenAIPayloadConverter):. With that one line, the full suite passes on the latest set (427), including this test's serialization-context assertion through the new wrapper. Fold it in here with a test for the explicit-class path, or land it first.
There was a problem hiding this comment.
Confirmed, and folded in as you suggest (aef940f): _data_converter now checks issubclass(converter.payload_converter_class, OpenAIPayloadConverter).
With make sync-latest (temporalio 1.35.0), this test fails with the old check (ValueError: The payload converter must be of type OpenAIPayloadConverter.) and passes with the new one. The full suite passes on that set (384 tests) and on the lock (384).
I didn't add another test: this one already covers the explicit-class path. It names a subclass, Base64TextPayloadConverter, goes through the plugin's check, and the nightly lane runs it on 1.35.0. On the locked 1.34.0 the old and new checks agree, so no test there can fail without the fix.
| ModelActivity.invoke_model_activity_streaming, | ||
| # Scheduled by name, so that result_type applies (a callable's declared | ||
| # return type would replace it). | ||
| events: list[TResponseStreamEvent] = await workflow.execute_activity( |
There was a problem hiding this comment.
P2 (docs): the Breaking change paragraph limits the replay change to runs that caught ModelBehaviorError. But a wrong decode that raises nothing changes the path too, and the note lives only in the PR body, which does not survive the merge.
Two cases, both on the locked versions:
- (a) Text deltas. In openai 3.8.0,
ResponseTextDeltaEvent.logprobsis required whileResponseOutputText.logprobsis optional. A provider that omitslogprobson deltas therefore drifts only the deltas, andresponse.completedstays valid. On main, in a process without the cache entry, each such delta decodes asResponseAudioDeltaEventwith no error; on this head it decodes asResponseTextDeltaEvent. Workflow code that filters withisinstance(event.data, ResponseTextDeltaEvent), the pattern the Agents SDK documents for streaming, sees no deltas on main in such a process and sees them here. Any command it chooses from them changes. - (b) Output items. The agents run loop folds
response.output_item.doneitems into the final response when a backend leavesresponse.completed's output empty (agents/run_internal/run_loop.py:2251-2255and2282-2283in 0.22.0). I probed this against a dev server: turn 0 streamsresponse.output_item.donewith afunction_callitem whosestatusis a value the installed SDK does not know, then a validresponse.completedwithoutput=[].- On main with an empty cache, the tool call is dropped without any error, and the run completes with
''after one model Activity. - With a filled cache, and on main plus this diff in any process, the run calls the tool, schedules a second model Activity and returns the answer.
- Replaying the main History on main plus this diff fails with
[TMPRL1100] Nondeterminism error: Activity machine does not handle this event: HistoryEvent(id: 15, WorkflowExecutionCompleted).
- On main with an empty cache, the tool call is dropped without any error, and the run completes with
So on main this drift can also return a wrong answer silently, which strengthens the case for the fix.
Durability: the repository squash-merges with a blank message, and release notes take commit subjects only (scripts/release/release_tool.py:456). The body's Breaking change and Upgrade paragraphs, and the same paragraph in a35eac0's message, are therefore dropped at merge. This plugin's README carries the upgrade notes of the earlier breaking changes (RunConfig.model_provider under Model Providers, the tracing key under Tracing). Its Streaming section, which already says Experimental, has none.
Suggested README sentence for the Streaming section, mirrored in the body: 'A streamed run recorded before this version can take another path on replay if it decoded a result that fails the openai SDK's strict validation, in a process that had not itself parsed such an event. This holds whether or not the run raised: it may have caught ModelBehaviorError, dropped an output item, or checked an event's class. Let such runs finish on the earlier version, or use Worker Versioning. Runs that were stuck on that decode continue after the upgrade.'
One more group: a run whose Worker listed the error in workflow_failure_exception_types failed, and its closed History no longer replays either. That matters only for replay tests and queries on it.
There was a problem hiding this comment.
Agreed. c74fd96 adds the note to the README's Streaming section, close to your wording, including the runs that failed with ModelBehaviorError in workflow_failure_exception_types. The body's Breaking change and Upgrade paragraphs now list the same groups.
I checked (a) and (b) with the locked versions, without rerunning your dev-server probe. In a fresh process, the SDK's type decodes a text delta without logprobs, and a response.output_item.done whose function call has an unknown status, as ResponseAudioDeltaEvent; this head keeps ResponseTextDeltaEvent and ResponseOutputItemDoneEvent. openai-agents 0.22.0 adds those items to an empty response.completed output (run_loop.py:2251-2255, 2282-2283).
| """ | ||
| with pytest.raises(pydantic.ValidationError): | ||
| InputTokensDetails.model_validate({"cached_tokens": 0}) | ||
| empty_openai_discriminator_cache(monkeypatch) |
There was a problem hiding this comment.
P3 (tests): this test models a process whose cache was never filled, so on main it fails in the live run and the replay step decides nothing. It does not reproduce #229's scenario, where the process that ran the Activity works and another process fails.
The fake model yields Python objects, so the Activity never fills DISCRIMINATOR_CACHE the way openai's stream parser does, and nothing else in the suite does either. On main the live run fails with ModelBehaviorError. On this head the live run's own decode fills the cache (0 to 1 entries), and the test passes with or without the reset at line 476.
Pre-filling the cache here instead reproduces the issue exactly. I checked it with a temporary copy of this test: construct_type(type_=TResponseStreamEvent, value=<drifted response.completed dict>) leaves one entry, the live run then completes on main, and after the reset at line 476 the replay fails on main with Model did not produce a final response! and passes on this head. That makes the replay step the assertion that matters. Alternatively, use OpenAIResponsesModel over an httpx.MockTransport, as #229 does.
There was a problem hiding this comment.
Done in c74fd96. Before the live run, the test now fills openai's cache with construct_type(type_=TResponseStreamEvent, value={"type": "response.completed"}), as openai's stream parser would in the process that ran the Activity. It empties the cache again before the replay. With main's model stub, the live run now completes and the replay fails with Model did not produce a final response!. On this head both pass.
| # union member from a process-wide openai cache that only some processes have | ||
| # filled, so another Worker process could read response.completed as another | ||
| # event. The converter gets the full type instead. | ||
| _STREAM_EVENTS_TYPE: Any = list[TResponseStreamEvent] |
There was a problem hiding this comment.
P3 (cleanup): the stub now restates two facts that the Activity definition owns: its name (__name__) and its return type (this constant, a copy of the annotation at _invoke_model_activity.py:447). A later change to that annotation would leave decoding on the old type with no type error.
Deriving the type keeps one source: typing.get_type_hints(ModelActivity.invoke_model_activity_streaming, include_extras=True)["return"] equals list[TResponseStreamEvent] with the Annotated intact. A name mismatch would fail every streaming test, so __name__ is fine.
Separately, the comment's 'picks a union member from a process-wide openai cache' is not quite what happens. With no cache entry, openai's construct_type takes the first union member that constructs, which is ResponseAudioDeltaEvent (openai/_models.py:647-652). 'Falls back to the first union member unless this process has cached the discriminator' says it exactly.
There was a problem hiding this comment.
Done in c74fd96: _STREAM_EVENTS_TYPE is now get_type_hints(ModelActivity.invoke_model_activity_streaming, include_extras=True)["return"]. The comment now says the fallback takes the first union member unless this process has cached the discriminator. Kept __name__.
…ss-process case, document the replay change - The model stub reads the streaming Activity's return type with get_type_hints(include_extras=True) instead of restating it, and its comment says what openai's lenient decode does without a cached discriminator. - test_streaming_drifted_event_in_fresh_process fills openai's discriminator cache before the live run, as in the process that ran the Activity, and empties it before the replay. Without the fix, the live run completes and the replay fails. - The README's Streaming section says which streamed runs recorded on an earlier version stop replaying, and what to do before upgrading.
…emporalio 1.35.0 temporalio 1.35.0 wraps DataConverter.payload_converter, so the plugin's isinstance check rejected every explicitly configured OpenAIPayloadConverter, subclasses included. Check the configured class instead.
|
Thanks for the review. Each thread has its answer; the head is now aef940f. On the body points:
|
DABH
left a comment
There was a problem hiding this comment.
Second round, at head aef940f (two commits over a35eac0; it merges into main at 61fe33a without conflicts). make lint is clean. make test passes 384 of 384 on the head with the locked versions and with make sync-latest (temporalio 1.35.0, openai 3.35.1, openai-agents 0.22.3), and 449 of 449 on a local merge with main with both sets. I re-ran the earlier reproductions rather than relying on the replies. On 1.35.0 the converter test fails with the old check (ValueError from env.applied_on_client) and passes at the head. With main's model stub, the drifted-event test's live run now completes and its replay fails with Model did not produce a final response!; at the head both pass. The derived _STREAM_EVENTS_TYPE equals list[TResponseStreamEvent] with its PropertyInfo discriminator intact.
Replay: against a dev server I recorded seven streamed Histories on main at 61fe33a: a valid stream; a drifted response.completed caught with a timer fallback; the same drift decoded with the openai cache filled; the drift in a run that failed through workflow_failure_exception_types; a valid turn followed by a caught drifted turn; and a drifted response.output_item.done item, dropped with the cache empty and kept with it filled. I replayed them on the merge and on the head with the cache empty and filled. The valid stream and the two drifts main decoded correctly replay. The four that main decoded wrongly fail with [TMPRL1100] whatever the cache holds, as the README paragraph and the body now say. As a control, all seven replay on main in the cache state they were recorded in. A run left stuck on main, its Workflow Task failing with Model did not produce a final response!, completed with 'Hello world!' once a Worker on the merged build took it in a fresh process.
Main still has the converter problem on its own. At 61fe33a with temporalio 1.35.0, both Client and Replayer construction with OpenAIAgentsPlugin() and an explicit OpenAIPayloadConverter, or a subclass, raise ValueError: The payload converter must be of type OpenAIPayloadConverter. The released 1.1.0 has the same check and allows 1.35.0. The 2026-11-02 nightly installed 1.35.0 and was green for openai_agents because no test on main names the class through the plugin, so this PR carries both the fix and the only test that would catch a regression (in the nightly lane). No other Python plugin has the pattern (deepagents already uses issubclass on payload_converter_class). The TypeScript plugin still passes stream events through as plain JSON, so there is no parity gap.
Dropped after checking: a factory callable passed as payload_converter_class now fails with TypeError from issubclass (the SDK types the field as type[PayloadConverter], deepagents has the same check, and on 1.35.0 main rejected it anyway); the module-level get_type_hints call (the sandbox passes temporalio modules through, so it runs once per process). Nothing material was left unverified.
Severity: P1 = wrong result or stuck run in realistic use; P2 = correctness or robustness in an edge case; P3 = docs, tests, cleanup.
Previous rounds. Addressed: _data_converter now checks issubclass(converter.payload_converter_class, OpenAIPayloadConverter) (aef940f). A PydanticPayloadConverter is still rejected and DefaultPayloadConverter is still replaced, on 1.34.0 and 1.35.0. The upgrade note is now in the README's Streaming section and covers every group I found: caught errors, dropped output items, class checks, closed failed runs, and stuck runs that continue. The drifted-event test pre-fills the cache, so its replay step now decides the result. The stub reads the type from the Activity, and its comment is exact. The body points (the 2.0.0 justification, the stale draft line, the backport note) are fixed too. Accepted decline: no separate test for the explicit-class path; the converter test already goes through the check with a subclass, and on 1.34.0 the two checks cannot disagree. Nothing from the last round is still open.
Approving: both blocking items from the last round are fixed and verified at this head, CI is green, and the one remaining note, about the release-notes line, is non-blocking.
| converter, payload_converter_class=OpenAIPayloadConverter | ||
| ) | ||
| elif not isinstance(converter.payload_converter, OpenAIPayloadConverter): | ||
| elif not issubclass(converter.payload_converter_class, OpenAIPayloadConverter): |
There was a problem hiding this comment.
P3 (release notes, non-blocking): the converter fix on this line will not appear in the generated release notes, although it fixes a bug that main and the released 1.1.0 both have.
The repository squash-merges with the PR title as the subject and a blank body, and release_tool.py release-notes lists commit subjects only (scripts/release/release_tool.py:456). The 2.0.0 notes will therefore show only the streamed-decode change. What this line fixes, checked on main at 61fe33a with temporalio 1.35.0: Client construction with plugins=[OpenAIAgentsPlugin()] and DataConverter(payload_converter_class=OpenAIPayloadConverter) raises ValueError: The payload converter must be of type OpenAIPayloadConverter. Replayer(workflows=[...], plugins=[OpenAIAgentsPlugin()], data_converter=...) with the same converter raises it too, and so does a subclass. v1.1.0 has the same isinstance check (line 293 at the tag) and allows 1.35.0 (temporalio>=1.33.0,<2), so a fresh install of it fails the same way. Someone who hit that error would find nothing about it in the 2.0.0 notes.
Fix: name it in the title, for example Breaking: decode OpenAI Agents streamed model events with their type in every Worker process, and accept an explicit OpenAIPayloadConverter on temporalio 1.35. Or move this line into its own non-breaking PR and land that first; the converter test here needs it on 1.35.0.
|
Re-checked against current main: still merges cleanly, and the openai_agents suite passes 568/568 on the merged tree with locked deps. On the newest allowed deps, main and the merge fail the same three OTel tracing tests, which come from OpenInference 2.6 (#444, being fixed in #447), so that's unrelated to this PR. This PR's new tests pass in that lane. @campoy, could you take DABH's title suggestion so the converter fix shows up in the generated 2.0.0 notes (e.g. "…, and accept an explicit OpenAIPayloadConverter on temporalio 1.35")? Then this is good to merge. Can hand-add the Breaking change / Upgrade text to the 2.0.0 release notes. |
|
Title updated, merging |
What was changed
The OpenAI Agents plugin now decodes a streamed model result in Workflow code with the full
list[TResponseStreamEvent]type, so an event that fails the openai SDK's strict validation keeps its class in every Worker process._TemporalModelStub.stream_responseschedules the streaming model Activity by name withresult_typeset to the Activity's return type, read withtyping.get_type_hints(..., include_extras=True)so that it keeps itsAnnotatedpart. (With a callable, the SDK uses the return type it reads withoutinclude_extrasand ignoresresult_type.) The Activity, its input and its result payload are unchanged.Annotateddiscriminator.OpenAIPayloadConverter, or a subclass, ontemporalio1.35.0. That release wrapsDataConverter.payload_converter, so the oldisinstancecheck rejected them all; the check now usespayload_converter_class. The new converter test below names its converter class and failed on 1.35.0 without this.No public API changes.
Breaking change: the change has no version gate. We are not adding version gates to these fixes.
temporalio-openai-agentsalready shipped 1.0.0 and 1.1.0, so this break needs its next major release, 2.0.0. Streaming is also still labeled Experimental in the README.A streamed run recorded before this change could decode a result that fails strict validation as other classes, in a process that had not parsed such an event itself. Its replay now decodes the result correctly, and it fails with
[TMPRL1100]if the wrong decode changed what the Workflow did. That happens whether or not the run raised:ModelBehaviorError: Model did not produce a final response!and took another path;response.completedhas an empty output, the agents run loop uses the items of theresponse.output_item.doneevents, and a drifted one was decoded as another event;logprobsfails strict validation and was decoded asResponseAudioDeltaEvent.Closed runs of this kind no longer replay either, also runs that failed because their Worker listed
ModelBehaviorErrorinworkflow_failure_exception_types. That matters for replay tests and queries. A run that did not catch the error was stuck, its Workflow Task failing; it now decodes the result correctly and continues. Runs whose results all passed strict validation, or were decoded in a process that had the discriminator cached, are not affected.Upgrade: let open streamed runs of this kind finish on the earlier version before you upgrade, or keep them there with Worker Versioning. The README's Streaming section says the same.
The branch has four commits: the first fix; a second that answers its review and removes the version gate; a third and a fourth that answer the second review (the README note, the type read from the Activity, the test's cache setup, and the converter check). Review the combined diff against
main.Why?
See #229. The SDK reads the streaming Activity's return type with
typing.get_type_hints, which drops theAnnotatedpart ofTResponseStreamEventthat carries openai'stypediscriminator. When an event fails strict validation, the converter's lenient fallback callsconstruct_typewith the bare union. Unless this process has the union's discriminator in openai's process-wideDISCRIMINATOR_CACHE, it takes the first union member that constructs. Only a process that has parsed such an event itself has that entry; elsewhereresponse.completedbecomesResponseAudioDeltaEvent, the framework raisesModel did not produce a final response!, replay fails, and a live run whose next Workflow Task lands on another process (ModelActivityParameters(task_queue=...), or a Worker restart) staysRUNNING.Checklist
Closes [Bug] openai_agents: a streamed run fails replay in a Worker process that did not run its model Activity #229
How was this tested:
test_streaming_drifted_event_in_fresh_processintests/test_openai_streaming.py: a streamed run whose final event has nocache_write_tokensruns live in a process whose openai discriminator cache is filled, as the process that ran the model Activity. It must complete, and its History must then replay with the cache empty, as in another Worker process. Withmain's model stub (c664a34) the live run completes and the replay fails withModelBehaviorError: Model did not produce a final response!. It passes onaef940f.test_streaming_uses_configured_payload_converter: a valid stream decoded with anOpenAIPayloadConvertersubclass whose wire form base64-encodestextanddelta. It checks the result, the wire encoding and that the result was decoded in the Activity's serialization context. It passes onmainwith the lockedtemporalio1.34.0. On this PR's first commit (1988400), which decoded strictly valid results itself, it fails:assert 'SGVsbG8gd29ybGQh' == 'Hello world!'. With the newest allowed versions (make sync-latest:temporalio1.35.0) and the old converter check, it fails withValueError: The payload converter must be of type OpenAIPayloadConverter.It passes onaef940f, with both sets.aef940f, in Docker with Python 3.13 and uv 0.12.24:make test PYTEST_ARGS='-n 2'passes with the locked versions (384 tests) and with the newest allowed versions (384 tests;temporalio1.35.0,openai3.34.0,openai-agents0.22.3), andmake lintpasses with the locked versions.main, decodes a text delta withoutlogprobsand aresponse.output_item.donewhose function call has an unknownstatusasResponseAudioDeltaEvent; this head keepsResponseTextDeltaEventandResponseOutputItemDoneEvent. A valid text delta decodes the same with both.mainatc664a34(the fresh-process replay fails withModel did not produce a final response!), and 0 ona35eac0. Itsvalidcontrol exits 0.a35eac0, of 8 Histories recorded onmain, each starting with an empty openai cache. Cases: a valid turn, a drifted turn, two drifted turns, and a valid turn then a drifted one, each finished and waiting on a held Activity. A drifted turn that fails takes a fallback path with a timer:done-valid,open-valid, andopen-valid-then-drift, still waiting before its drifted turn);[TMPRL1100] Nondeterminism error: Activity machine does not handle this event: HistoryEvent(id: 15, TimerStarted)(Complete workflow machinefor the valid-then-drift one), as "Breaking change" says;main.mainwith its Workflow Task failing on the drifted result, completes withhelloonce a Worker witha35eac0takes it.RUNNINGwith failed Workflow Tasks on 1.1.0 andmainand completes with the change. A response that passes strict validation completes on all three.Any docs updates needed?
The README's Streaming section now says which runs stop replaying and what to do before upgrading. Release notes should say the same (see "Breaking change").
Not covered:
mainhere. The review found they replay onmainonly in a process whose openai cache is filled.temporalio1.34.x still bundles the old code astemporalio.contrib.openai_agents, which schedules withexecute_activity_methodand has the same bug. A fix there belongs intemporalio/sdk-python; not done here.annotated_typesinside the Workflow sandbox during an activation (Module annotated_types was imported after initial workflow load), onmainand with this change. That import counts toward the deadlock timeout; it is a separate issue.