Support multiple provider sessions per worktree#171
Merged
patrickdappollonio merged 3 commits intomainfrom Apr 13, 2026
Merged
Conversation
Allow users to have multiple agent sessions with different providers (e.g. claude and codex) sharing the same git worktree, with only one active PTY at a time. When switching between sessions on a shared worktree, the previously active agent is automatically detached. Adds a provider mismatch notification when reconnecting a session whose provider differs from the project's current default, a "new-provider-session" command palette action for creating a session with a different provider on an existing worktree, and safe worktree deletion that preserves shared worktrees when sibling sessions still reference them.
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.
Previously, each agent session was permanently bound to the provider it was created with, and there was no way to use a different provider on the same worktree without creating a new branch. This change allows multiple sessions with different providers (e.g.
claudeandcodex) to coexist on a single worktree. Only one PTY can be active at a time per worktree — when switching between sessions, the previously active agent is automatically detached and can be resumed later with itsresume_args(e.g.--continue).When reconnecting to a session whose provider differs from the project's current default, an informational note is shown so the user is aware of the mismatch. A new "new-provider-session" command palette action lets users create an additional session on an existing worktree using the project's current default provider. The action validates that the agent is stopped, the target provider differs from the current one, and no duplicate already exists.
Session deletion is now worktree-aware: deleting one session from a shared worktree only removes the session record while preserving the worktree and branch for remaining sibling sessions. The worktree is only cleaned up when the last session referencing it is deleted. Ten new unit tests cover conflict detection, auto-detach behavior, validation guards, and safe deletion logic.