Skip to content

Prevent concurrent Ticket fetches from racing with Worktree changes - #513

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

JacobStephens2 merged 3 commits into
mainfrom
issue-509

Conversation

@JacobStephens2

@JacobStephens2 JacobStephens2 commented Oct 7, 2026 •

Copy link
Copy Markdown
Owner

Summary

Coordinate fetches with Worktree changes in the shared local repository:

common Git directory: thirdshift-worktree-refs.lock
  fetch                → check local connectivity → release
  Worktree acquisition → create or recover        → release
  Worktree disposal    → remove checkout + branch → release

An unchanged-origin Linux reproduction reached the exact Git 2.55.0 CI error. Fetch checks local refs and sibling Worktree heads, so atomic origin deletion does not protect that read. Diagnosis and evidence distinguish observations from the inference about GitHub transport. Ticket sessions continue to run concurrently.

Closes #509

Evidence

  • Before: a_sibling_fetch_waits_for_worktree_creation_to_finish failed with bad object worktrees/work-issue-22/HEAD; the disposal regression also detected an overlapping fetch with its guard removed.
    After: both controlled regressions pass on Git 2.43.0 and 2.55.0, alongside checks that missing required refs, missing objects, and transport failures remain errors. No new retries.
  • Both reported Spec run scenarios passed 10 times each on each Git version, 40 runs total, retaining their Base fix sharing and maximum-three-Tickets assertions.
  • Validation: cargo test (1431 passed; 1 existing ignored test), 22 Git checks, 110 Worktree checks, cargo fmt --check, and cargo clippy --all-targets -- -D warnings.

CI notes

  • Linux test failure: child_run::execution_tests::a_pending_collection_waits_for_its_child_and_retires_it_before_delivery hit the pre-existing Text file busy (os error 26) fixture-launch flake tracked in #483; the child-run code is identical to main, the exact test passed on both branches, all local CI checks passed (cargo test: 1,431 passed; 1 existing ignored test), and the Linux rerun passed.

Test seams

  • Git::fetch: required-ref/object/transport errors.
  • Worktree::create_fresh and scope-exit disposal alongside a sibling Worktree::merge_base_branch: controlled shared-ref transitions.
  • Spec run CLI: concurrent Tickets share one Base fix and retain the default maximum of three simultaneous Tickets.

Review

Reviewed with thirdshift-code-review against main (d000eee). Standards finding S1, duplicated test orchestration, was addressed with a shared helper and verified by the reviewer. Spec reported no findings.

Unaddressed findings

Standards

None.

Spec

None.

Merge Danger

Door: two-way

Revert the locking change to restore the previous behavior.

Blast Radius: Git

Fetches and Worktree acquisition/disposal briefly wait for each other within one shared repository.

Built with codex · gpt-6.1-sol · xhigh

…g to fix on the branch)

2026-10-07T13:13:39Z, host thirdshift. Uncommitted work at the time of failure is included in this commit.
@JacobStephens2
JacobStephens2 marked this pull request as draft October 7, 2026 13:13
@JacobStephens2
JacobStephens2 marked this pull request as ready for review October 7, 2026 13:25
@JacobStephens2
JacobStephens2 merged commit 493bb82 into main Oct 7, 2026
13 checks passed
@JacobStephens2
JacobStephens2 deleted the issue-509 branch October 7, 2026 14:13
@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.

Flaky spec_run scenario tests: concurrent Tickets race on git fetch and branch deletion

1 participant