Skip to content
Source
Sign inSign up
pingdotgg/t3code

[Bug]: Deleting a thread's worktree while its session is "running" permanently wedges the thread (archive blocked, reaper never clears it) #4723

Closedalexito4(GitHub profile, opens in a new tab) opened this issue 2 comments

Before submitting

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

Area

apps/server

Steps to reproduce

  1. Start a thread and let its provider session reach status: "running" with an active turn, bound to a git worktree.
  2. Outside the app, delete that worktree's directory (e.g. it was removed by other tooling, or manually).
  3. The provider process/cwd for that thread is gone, but nothing updates the thread's session state.
  4. Try to archive the thread from the sidebar.

Expected behavior

The thread's session should eventually reflect that the underlying process/worktree is gone (e.g. via the idle/session reaper), or archiving should be possible once that's detected.

Actual behavior

The thread is permanently stuck. The client's archive guard (apps/web/src/hooks/useThreadActions.ts:158-172) refuses to archive any thread with session.status === "running" and a non-null activeTurnId. ProviderSessionReaper (apps/server/src/provider/Layers/ProviderSessionReaper.ts:59-67) unconditionally skips any thread with activeTurnId set, no matter how stale, so nothing ever clears it automatically.

Impact

Minor bug or occasional failure

Version or commit

main @ 4f584da0f

Workaround

Switch the thread to a different branch/worktree via the branch toolbar selector — this triggers thread.session.stop, which unconditionally sets status: "stopped", activeTurnId: null through the normal event path. Avoid using the regular Stop button first, since turn-interrupt uses allowRecovery: true and may try to restart the session in the missing worktree.

  1. i was running into this as well, and opened https://github.com/pingdotgg/t3code/pull/6197 to add graceful recovery for this scenario. imo the best thing to do is just check that branch out from origin if it still exists and reestablish the thread on top of it.

  2. Same here. The issue still exists on 0.0.39. It now gives error: Orchestration command invariant failed (thread.settle): Thread 'xxxx-xxxx-xxxx-xxxx-xxxxxxxxx' is already archived and cannot handle command 'thread.settle'.

  3. juliusmarminge closed this

Sign in to join this conversation.