Skip to content

Support multiple provider sessions per worktree#171

Merged
patrickdappollonio merged 3 commits intomainfrom
session-swapping
Apr 13, 2026
Merged

Support multiple provider sessions per worktree#171
patrickdappollonio merged 3 commits intomainfrom
session-swapping

Conversation

@patrickdappollonio
Copy link
Copy Markdown
Owner

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. claude and codex) 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 its resume_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.

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.
@patrickdappollonio patrickdappollonio merged commit d58c83b into main Apr 13, 2026
4 checks passed
@patrickdappollonio patrickdappollonio deleted the session-swapping branch April 13, 2026 04:53
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.

1 participant