t3code icon indicating copy to clipboard operation
t3code copied to clipboard

[Bug]: Working threads keep jumping out of the Working group into the main list and back

Open aminefourari opened this issue 3 weeks ago • 1 comments

Before submitting

  • [x] I searched existing issues and did not find a duplicate.
  • [x] I included enough detail to reproduce or investigate the problem.

Area

apps/web

Steps to reproduce

  1. Turn on the Working shelf in the sidebar.
  2. Run two threads in one local project (here, two threads in the same project, each working for 5+ minutes).
  3. Leave a few idle threads from other projects in the main list.
  4. Watch the sidebar while both threads keep working.

Expected behavior

The two working threads stay under the Working group for as long as they keep working.

Actual behavior

Every few seconds the two threads leave the Working group and appear at the top of the main list, above the most recent idle thread, with no Working header around them. A few seconds later they jump back into the Working group. This repeats for as long as they run. Their status stays "Working" the whole time, so nothing visible explains the move.

Impact

Major degradation or frequent failure

Version or commit

T3 Code 0.1.7 (local server 0.1.7)

Environment

macOS (Darwin 27.0.0), Apple silicon. Both threads run on the local server, with no remote environment involved. Provider: Claude.

Logs or stack traces

No response

Screenshots, recordings, or supporting files

No response

Workaround

Turn off the Working shelf.

Notes

This looks like #30680, but that issue only covers a remote environment whose connection blips (disconnectedEnvironmentIds). Here every thread is local and stays connected, so the cause must be something else.

Placement comes from inboxReturns.observe(...).isWorking in partitionSidebarThreads (apps/web/src/components/Sidebar.tsx), which uses isThreadWorking and createInboxReturnTracker (packages/client-runtime/src/state/threadInbox.ts). When a thread leaves the shelf it gets a fresh returnedAt, and sortInboxThreadsByReturn sorts it to the top of the main list. That matches where the rows show up. So isThreadWorking most likely returns false briefly while the thread is still running, for example between runs, when latestRun/runtime lag behind, or on a short pendingSubagentRequest. When that happens the 2 s exit grace either doesn't apply (actionable/moved skip it) or runs out before the next update. Related: #30197, #25449.

aminefourari avatar Nov 07 '26 22:11 aminefourari

Thanks for the detailed report. This is already fixed on main by pingdotgg/t3code#31269 (commit 34701646e3), which landed on Nov 5, after 0.1.7 was cut. It ships in the 0.1.8 nightlies.

Cause. In 0.1.7 the sidebar took every working thread out of the Working group whenever its environment's shell stream wasn't "live". That included the local environment: during a brief resync or resubscribe of the shell stream, the local server counts as disconnected even though it never goes offline. Every working thread in that environment then dropped into the main list at once, with no Working header, and moved back when the stream caught up. This is the same code path as https://git.cafe/pingdotgg/t3code/issues/30680. It isn't specific to remote environments.

What I ran. Fresh database each time, web dev server, Working group on, two Claude threads in one project each running about 4 minutes of sequential sleep 15; date tool calls, and an idle thread from a second project in the main list. To trigger a resync, I closed the client's /ws socket once while both threads were working and recorded the Working group count every 50 ms.

  • v0.1.7: 1.3 s after the drop, the Working header disappeared and both threads showed at the top of the main list, still labelled "Working". At 3.7 s they jumped back to "Working 2" (screenshot attached).
  • main at a9e709f15f: the count stayed at "Working 2" through the drop and the reconnect.
  • main, no socket drop, over about 8 minutes (plain tool calls; then subagents plus a background Bash task): the threads left the Working group only when their runs actually finished.

Closing as fixed on main. If it still happens on a 0.1.8 nightly or later, comment with the version and we'll reopen.

AI-assisted; verified with the tests and tools listed above.

v0.1.7: both working threads in the main list with no Working header after a shell resync

juliusmarminge avatar Nov 07 '26 22:11 juliusmarminge