[Bug]: Diff shows prior branch's changes as deletions after switching checked-out branch mid-thread#8204

openedAug 25, 2026byDdanielo515

Steps to reproduce:

  1. In a thread, ask the agent to make changes on branch A (checked out).
  2. Ask the agent to switch to and make changes on branch B, which gets checked out.
  3. View the diff for the latest turn.

Expected: Diff for the latest turn shows only the changes made on branch B in that turn.

Actual: The changes previously made on branch A appear in the latest turn's diff as deletions (since branch B doesn't have those changes, the diff-against-branch-A-state treats them as removed).

Likely cause: The diff is computed against a stale base ref (the previously checked-out branch) instead of the newly checked-out branch's actual base.

Reproduced on Linux in the web dev app at ed9b7ca9c5. In one thread: committed an A-only a.txt on branch A, then asked the agent to switch to branch B (created from the original base) and create uncommitted b.txt. The second turn lists a.txt as a deletion and b.txt as an addition. No matching open fix PR found.

Latest turn diff after switching from branch A to branch B