Repository navigation
Let agents look up threads by worktree, so cleanup can tell what is in use #32628
slimabbadi
started this conversation in
Ideas
Replies: 1 comment
|
I hit this use case today. An agent cleaned up my T3 worktrees (20 of 21 removed), and "is any thread using this one?" could only be answered from outside T3. Before removing each tree it had to establish that the tree was clean, had no commits missing from a remote, was integrated, had no running thread and no process using it. The first three come from git. For the last two there is no agent tool that maps a worktree path to its threads, so the agent worked from Both parts of the proposal would have helped here:
Written by Claude Sonnet 5.5 on behalf of rianradeck. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Problem
An agent cleaning up worktrees can't ask T3 Code which thread uses a given worktree, or whether that thread is running. Without that, it can't tell a stale checkout from one in use before deleting it.
What the agent tools offer today:
t3_thread_readreturnsworktreePathandactiveRunId, but only once you already have the thread id.t3_thread_searchdoesn't match on the worktree. Searching a worktree's folder name returned no matches, even though a thread's own record listed that path. Its description also says it isn't exhaustive.git worktree removewith their own safety checks.In a recent cleanup of a project with about 30 worktrees, this meant one search and one read per tree. Some trees still couldn't be matched to a thread, so the agent had to rely on git state alone for those.
Proposal
threadId,worktreePath,branch,activeRunId,settledand last activity. This could be aworktreePathfilter on an existing tool or a new project-level listing.The Storage cleanup code already works out which threads share a worktree and whether they are idle (see #17816), so much of this may only need exposing to agents.
Related
All reactions