Skip to content

fix: prevent recursive run_skill loop in context:fork skill sub-sessions#2289

Open
dgageot wants to merge 1 commit intodocker:mainfrom
dgageot:board/docker-agent-issue-2267-status-inquiry-37a00c98
Open

fix: prevent recursive run_skill loop in context:fork skill sub-sessions#2289
dgageot wants to merge 1 commit intodocker:mainfrom
dgageot:board/docker-agent-issue-2267-status-inquiry-37a00c98

Conversation

@dgageot
Copy link
Copy Markdown
Member

@dgageot dgageot commented Mar 31, 2026

Summary

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.

Changes

  • Add ExcludedTools field to Session and SubSessionConfig so skill sub-sessions can filter out run_skill from their available tools
  • Add filterExcludedTools() in RunStream to apply the exclusion
  • Inherit parent exclusions in nested sub-sessions via mergeExcludedTools() to prevent re-introduction of filtered tools at any nesting depth (e.g. skill → transfer_task → child)

Fixes #2267

@dgageot dgageot requested a review from a team as a code owner March 31, 2026 08:39
aheritier
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
@dgageot dgageot force-pushed the board/docker-agent-issue-2267-status-inquiry-37a00c98 branch from 739907e to a22a3c4 Compare March 31, 2026 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Setting context: fork in a skill results in run_skill loop

2 participants