Skip to content

fix: preserve tool guardrail results across handoffs in SingleStepResult#3237

Merged
seratch merged 1 commit intoopenai:mainfrom
adityasingh2400:fix/tres-audit
May 8, 2026
Merged

fix: preserve tool guardrail results across handoffs in SingleStepResult#3237
seratch merged 1 commit intoopenai:mainfrom
adityasingh2400:fix/tres-audit

Conversation

@adityasingh2400
Copy link
Copy Markdown
Contributor

Summary

  • When a model response contains both function tool calls and a handoff, execute_handoffs was returning 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 was dispatched.
  • The aggregator in run.py extends the run-wide guardrail-result lists from each turn_result, so dropping these on a handoff turn means RunResult.tool_input_guardrail_results (and the output equivalent) is missing entries that the caller paid to compute and explicitly opted into.
  • Thread the guardrail results from execute_tools_and_side_effects and resolve_interrupted_turn through to the SingleStepResult returned by execute_handoffs.

Test plan

  • New test test_execute_handoffs_preserves_tool_input_guardrail_results covers a single response containing a guarded function tool call alongside a handoff and asserts the guardrail result survives the handoff.
  • Existing 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.py all pass.

…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.
@github-actions github-actions Bot added bug Something isn't working feature:core labels May 8, 2026
@seratch
Copy link
Copy Markdown
Member

seratch commented May 8, 2026

@codex review

@seratch seratch changed the title fix(run): preserve tool guardrail results across handoffs fix: preserve tool guardrail results across handoffs in SingleStepResult May 8, 2026
@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

@seratch seratch merged commit cc5a392 into openai:main May 8, 2026
10 checks passed
@seratch seratch added this to the 0.17.x milestone May 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working feature:core

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants