Skip to content

fix(devops): branch assertion helper for shared worktrees - #22

Draft
cursor[bot] wants to merge 2 commits into
mainfrom
automated/bugfix/2026-08-09-shared-worktree-branch-race
Draft

fix(devops): branch assertion helper for shared worktrees#22
cursor[bot] wants to merge 2 commits into
mainfrom
automated/bugfix/2026-08-09-shared-worktree-branch-race

Conversation

@cursor

@cursor cursor Bot commented Aug 9, 2026

Copy link
Copy Markdown

Issue

  • Record: docs/issues/resolved/2026-07-19-shared-worktree-branch-race.md
  • Bug: Concurrent Cursor agent sessions can silently change which branch is checked out in a shared worktree or sibling clone. A git cherry-pick or similar write can then land on the wrong branch.

Fix type

Straightforward

What changed

  • Added devops/git/assert_branch.py CLI/helper to fail fast before mutating git commands when HEAD drifted.
  • Exported helpers from devops/git/__init__.py.
  • Documented shared-worktree safety in record-agent-issue and vast-provisioning skills.
  • Moved issue record to docs/issues/resolved/ with updated resolution history.

Tradeoffs

None — simplification/deletion. Cursor platform behavior is unchanged; separate worktrees per concurrent agent remains the strongest isolation. The helper blocks mistaken writes rather than preventing HEAD drift.

Verification

  • Minimal reproduction command: manual Cursor root-move reproduction documented in issue; mitigation verified via unit tests.
  • Tests: uv run pytest -q tests/test_git_assert_branch.py (5 passed)

Reviewer notes

Re-lands a fix drafted on 2026-08-02 (automated/bugfix/2026-08-02-shared-worktree-branch-race) that was never merged to main.

Open in Web View Automation 

cursoragent and others added 2 commits August 9, 2026 10:02
Add devops.git.assert_branch so agents can fail fast before mutating git
commands when concurrent sessions drift HEAD. Update agent skills with
worktree isolation guidance and resolve the shared-worktree branch race issue.

Co-authored-by: Alex Vardakostas <Al-does@users.noreply.github.com>
…story

Co-authored-by: Alex Vardakostas <Al-does@users.noreply.github.com>
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.

1 participant