fix: honor IGNORE_ON_ENTER for tools inside a Toolset - #6361
Merged
Conversation
davidzhao
approved these changes
Jul 9, 2026
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.
Closes #6354
ToolFlag.IGNORE_ON_ENTERwas only honored for bareFunctionTool/RawFunctionToolinstances in theon_enterreply filter — tools nested in aToolset(e.g.EndCallTool) passed through unfiltered, so the model could fire a speculativeend_callduring the greeting turn (withdelete_room=True, an instant hangup at pickup).The filter now flattens toolsets and hides flagged tools via
ToolContext._exclude, which drops them from the callable/LLM-visible set while keeping the owning toolset in place so executor routing and lifecycle are unaffected. Rather than threading the ignored set through the reply tasks,_on_enter_ignored_toolsreads theon_entercontextvar directly; the reply task and its tool-response follow-ups inherit it throughasyncio.create_task.The realtime path is covered too: it only overrides its session tools when
generate_replyis giventools=, so insideon_enterit now falls back to the agent's full set and hides flagged tools even without an explicittools=.EndCallToolgains anignore_on_enterparameter (defaults toFalse, preserving current behavior) to opt into hidingend_callduring the greeting.