Switching to a new branch in a session also affects the running session, causing it to switch to the new branch as well. #4073

Closed
opened 2026-02-16 17:42:31 -05:00 by yindo · 3 comments
Owner

Originally created by @gasatrya on GitHub (Jan 1, 2026).

Originally assigned to: @rekram1-node on GitHub.

Description

One of the rules I set for starting a new feature is that the agent should create a new branch before beginning work. I ran this while another session was still active. When the new session’s agent created a branch, switched to it, and started working, the running session also switched to the new branch. This caused confusion and conflicts in the running session.

Is there a way to prevent this, or is this the expected behavior?

OpenCode version

1.0.223

Steps to reproduce

  1. Start session with new branch
  2. Start new session with new branch as well

Screenshot and/or share link

Image Image

Operating System

WSL 2

Terminal

Windows Terminal

Originally created by @gasatrya on GitHub (Jan 1, 2026). Originally assigned to: @rekram1-node on GitHub. ### Description One of the rules I set for starting a new feature is that the agent should create a new branch before beginning work. I ran this while another session was still active. When the new session’s agent created a branch, switched to it, and started working, the running session also switched to the new branch. This caused confusion and conflicts in the running session. Is there a way to prevent this, or is this the expected behavior? ### OpenCode version 1.0.223 ### Steps to reproduce 1. Start session with new branch 2. Start new session with new branch as well ### Screenshot and/or share link <img width="1920" height="1080" alt="Image" src="https://github.com/user-attachments/assets/3c96566b-328d-43af-9b3d-75a2e60d9478" /> <img width="1920" height="1080" alt="Image" src="https://github.com/user-attachments/assets/bbbfe2cc-e340-4f2b-877f-cc802be42467" /> ### Operating System WSL 2 ### Terminal Windows Terminal
yindo added the windows label 2026-02-16 17:42:31 -05:00
yindo closed this issue 2026-02-16 17:42:31 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 1, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #4251: Concurrent sessions working on different repos interfere each other
  • #5824: Switching branches causes visual artifacts in TUI

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Jan 1, 2026): This issue might be a duplicate of existing issues. Please check: - #4251: Concurrent sessions working on different repos interfere each other - #5824: Switching branches causes visual artifacts in TUI Feel free to ignore if none of these address your specific case.
Author
Owner

@rekram1-node commented on GitHub (Jan 1, 2026):

I think what you are looking for is git worktrees? Branches dont provide isolation if ur running both sessions in same worktree

@rekram1-node commented on GitHub (Jan 1, 2026): I think what you are looking for is git worktrees? Branches dont provide isolation if ur running both sessions in same worktree
Author
Owner

@gasatrya commented on GitHub (Jan 2, 2026):

Oh, I see. Since you mentioned it, I did a quick bit of research. Thanks, @rekram1-node

@gasatrya commented on GitHub (Jan 2, 2026): Oh, I see. Since you mentioned it, I did a quick bit of research. Thanks, @rekram1-node
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#4073