fix: preserve tool guardrail results across handoffs in SingleStepResult#3237
Merged
seratch merged 1 commit intoopenai:mainfrom May 8, 2026
Merged
fix: preserve tool guardrail results across handoffs in SingleStepResult#3237seratch merged 1 commit intoopenai:mainfrom
seratch merged 1 commit intoopenai:mainfrom
Conversation
…e tool calls When a model response contains both function tool calls and a handoff, execute_handoffs returned an empty tool_input_guardrail_results / tool_output_guardrail_results list, silently dropping any guardrail results produced by the function tools that ran before the handoff. Thread the guardrail results from execute_tools_and_side_effects (and resolve_interrupted_turn) through to the SingleStepResult returned by execute_handoffs so callers (e.g. run.py aggregating per-turn guardrail results) observe them in RunResult.tool_input_guardrail_results.
Member
|
@codex review |
|
Codex Review: Didn't find any major issues. Delightful! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
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.
Summary
execute_handoffswas returning an emptytool_input_guardrail_results/tool_output_guardrail_resultslist, silently dropping any guardrail results produced by the function tools that ran before the handoff was dispatched.run.pyextends the run-wide guardrail-result lists from eachturn_result, so dropping these on a handoff turn meansRunResult.tool_input_guardrail_results(and the output equivalent) is missing entries that the caller paid to compute and explicitly opted into.execute_tools_and_side_effectsandresolve_interrupted_turnthrough to theSingleStepResultreturned byexecute_handoffs.Test plan
test_execute_handoffs_preserves_tool_input_guardrail_resultscovers a single response containing a guarded function tool call alongside a handoff and asserts the guardrail result survives the handoff.tests/test_run_step_execution.py(87 tests),tests/test_run_step_processing.py,tests/test_handoff_tool.py,tests/test_process_model_response.py,tests/test_extension_filters.py,tests/test_agent_runner.pyall pass.