You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the Copilot CLI agent panel creates a git worktree (e.g. for a new branch session), it places the worktree as a sibling directory inside the current workspace folder. For most projects this is harmless. For projects that are themselves loaded by a runtime that recursively scans the workspace folder for plugins/modules — such as ComfyUI, which scans custom_nodes/ and loads every subdirectory with an __init__.py — this causes silent duplicate loading.
Steps to reproduce:
Have a project structured as a runtime plugin (e.g. a ComfyUI custom node at custom_nodes/MyPlugin/)
Open that folder as a VS Code workspace and launch the Copilot CLI agent panel
The agent creates a worktree branch, placing it at custom_nodes/MyPlugin.worktrees/my-branch/
The worktree contains __init__.py (inherited from the branch)
Start the host runtime (ComfyUI)
Expected behavior:
The worktree is created outside the workspace folder — e.g. a sibling of the workspace root — so it is invisible to the runtime's plugin scanner. Or: the user is warned that the proposed worktree path falls inside a directory that may be scanned by a plugin loader, and offered an alternative path.
Actual behavior:
The worktree lands inside custom_nodes/, directly in the runtime's scan path. The runtime loads both the main plugin folder and the worktree as separate instances of the same plugin. First-registration wins for node classes and frontend JS files. Changes made in the worktree are silently overridden by the main repo version (or vice versa, depending on load order). The developer sees stale behavior and has no indication why — the duplicate is invisible in the runtime UI.
Why this matters:
This affects any project where:
The workspace root IS the plugin/module directory (not just a parent of it)
The host runtime scans recursively for entrypoints (__init__.py, package.json, index.js, etc.)
The developer uses the agent panel for branch-isolated dev work (the intended use case)
ComfyUI is one example. The pattern applies equally to VSCode extensions, pytest plugin directories, Poetry monorepos, Webpack multi-entry setups, and any other ecosystem where a recursive scan of a source directory drives runtime loading.
Proposed fix:
Default worktree creation path to one level above the workspace root (e.g. ../MyPlugin.worktrees/) rather than inside it
Or: allow the user to configure a default worktree base path in settings (copilot.agent.worktreeBasePath)
Or: at minimum, warn when the proposed worktree path is inside the workspace folder and the workspace contains an __init__.py, package.json, or similar runtime entrypoint at its root
Activity
sandstrom commentedon May 14, 2026
See this issue (and upvote if you agree) about making it configurable.
#293884