Skip to content

Give Worktree ownership of safe Issue branch acquisition - #491

Merged
JacobStephens2 merged 2 commits into
mainfrom
issue-485
Oct 7, 2026
Merged

JacobStephens2 merged 2 commits into
mainfrom
issue-485

Conversation

@JacobStephens2

@JacobStephens2 JacobStephens2 commented Oct 7, 2026 •

Copy link
Copy Markdown
Owner

Summary

Worktree independently acquires Issue branches without replacing local-only work. Issue branch selection uses Worktree's rule for advisory preflight before the Claim.

acquire fresh / Continuation
  hold the worktree lock
  fetch origin and pin its remote-tracking commit
  validate the sampled local Issue branch head
  if equal Continuation: attach the existing branch
  otherwise: create without force at the pinned commit

Closes #485

Evidence

  • Before: continuation_refuses_local_only_work_without_selection_and_preserves_its_head failed: acquisition replaced the saved local-only SHA with origin's older SHA.
    After: the regression passes; acquisition refuses and retains the exact local and origin heads without adding a worktree.

  • Before: a local branch named origin/issue-7 caused acquisition to compare against the wrong head.
    After: acquisition pins fully qualified remote-tracking refs; the shadowing regression passes for fresh and continued checkouts and retains the shadowing branches.

  • Real-Git tests cover post-preflight local commits and origin advancement, unchanged reflogs for equal branches, absent branches, occupied paths and branches already used by another worktree. CLI coverage verifies refusal before a session or Delivery and ordinary Claim behavior.

  • Focused Worktree, Issue branch selection, Continuation, fresh and numbered Run tests and Spec run Ticket/Claim checks passed. cargo fmt --check and cargo clippy --all-targets -- -D warnings passed. cargo test -- --test-threads=1 passed: 1322 tests passed, 1 ignored across 39 test binaries.

  • Two normal cargo test attempts stopped in unchanged tests: child-run script startup reported Text file busy, and a Harness catalog interruption assertion failed. Both tests passed in isolation; the complete serial run passed with cargo test -- --test-threads=1.

Test seams

  • Worktree acquisition (create_fresh and continue_existing) and its shared advisory preflight against real Git, a temporary Launch directory and a bare local origin; observe refusal, exact refs, worktree registration and filesystem preservation.
  • Issue branch selection's existing interface for naming and advisory refusal.
  • The thirdshift CLI against real Git and fake GitHub/Harness adapters for early and late refusal, Claim behavior, fresh/numbered/continued Runs and Spec run Ticket checkout.

Merge Danger

Door: two-way

The change is reversible and adds no persistent format or migration.

Blast Radius: acquisition

Runs and Spec runs refuse late local mismatches before sessions start. Native Git add failures can leave a newly created local branch; pre-existing refs and occupied paths are preserved.

Unaddressed findings

Standards

None. The parallel review and final follow-up reported no findings.

Spec

None. The parallel review and final follow-up reported no findings.

Built with codex · gpt-6.1-sol · xhigh

@JacobStephens2
JacobStephens2 merged commit 21bf200 into main Oct 7, 2026
13 checks passed
@JacobStephens2
JacobStephens2 deleted the issue-485 branch October 7, 2026 04:52
@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 ownership of safe Issue branch acquisition

1 participant