Skip to content

fix(run): keep tool guardrail results when a resumed run interrupts again - #4239

Merged
seratch merged 1 commit into
openai:mainfrom
adityasingh2400:fix-resumed-interruption-tool-guardrail-results
Aug 6, 2026
Merged

fix(run): keep tool guardrail results when a resumed run interrupts again#4239
seratch merged 1 commit into
openai:mainfrom
adityasingh2400:fix-resumed-interruption-tool-guardrail-results

Conversation

@adityasingh2400

Copy link
Copy Markdown
Contributor

When a resumed run interrupts a second time, every tool guardrail result carried over from the previous run is lost. The resumed interruption branch in AgentRunner.run builds its RunResult from the turn-local turn_result.tool_input_guardrail_results and turn_result.tool_output_guardrail_results, then returns immediately, so it never reaches the run-wide extend a few lines below. Those run-wide lists are the ones hydrated from RunState._tool_input_guardrail_results and _tool_output_guardrail_results at the top of the run, so the carried-over results are silently dropped.

The non-resumed interruption path in the same function already passes the accumulated lists, and the streamed path accumulates them too since #4097, so this branch was the outlier. The fix extends the accumulated lists with the turn's results and passes those, matching both siblings. The new test in tests/test_runner_guardrail_resume.py mirrors the existing resume test in that file but ends in a second interruption instead of a final output. On main it fails with assert ['new_tool_input_guardrail'] == ['state_tool_input_guardrail', 'new_tool_input_guardrail'], and the existing final-output test keeps passing, which isolates the failure to the re-interruption path. make lint, make typecheck, and make tests all pass.

…gain

The resumed interruption branch built its RunResult from the turn-local
turn_result lists and returned before the run-wide extend below it, so every
tool guardrail result hydrated from the RunState was dropped whenever a
resumed run interrupted a second time. The non-resumed interruption path in
the same function passes the accumulated lists, and the streamed path
accumulates them too since openai#4097, so this branch was the outlier.
@seratch seratch added this to the 0.20.x milestone Aug 6, 2026
@seratch
seratch enabled auto-merge (squash) August 6, 2026 00:24
@seratch
seratch merged commit 36d50b0 into openai:main Aug 6, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants