Approval decision transfers across runs when call ID is reused
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 53/100
Research direction
Start in agents/run_state.py at RunState.approve() and trace how approval records are stored and checked when a run resumes. Reproduce the issue with the scripted two-run example in the report, then inspect the existing changed-arguments and no-decision cases. Done when an approval from the first run cannot authorize the repeated call in the second run, while approvals within the issuing run still work.
Written by the indexing model from the issue text.
Description
Description
In the OpenAI Agents SDK (tested on v0.23.1), an approval decision issued in one run can authorize a protected tool call in a different run when the same call_id is used with identical arguments. The approval record is keyed by call_id but not bound to the run lineage.
Location: agents/run_state.py — RunState.approve() accepts a ToolApprovalItem from a previous run.
Reproduction (offline, scripted model)
# Run 1: request approval for write_marker(path="A"), approve it
result1 = await Runner.run(agent, "do it", context=ctx1)
state1 = result1.to_state()
state1.approve(result1.interruptions[0]) # approve args=A
result1b = await Runner.run(agent, state1) # executes args=A ✓
# Run 2: NEW run, same agent, same tool, same call_id, same args
result2 = await Runner.run(agent, "do it again", context=ctx2)
state2 = result2.to_state()
state2.approve(old_approval_item) # ← passes the OLD approval item
result2b = await Runner.run(agent, state2) # executes AGAIN ✓ ← bug
The second run executes the protected callback without a fresh approval decision, because state2.approve() accepts the ToolApprovalItem object from run 1.
Boundaries (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
- The issue is specifically the cross-run transfer of the approval object
Impact
In scenarios where serialized sessions are replayed, or a proxy/load balancer reassigns call IDs, a stale approval from a previous interaction can authorize a new execution. The SDK documents call IDs as unique within a run, but does not bind approval records to the issuing run's lineage.
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()). This would prevent cross-run approval transfer without affecting the per-call binding that already works correctly.
- Dominant language
- Python
- Stars
- 30.2k
- Forks
- 4.9k
- Avg merge
- 12h 35m
- Merged PRs (30d)
- 144
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from openai/openai-agents-python
-
fix(typing): explicitly specialize ToolContext[Any] in ToolFunctionWithToolContextMay be free again @AbarnaaSree claimed this 8 days ago, and no pull request is open. Open
Difficulty 1/5 Under an hour Newbie friendliness 85/100
openai/openai-agents-python#5387 · 4 comments ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 44/100
openai/openai-agents-python#5416 ·
Maintainers usually reply within 1 day
-
Agent with no model keeps GPT-5 default model settings when the model provider chooses the modelPossibly taken @jbeckwith-oai claimed this today. Open
Difficulty 4/5 1-2 days Newbie friendliness 25/100
openai/openai-agents-python#5414 · 1 comment ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 45/100
openai/openai-agents-python#5412 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
openai/openai-agents-python#5411 ·
Maintainers usually reply within 1 day
All issues in openai/openai-agents-python
Similar issues
-
[oblt-aw][autodoc] Update docs for security org scaffolding and Docs AI menu permission changesPossibly taken @github-actions claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
external integration integration-submission
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
langchain-ai/docs#7077 ·
Maintainers usually reply within 1 day
-
author-page correction
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
acl-org/acl-anthology#10623 · 1 comment ·
Maintainers usually reply within 1 day
-
Use context to recognize personal initials and lowercase namesPossibly taken @lipikaramaswamy claimed this today. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
NVIDIA-NeMo/Anonymizer#340 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 82/100
btclib-org/btclib-node#2083 ·
Maintainers usually reply within 1 day