You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit ede6b4b
Browse filesBrowse the repository at this point in the historyBrowse files
fix(server): cleanup follows the branch an agent checked out (#68)
* fix(server): cleanup follows the checked-out branch
Maintenance kept every worktree whose agent had switched branches, because
nothing wrote HEAD back to the thread. A new WorktreeBranches service reads
HEAD and rebinds the threads on that worktree. Cleanup keeps for one pass after
a rebind, then applies the existing rules. A detached HEAD stays kept unless a
ref outside refs/t3 holds its commit.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* fix(server): threads learn their branch when a run ends
A thread kept its old branch name after its agent switched branches, so the
pull request refresh skipped it and cleanup had to repair it later. Run
finalization now syncs the worktree branch before that refresh. A sync failure
only logs, so it cannot block the next turn.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* refactor(server): launch rebinds threads through worktree branch sync
Launch carried its own copy of the loop that writes a branch to every thread
on a worktree. It now calls WorktreeBranches.sync after the rename, so one path
writes thread.branch for a worktree.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* test(server): a rebound thread recreates on its new branch
Pins the resume half of the cleanup change. Once a thread is rebound and its
worktree is removed, the next turn recreates the checkout on the branch the
agent switched to, at that commit, and not on the stale name.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* test(server): cleanup removes a deleted owner's worktree after a rebind
A deleted owner's record cannot be rewritten, so only its surviving subagents
are rebound. This pins that the group comparison still lets removal proceed on
the next pass, and that the branch ref survives.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
* fix(server): branch sync leaves foreign checkouts and held branches alone
An independent check of the cleanup change found three ways to lose or strand
work. A different repository at the worktree path had its branch written to the
thread, so the thread forgot its own branch. A branch another checkout holds was
recorded even though the thread could not recreate its worktree there. And the
detached HEAD check ran before later steps that gave a holding ref time to go.
Sync now compares the worktree's repository with the project's before it writes,
and treats a branch another checkout holds like the default branch. Cleanup checks
the holding ref last, immediately before removal.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(server): a prunable remote branch does not protect a detached commit
Cleanup counted any remote-tracking ref as holding a detached commit. A routine
`git fetch --prune` removes a remote branch that was deleted upstream, so the
commit could become unreachable after its worktree was gone.
Only local branches, tags, and the remote's default branch count now. A detached
worktree held by any other remote branch stays kept.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(server): cleanup keeps what removal would strand and rebinds every thread
Adversarial review reproduced more ways for this change to lose work or never
finish. Removing a detached or default-branch worktree could lose a commit only
its reflog held, or strand a thread whose recorded branch another checkout held.
A remote-tracking ref counted as protecting a commit even though a routine prune
or a stale origin/HEAD could remove that protection. A run end skipped a sibling
whose write had been deferred to it. Threads with a trailing slash in their path
or no recorded branch never rebound, and mismatched records on a detached or
default-branch worktree were kept forever. A held index lock blocked rebinding,
and main counted as the default branch when the remote's default was trunk.
Cleanup now checks HEAD and the reflog against local branches and tags only, and
keeps a worktree while another checkout holds a recorded branch. Sync compares
HEAD with every thread on the worktree instead of the caller's record, reads HEAD
without depending on the index lock, finds threads by the path each one stored,
and asks the remote when no local HEAD ref names its default.
Model: Opus 5.5
Harness: Claude Code in T3 Code
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(server): cleanup keeps commits only a reflog holds on every worktree
An adversarial review of this branch reproduced commit loss that main prevents.
A rebound worktree counted as bound on its next pass, which skipped the reflog
check, so cleanup removed it and gc then pruned commits only its reflog held. A
deleted owner with no surviving threads skipped the same check. Another
repository's linked worktree at the path skipped the repository check and lost
its untracked files to `git clean`. Two detached worktrees recording one branch
were both removed, and with no local origin/HEAD a default other than main or
master could become a thread's recorded branch.
The reflog check now runs on every worktree. Rewritten commits land in the reflog
too, so an amended or rebased worktree waits until gc expires those entries.
Cleanup compares the worktree's repository with the project's before it reads the
checkout, by file identity so a differently cased path still matches. It keeps a
detached or default-branch worktree while a thread elsewhere records the same
branch. The service asks the remote for its default whatever the name, once per
checkout.
Model: Opus 5.5
Harness: Claude Code in T3 Code
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(pstack): roles pin Ultracode off now that it is its own option
The upstream sync split Ultracode out of the effort list into a boolean option.
pstack pins every option except speed, so a role at effort=xhigh now resolves with
ultracode false, which is what that effort meant before: not Ultracode. This test
is fork-only, so the sync did not update it, and it left main's required Fork Check
failing for every pull request.
Model: Opus 5.5
Harness: Claude Code in T3 Code
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
0 commit comments