Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions sentry_sdk/integrations/openai_agents/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,18 @@ def new_wrapped_get_model(

agents.run_internal.run_loop.get_model = new_wrapped_get_model

if not use_run_hooks and hasattr(run_loop, "get_all_tools"):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unreachable get_all_tools patch

High Severity

The new get_all_tools wrap is gated on not use_run_hooks, but this block only runs for openai-agents >= 0.8, where use_run_hooks is always true. The condition can never succeed, so the patch never installs and the PR's intended tool-call spans stay missing.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 3508792. Configure here.

original_get_all_tools = run_loop.get_all_tools
@wraps(original_get_all_tools)
async def new_wrapped_get_all_tools(
agent: "agents.Agent", context_wrapper: "agents.RunContextWrapper"
) -> "list[agents.Tool]":
return await _get_all_tools(
original_get_all_tools, agent, context_wrapper
)
agents.run_internal.run_loop.get_all_tools = new_wrapped_get_all_tools
Comment thread
cursor[bot] marked this conversation as resolved.


if turn_resolution is not None:
original_execute_handoffs = turn_resolution.execute_handoffs

Expand Down