Skip to content

Read detached branch identity from its worktree registration - #4454

Open
max-sixty wants to merge 26 commits into
mainfrom
codex/git-registration-identity
Open

max-sixty wants to merge 26 commits into
mainfrom
codex/git-registration-identity

Conversation

@max-sixty

@max-sixty max-sixty commented Oct 12, 2026 •

Copy link
Copy Markdown
Owner

Read detached worktree branch identity from its Git registration, including a paused rebase, rather than discovering a repository through the checkout path. Ordinary inventory resolves entries independently, so an unreadable sibling cannot hide a healthy checkout's identity or make switch try to create it again.

Before branch deletion, take a fresh, complete registration snapshot and protect branches held by HEAD, rebase, bisect, and rebase --update-refs. An unreadable surviving registration refuses deletion. Listing remains tolerant without weakening that destructive boundary.

Validation: the inventory regression failed before its repair and now passes. An instrumented 183-test probe passes, including malformed operation state and ambiguous registration cases. Local added-line coverage is 94.22%; remaining misses are syscall-error and race paths, and Codecov remains a merge gate. Independent source and test reviews found no remaining issues.

Current-commit CI tests pass on Linux, macOS, and Windows. One local full-gate run reported 5,477 passing tests and a fish custom-SIGINT wrapper failure. The exact case passes on this branch and main, clean-main full validation passes with the same concurrency, and two instrumented concurrent foreground-job batches pass 82 tests each with the expected terminal state and signal receipt. That evidence clears the branch-specific fish hold; the original cause remains unestablished. Coverage remains a merge gate.

This was written by Codex on behalf of max-sixty

@worktrunk-bot worktrunk-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two cases that work with a build of the base branch (codex/git-native-paths) fail with this PR. Details and repros are inline.

  • Reftable repositories can't delete any branch. This includes wt remove, wt merge and -D.
  • One unreadable sibling registration makes wt remove fail partway. For example, a .git/worktrees/<id> with no gitdir file, which Git itself skips. The checkout directory is already gone when the error fires, so the registration is stranded and the branch is kept.

The second also contradicts the description's "Ordinary commands retain usable entries when a sibling identity is unreadable". registration_at is now as strict as the deletion scan.

Comment thread src/git/mod.rs Resolved
Comment thread src/git/repository/worktrees.rs Resolved
worktrunk-bot
worktrunk-bot previously approved these changes Oct 12, 2026
Base automatically changed from codex/git-native-paths to main October 13, 2026 02:28
…n-identity

# Conflicts:
#	src/git/repository/tests.rs
#	src/git/repository/working_tree.rs
#	src/git/repository/worktrees.rs
#	src/git/test.rs
max-sixty added a commit that referenced this pull request Oct 20, 2026
Max chose to keep trusting configured fsmonitor and add only a recheck after
the daemon shuts down, with no dependency on #4454. This merge takes main's
tree; the next commit adds the recheck.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
max-sixty added a commit that referenced this pull request Oct 20, 2026
…4456)

Removal's dirty-worktree gate runs before wt stops the fsmonitor daemon,
since the daemon answers that `git status` cheaply. A file written while
the daemon shuts down therefore reached the rename unchecked. With
`core.fsmonitor` configured, removal now runs the gate once more after
the stop, with fsmonitor disabled, which rescans without starting a new
daemon in the worktree about to go.

The first gate stays, so a dirty worktree is still refused off the
daemon's answer with its daemon left running. Under fsmonitor the
post-stop rescan is what a clean removal passes: one full re-stat per
removal there, which also makes `wt` stricter than `git worktree remove`
against a stale daemon answer. Without fsmonitor nothing changes.
`--force` skips both gates, as before.

This narrows the earlier version of this PR, which bypassed fsmonitor
for every removal and stacked on #4454; it now targets `main` on its
own.

> _This was written by Claude Code on behalf of max-sixty_

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
worktrunk-bot
worktrunk-bot previously approved these changes Oct 28, 2026

@worktrunk-bot worktrunk-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

codecov/patch reports 82.22% of added lines hit against a 98.62% target. The compare report shows 23 misses in the new operation-state reader and 17 in the registration scan, mostly failure paths. The repository's Coverage rule requires explicit maintainer approval before merging with a failing patch check. This holds my approval until those paths are covered or a maintainer accepts the gap.

@worktrunk-bot
worktrunk-bot dismissed stale reviews from themself October 28, 2026 20:08

codecov/patch failed at the reviewed head: 82.22% diff coverage against a 98.62% target.

@worktrunk-bot worktrunk-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description still identifies the fish custom-SIGINT full-gate failure as a validation hold. I’m withholding approval until that hold is resolved or withdrawn.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants