pingdotgg / pingdotgg/t3code

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

Open
#4,723 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
23k
Forks
5.9k
Avg merge
11h 14m
Merged PRs (30d)
357

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with apps/web/src/hooks/useThreadActions.ts:158-172 and apps/server/src/provider/Layers/ProviderSessionReaper.ts:59-67, then trace how missing worktrees affect provider session state. Reproduce the running-thread worktree deletion and archive attempt. Done when a missing process or worktree no longer leaves activeTurnId permanently set and the thread can be archived.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
full-stack
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
74/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.