Skip to content

Preserve Failed run work only on its acquired Worktree - #521

Merged
JacobStephens2 merged 5 commits into
mainfrom
issue-518
Oct 7, 2026
Merged

JacobStephens2 merged 5 commits into
mainfrom
issue-518

Conversation

@JacobStephens2

@JacobStephens2 JacobStephens2 commented Oct 7, 2026 •

Copy link
Copy Markdown
Owner

Summary

Failed run preservation changes only the acquired Worktree instance on its Issue branch.

Worktree::preserve_failed_run
  arm retention
  acquired ownership
    verify pinned common directory
    hold ownership lock, then refs lock
    inspect before abort → stage → failure commit → push
    inspect before success, including unchanged work
  restore cleanup eligibility

Closes #518

Evidence

  • Before: The branch-switch regression failed: preservation returned Ok(()), committed on the switched checkout, and pushed the unchanged Issue branch.
    After: Changed or uncertain ownership returns an error naming the acquired path, expected Issue branch and cause; unrelated work and refs remain unchanged, and Drop retains local resources. A successful push followed by ownership refusal also retains local resources.
  • Lock regression: Temporarily omitting the ownership lock or refs lock independently fails the sibling-operation test. Restoring both locks passes.
  • Validation: cargo test passed (1453 tests; 1 existing local latency probe ignored); 120 Worktree tests, 13 Failed run integration tests and 64 Spec run tests passed. cargo check --all-targets, cargo clippy --all-targets -- -D warnings, and cargo fmt --check passed.
  • Spec interruption: The origin-hook barrier observes sibling session interruption, allowing serialized salvage pushes while still requiring both Tickets' work on origin and cleanup.
  • Review: thirdshift-code-review against main (pinned at 200661b). Both Standards findings addressed and verified; no Spec findings.

Test seams

  • Worktree preservation and Drop with real temporary Git repositories and a local bare origin; sibling ReviewWorktree::create refusal and Worktree::merge_base_branch exercise ownership and refs coordination.
  • The factory command through Scenario checks the original Failed run cause, preservation warning, PR finishing, Claim ending and interrupted Spec run completion.

Merge Danger

Door: two-way

Private ownership refactor with no interface or storage migration.

Blast Radius: preservation

Failed run salvage holds repository locks through final inspection. External Git or filesystem operations can still race between inspections.

Unaddressed findings

Standards

None. Both findings were addressed.

Spec

None. The review reported no findings.

Built with codex · gpt-6.1-sol · xhigh

The old origin hook required concurrent Failed run pushes and rejected the first push while preservation held the repository locks. Wait for the sibling session to acknowledge interruption instead, keeping the parent broadcast-before-wait contract and both origin and cleanup assertions.
@JacobStephens2
JacobStephens2 merged commit 21ad993 into main Oct 7, 2026
13 checks passed
@JacobStephens2
JacobStephens2 deleted the issue-518 branch October 7, 2026 16:11
@JacobStephens2 JacobStephens2 mentioned this pull request Oct 8, 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 Failed run preservation with acquired Worktree ownership

1 participant