[Bug]: Second thread steals first thread's live file-change feed — diffs render in wrong session, original thread goes stale
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 23k
- Forks
- 5.9k
- Avg merge
- 11h 14m
- Merged PRs (30d)
- 357
Description
Steps to reproduce
- Open a t3 Code thread ("Thread A") on a project directory and give the agent a task that edits files over several minutes.
- While Thread A's agent is still running and producing edits, open a second, separate thread ("Thread B") against the same project/workspace. Thread B asks an unrelated question and makes no file changes of its own.
- Observe where file-change/diff events render in each thread.
Expected behavior
- File-change events are attributed to the session whose agent produced them: Thread A's diffs render in Thread A.
- Opening a new thread never affects an existing thread's live view.
Actual behavior
- Thread B (which changed nothing) starts showing Thread A's file changes.
- Thread A's live view goes stale — its own subsequent edits stop appearing in its UI/chat entirely.
- The misattribution persists for the rest of both sessions; reloading does not re-parent the stream correctly.
Notes / hypothesis
The two threads share one workspace, so the client likely subscribes to a single workspace-level file-watcher/change stream, and opening the second thread re-binds that stream to the most recently opened thread. That would explain all three symptoms at once:
Thread 1 starts edits ──► watcher stream ──► renders in Thread 1 ✓
You open Thread 2 ──────► stream re-binds to Thread 2
Thread 1 keeps editing ─► same stream ──────► renders in Thread 2 ✗
Thread 1's feed: dead ✗
This is worse than a display glitch: it makes it impossible to tell which agent touched which files, and a user reviewing "their" session's diff panel can silently be reviewing another agent's work-in-progress tree.
Impact
Major degradation or frequent failure
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with two t3 Code threads sharing one project/workspace, then trace the client’s workspace-level file-watcher/change-stream subscription as Thread B opens. Done means Thread A continues receiving its agent’s file-change events, Thread B does not receive them, and reloading does not misattribute either stream.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 54/100