A needs_approval tool pauses in run 1. A person approves it, and the tool runs once. Later, a new run of the same Agent asks for the same tool with the same call_id and the same arguments. The new run waits for approval, as it should. But if your app passes the ToolApprovalItem from run 1 into RunState.approve() on run 2, the SDK accepts it, and the tool runs again. Nobody made a decision in run 2. This guide shows the behaviour, credits where it was first described, and measures an app-side guard from the issue thread that held 30 of 30 runs without changing the library.
Everything below ran on openai-agents 0.26.0 (still the latest on PyPI, uploaded 2026-11-24T03:24:11Z, Nov 24, 2026 UTC), Python 3.13.5, Linux, Nov 30, 2026. We used ScriptedModel: no network and no API key. Each row is 30 runs, in one pass, on Runner.run unless the row is streamed (Runner.run_streamed). The reporter was on v0.23.1.
Who this hits
You are affected if all of these are true:
- A tool uses
needs_approval, and your app pauses on its interruption. - Later, your app starts a new run of the same
Agentobject. In our control, a newAgentinstance in run 2 did not accept the stale item (30 of 30). - The new run asks for the same tool with the same
call_idand identical arguments. - Your app may pass a stored
ToolApprovalItemfrom the earlier run intoRunState.approve()on the new run.
The reporter's examples of how the same call_id can come back are a serialized session that is replayed, or a proxy or load balancer that reassigns call IDs. Those are the reporter's examples. We reused the call_id with a scripted model; we did not test a proxy ourselves.
If run 2 gets no decision, it keeps waiting. If the arguments change, approve() raises an error. Both held in 30 of 30 runs.
The issue
This is openai/openai-agents-python#5413, "Approval decision transfers across runs when call ID is reused". It was opened Oct 23, 2026 (8:04 PM CDT) and was still open on Nov 30, 2026. It has no labels and 12 comments. None of the comments is from a maintainer, so there is no maintainer reply on this issue.
The cause was in the issue body from the start, not found by us. The reporter wrote: "The approval record is keyed by call_id but not bound to the run lineage." They point at agents/run_state.py, where RunState.approve() accepts a ToolApprovalItem from a previous run.
The reporter also listed the boundaries they verified:
- "Changed arguments are correctly rejected: if args differ, the approval does not transfer."
- "No decision → stays interrupted: without any approval, the run correctly waits."
Their suggested fix: "Bind approval records to the run that issued them (e.g., include a run ID in the approval record and validate it in RunState.approve())."
Related: issue #6056 and the only maintainer comment
openai/openai-agents-python#6056, "RunState.approve() records an approval when no pending item matches", is about a nearby case: approve() recording a decision for an item that has no pending match. It was closed on Nov 17, 2026 by maintainer seratch. This is the only maintainer comment on the topic. It is on #6056, not on #5413, and it does not change #5413.
seratch confirmed that approve() and reject() can record a decision when the supplied item has no pending match. On the supported pattern, seratch wrote: "For human approval flows, the supported pattern is to load the checkpoint the reviewer is authorized to act on and resolve an item from that checkpoint's get_interruptions()." On #5413 specifically: "In #5413 the second state already has a matching interruption, so removing this fallback would leave that case unchanged." And the close: "We're closing this as not planned. A case where the documented checkpoint lookup resolves the wrong request would warrant reopening."
So maintainers have not decided the contract for #5413.
Why it happens
The commenters on #5413 traced this, not us. In short:
RunState._approval_items_matchcompares the agent, the tool invocation type, thecall_idand an arguments fingerprint. There is no run ID in that comparison.get_interruptions()returns copies of the pending items. Matching by those fields is what lets a copy approve the real pending item.- So a
ToolApprovalItemfrom another run, with the same agent,call_idand arguments, looks the same as a copy of the current interruption.
The commenters also noted that the match checks the agent object itself. That is why a new Agent instance in run 2 did not accept the stale item, in their reports and in our control.
Reproduce it
This has the same shape as the issue's script and our suite: a write_marker tool that appends to a list, one Agent reused across two runs, and the same call_id in both.
import asyncio
from agents import Agent, Runner, function_tool, set_tracing_disabled
from agents.testing import ScriptedModel, assistant_message, function_call
set_tracing_disabled(True)
executed: list[str] = []
@function_tool(name_override="write_marker", needs_approval=True)
def write_marker(path: str) -> str:
executed.append(path)
return "ok"
def script():
return ScriptedModel([
[function_call("write_marker", {"path": "A"}, call_id="call_x1")],
[assistant_message("done")],
])
async def main():
agent = Agent(name="marker", model=script(), tools=[write_marker])
# Run 1: pause, approve, run once.
r1 = await Runner.run(agent, "do it")
stale = r1.interruptions[0]
s1 = r1.to_state()
s1.approve(stale)
await Runner.run(agent, s1)
# Run 2: same Agent, same call_id, same args. It waits.
agent.model = script()
r2 = await Runner.run(agent, "do it again")
s2 = r2.to_state()
s2.approve(stale) # run 1's item
r2b = await Runner.run(agent, s2)
print(f"executed={executed}, left={len(r2b.interruptions)}")
asyncio.run(main())
Run 2 waits with one interruption and executed=['A']. After the stale approve, the result our suite recorded in 30 of 30 runs was:
executed=['A', 'A'], left=0
The final output was done. We saw the same transfer with Runner.run_streamed in 30 of 30 runs.
Results
30 runs per row, one pass, Nov 30, 2026, openai-agents 0.26.0. Each cell is the number of runs, out of 30, with the outcome named in the last column.
| Scenario | Result | What the count means |
|---|---|---|
Baseline: same Agent, run 2 reuses call_id and args, approve with run 1's ToolApprovalItem |
30/30 | Transfer: run 2 waited, then the stale approve ran the tool again (executed=['A', 'A'], no interruptions left, final output done) |
Baseline, streamed (Runner.run_streamed) |
30/30 | Same transfer: the tool ran again without a fresh decision |
| Control: run 2, no approve | 30/30 | Still waits: executed=['A'], 1 interruption left |
Control: run 2 uses the same call_id with path="B" |
30/30 | approve() raised ModelBehaviorError: Model reused a tool call ID for a different invocation. Use a unique call ID for each tool invocation. Sink stays ['A'] |
| Control: new Agent instance in run 2, stale approve | 30/30 | No transfer: still 1 interruption, sink stays ['A'] |
| Guard: ticket issued in run 1, presented to run 2 | 30/30 | Refused: ForeignApproval raised, sink stays ['A'], 1 interruption left |
| Guard: ticket issued for run 2, approved on run 2 | 30/30 | Fresh decision accepted: executed=['A', 'A'], no interruptions left |
| Trap: accept any item whose call_id is pending | 30/30 | The check failed to protect: the transfer happened (['A', 'A']) in 30 of 30, so 0 of 30 protected |
| Trap: call_id plus args hash, no run id | 30/30 | The check failed to protect: the transfer happened in 30 of 30, so 0 of 30 protected |
Trap: require the same object as one from get_interruptions() |
30/30 | The check blocked a valid approval: the item from result.interruptions is a different object and != the copy (identity_hit=False, eq_hit=False), so a current-run approval was refused; sink stays ['A'] |
That is 10 rows of 30 runs, 300 runs in total. In the trap rows, 30/30 means the trap showed up every time. It does not mean the check worked.
The fix: bind approvals to your own run in the app (no library change)
This guard is not ours. sattyamjjain described it on the issue on Oct 24, 2026: keep your own record of (run or session ID, call_id, arguments) for each pending interruption, and only approve items taken from result.interruptions / state.get_interruptions() of the state you are resuming. Never persist ToolApprovalItems and replay them into another run.
We tested that approach in this form. When a run pauses, issue a ticket for each interruption, bound to your own run or session id plus the call_id plus a hash of the arguments. The reviewer approves a ticket, not a raw ToolApprovalItem. Only call approve() for a ticket issued for the run you are resuming, and take the item from that state's get_interruptions().
import hashlib
import uuid
from agents.items import ToolApprovalItem
class ForeignApproval(Exception):
"""Not a pending approval for this run."""
def args_hash(item: ToolApprovalItem) -> str:
return hashlib.sha256((item.arguments or "").encode()).hexdigest()
def issue_tickets(run_id: str, items: list[ToolApprovalItem], store: dict) -> list[str]:
"""At pause: stamp each pending item with this run's id. Give the reviewer ticket ids."""
ids = []
for item in items:
tid = uuid.uuid4().hex
store[tid] = {"run_id": run_id, "call_id": item.call_id, "args_hash": args_hash(item)}
ids.append(tid)
return ids
def safe_approve(state, ticket_id: str, run_id: str, store: dict):
rec = store.get(ticket_id)
if rec is None or rec["run_id"] != run_id:
raise ForeignApproval(f"foreign or unknown approval ticket: {ticket_id!r}")
match = [
i for i in state.get_interruptions()
if i.call_id == rec["call_id"] and args_hash(i) == rec["args_hash"]
]
if len(match) != 1:
raise ForeignApproval(f"no unique pending match for ticket {ticket_id!r}")
state.approve(match[0])
Use it like this:
r2 = await Runner.run(agent, "do it again")
tickets = issue_tickets(run2_id, list(r2.interruptions), store) # save with your run
# ... a person approves a ticket ...
s2 = r2.to_state()
safe_approve(s2, ticket_id, run2_id, store) # run2_id is the run you are resuming
r2b = await Runner.run(agent, s2)
Results on openai-agents 0.26.0:
- A run-1 ticket presented to run 2 was refused in 30 of 30 runs.
ForeignApprovalwas raised, the sink stayed['A'], and run 2 was still waiting. - A ticket issued for run 2 was accepted in 30 of 30 runs. That is a fresh decision, and the tool ran:
executed=['A', 'A'].
The store in our suite was an in-process dict. In production it would be your database, keyed by your own run or session id. We did not test storing tickets across processes.
Stuck on an OpenAI Agents SDK approval or resume flow? Send a minimal repro; you pay $79 only when our patch passes it.
Traps: checks that look right but are not
- Checking only the
call_id. Accepting any item whosecall_idis pending in the new run let the transfer through in 30 of 30 runs (0 of 30 protected). The stale item has the samecall_id. - Checking the
call_idplus an args hash, with no run id. Same result: the transfer went through in 30 of 30 runs (0 of 30 protected). The stale item has the same arguments too. The run id is the part that tells the runs apart. - Requiring the same object as one from
get_interruptions(). This fails the other way. A legitimate item fromresult.interruptionsis a different object and is not equal to the copy fromget_interruptions()(identity_hit=False,eq_hit=False). The check refused a valid current-run approval in 30 of 30 runs. The issue comments already noted thatget_interruptions()returns copies and that object identity is not a usable check.
All of these guards are check-then-act. We did not test concurrent approvals of the same ticket.
What we didn't test
- A real model or provider. We used
ScriptedModelonly. - The TypeScript SDK, Sessions, or server-managed conversations.
- Serializing tickets or
RunStateacross processes. The suite is in-process, andto_string/from_stringwas not a row. always_approvecarry-over, a stalereject(), and sandbox or apply-patch tools. Commenters on the issue discussed these; we did not measure them in this suite.- Other openai-agents versions. The reporter was on v0.23.1; we did not re-run 0.23.1 here.
- A proxy or load balancer that reassigns call IDs.
- Patching the library itself.
FAQ
What happens if I pass a previous run's ToolApprovalItem into a new OpenAI Agents run with the same call_id and arguments?
The new run still waits for approval, but RunState.approve() accepts the old item and the protected tool runs again without a fresh decision. On openai-agents 0.26.0, with the same Agent instance, the same call_id and identical arguments, the stale approve gave executed=['A', 'A'] with no interruptions left in 30 of 30 runs, and the same with Runner.run_streamed in 30 of 30. With no decision, run 2 kept waiting in 30 of 30. With changed arguments, approve() raised ModelBehaviorError in 30 of 30. With a new Agent instance in run 2, the stale item did not transfer in 30 of 30.
Have the OpenAI Agents maintainers decided on this, and what did seratch say on related issue #6056?
No. As of Nov 30, 2026, issue #5413 is open with no labels and 12 comments, and none is from a maintainer. On the related issue #6056, maintainer seratch said the supported pattern is to load the checkpoint the reviewer is authorized to act on and resolve an item from that checkpoint's get_interruptions(). seratch also wrote: 'In #5413 the second state already has a matching interruption, so removing this fallback would leave that case unchanged.' #6056 was closed on Nov 17, 2026 with 'We're closing this as not planned.' That comment does not change #5413.
Does this still happen in the latest openai-agents?
Yes, in our tests. openai-agents 0.26.0, uploaded to PyPI on Nov 24, 2026 UTC, was still the latest on Nov 30, 2026. Our suite reproduced the transfer in 30 of 30 runs with Runner.run and in 30 of 30 with Runner.run_streamed. The reporter was on v0.23.1. There is no fix PR linked to #5413.
How do I stop a stale approval item from authorizing a new OpenAI Agents run?
Use the guard sattyamjjain already described on issue #5413: keep your own record of the run or session ID, call_id and arguments for each pending interruption, only approve items taken from the interruptions of the state you are resuming, and never persist ToolApprovalItems to replay them into another run. We tested that approach as tickets: at pause, issue a ticket bound to your run id, the call_id and an args hash, and only call approve() for a ticket issued for the run you are resuming. A run-1 ticket presented to run 2 was refused in 30 of 30 runs and the tool did not run again. A ticket issued for run 2 was accepted in 30 of 30.
Why is checking only the call_id, the call_id plus arguments, or object identity not enough?
The stale item has the same call_id and the same arguments as the new pending call. So a check on the call_id alone, or on the call_id plus an args hash, let the transfer through in 30 of 30 runs (0 of 30 protected). Object identity fails the other way: get_interruptions() returns copies, so a legitimate item from result.interruptions is a different object and is not equal to the copy. That check refused a valid current-run approval in 30 of 30. The issue comments already noted that object identity is not a usable check.
How is this different from the site's other OpenAI Agents approval guides, and is there a tested template for this exact guard?
The tool approval and resume guide is the basic pause, approve and resume how-to. The approved-tool-runs-again-after-crash guide is about a tool running twice after a crash that follows one valid approval, which is an idempotency problem. This page is about an approval from one run being accepted in a different run. The Tool approval and resume template is the basic needs_approval starter and does not include this ticket guard. There is no template for this exact guard; the tested pattern is the ticket code in this guide, 30 of 30 on openai-agents 0.26.0.
Related
- OpenAI Agents SDK tool approval and resume: needs_approval, interruptions and RunState. The basic pause, approve and resume how-to. It does not cover this cross-run transfer.
- OpenAI Agents SDK approved tool runs again after a crash. The crash-after-approval idempotency guide: one valid approval, a crash, and a second run of the same call. Not this cross-run transfer.
Templates: Tool approval and resume is the basic needs_approval starter. It does not include this ticket guard. The Pro Idempotent approved side effects starter is about crash and duplicate side effects, not this transfer. You can browse everything in the templates index.
Stuck on an OpenAI Agents SDK approval or resume flow? Send a minimal repro; you pay $79 only when our patch passes it.