Skip to content

Own partial effects of failed Worktree acquisition - #502

Merged
JacobStephens2 merged 3 commits into
mainfrom
issue-501
Oct 7, 2026
Merged

JacobStephens2 merged 3 commits into
mainfrom
issue-501

Conversation

@JacobStephens2

@JacobStephens2 JacobStephens2 commented Oct 7, 2026 •

Copy link
Copy Markdown
Owner

Summary

Worktree acquisition owns partial local effects for fresh Runs, Continuations and detached Architecture reviews.

snapshot local resources and exact start commit under acquisition lock
git worktree add
  success → existing Worktree lifetime
  failure or interruption → completion recovery
    remove only an owned checkout with unchanged HEAD and no work
    conditionally delete only a new, unchanged, unused Issue branch
    retain and name work or uncertain resources

Closes #501

Evidence

  • Before: The occupied-target regression failed because acquisition left a newly created Issue branch. Clean failing hooks left a checkout and registration.
    After: Real-Git acquisition regressions cover all four acquisition cases, tracked/staged/untracked/ignored work, hook commits, locks, pre-existing paths and symlinks, failed inspections/removals, initialized submodules, ref movement before deletion, and SIGINT/SIGTERM/SIGHUP. Hidden tracked work survives assume-unchanged, skip-worktree, core.ignoreStat, and fsmonitor.
  • Before: A clean failed add could block the next Run with leftover local artifacts.
    After: The command regression verifies that no session starts, the Claim finishes and is released, and correcting the hook allows a successful retry.
  • Test seams: Worktree::create_fresh, Worktree::continue_existing, ReviewWorktree::create, and the command's Run interface, with real local Git, temporary origin and hooks.
  • Validation: cargo fmt --check and cargo clippy --all-targets -- -D warnings passed. Full cargo test: 1,373 passed, 0 failed, 1 ignored across 39 test targets.
  • Review against main: Fixed duplicated origin-commit resolution and the Spec finding about hidden tracked work. Focused follow-up review confirmed the Spec fix.

Unaddressed findings

Standards

  • Possible Duplicated Code: repeated retained-branch assertions in acquisition tests. Kept inline so each scenario's expected branch state stays visible; the small repeated assertion carries no separate production policy.

Spec

None. The identified Spec finding was addressed and verified.

Merge Danger

Door: two-way

Local acquisition behavior can be reverted; no persisted format or origin behavior changes.

Blast Radius: Worktrees

All three acquisition paths share recovery. Uncertain resources remain available for the Day shift, with their path, branch and known head reported. Successful lifetime cleanup and Failed run preservation retain their existing behavior.

Built with codex · gpt-6.1-sol · xhigh

Git 2.55 runs automatic worktree pruning after fetch, deleting the missing-gitdir fixture before acquisition can inspect it. Mark the damaged registration locked using Git's normal mechanism so the test reaches the intended refusal and preserves its existing assertions across all four acquisition paths.

Validated with Git 2.43 and 2.55; cargo fmt --check, cargo clippy --all-targets -- -D warnings, full cargo test, and cargo nextest run (1,373 passed).
@JacobStephens2
JacobStephens2 merged commit 3b01804 into main Oct 7, 2026
13 checks passed
@JacobStephens2
JacobStephens2 deleted the issue-501 branch October 7, 2026 08:40
@JacobStephens2 JacobStephens2 mentioned this pull request Oct 7, 2026
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.

Deepen Worktree acquisition to own failed adds

1 participant