Before submitting#
Area#
apps/server
Steps to reproduce#
- Start a thread and let its provider session reach
status: "running" with an active turn, bound to a git worktree.
- Outside the app, delete that worktree's directory (e.g. it was removed by other tooling, or manually).
- The provider process/cwd for that thread is gone, but nothing updates the thread's session state.
- 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.
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.