fix(run): keep tool guardrail results when a resumed run interrupts again - #4239
Merged
seratch merged 1 commit intoAug 6, 2026
Conversation
…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
approved these changes
Aug 6, 2026
seratch
enabled auto-merge (squash)
August 6, 2026 00:24
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.runbuilds itsRunResultfrom the turn-localturn_result.tool_input_guardrail_resultsandturn_result.tool_output_guardrail_results, then returns immediately, so it never reaches the run-wideextenda few lines below. Those run-wide lists are the ones hydrated fromRunState._tool_input_guardrail_resultsand_tool_output_guardrail_resultsat 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.pymirrors the existing resume test in that file but ends in a second interruption instead of a final output. On main it fails withassert ['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, andmake testsall pass.