fix: prevent recursive run_skill loop in context:fork skill sub-sessions#2289
Open
dgageot wants to merge 1 commit intodocker:mainfrom
Open
fix: prevent recursive run_skill loop in context:fork skill sub-sessions#2289dgageot wants to merge 1 commit intodocker:mainfrom
dgageot wants to merge 1 commit intodocker:mainfrom
Conversation
aheritier
previously approved these changes
Mar 31, 2026
When a skill with context:fork was executed via run_skill, the sub-session inherited the full tool list including run_skill itself, causing infinite recursion. Fix by adding an ExcludedTools mechanism to sessions so that skill sub-sessions filter out run_skill from their available tools. Nested sub-sessions (e.g. skill -> transfer_task -> child) inherit excluded tools from parent sessions to prevent re-introduction of filtered tools at any nesting depth. Fixes docker#2267 Assisted-By: docker-agent
739907e to
a22a3c4
Compare
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
When a skill with
context: forkwas executed viarun_skill, the sub-session inherited the full tool list includingrun_skillitself, causing infinite recursion.Changes
ExcludedToolsfield toSessionandSubSessionConfigso skill sub-sessions can filter outrun_skillfrom their available toolsfilterExcludedTools()inRunStreamto apply the exclusionmergeExcludedTools()to prevent re-introduction of filtered tools at any nesting depth (e.g. skill → transfer_task → child)Fixes #2267