Skip to content

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

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
automated/bugfix/2026-08-02-shared-worktree-branch-race
Draft

fix(devops): add branch assertion helper for shared worktrees#20
cursor[bot] wants to merge 1 commit into
mainfrom
automated/bugfix/2026-08-02-shared-worktree-branch-race

Conversation

@cursor

@cursor cursor Bot commented Aug 2, 2026

Copy link
Copy Markdown

Issue

  • Record: docs/issues/resolved/2026-08-02-shared-worktree-branch-race.md
  • Bug: Concurrent Cursor agent sessions (or moving the agent root between sibling clones) can silently change which branch is checked out in a shared worktree, so mutating git commands like git cherry-pick can land on the wrong branch.

Fix type

Deliberated

What changed

  • Added devops.git.assert_branch helper and CLI to fail fast when HEAD drifted before mutating git operations.
  • Documented shared-worktree branch safety in record-agent-issue and vast-provisioning skills.
  • Moved the issue record to resolved/ with updated resolution history.

Tradeoffs

Cursor platform behavior is unchanged; this adds a lightweight guard agents can call before writes. Separate worktrees per concurrent agent remains the strongest isolation.

Verification

  • Minimal reproduction command: partial — Cursor root-move reproduction is IDE-specific; branch mismatch behavior verified via unit tests with real git repos.
  • Tests: uv run pytest -q tests/test_git_assert_branch.py -m "not slow"

Reviewer notes

Confirm skill guidance is sufficient for agents importing results or pushing from shared Mac worktrees. The helper is intentionally small and does not wrap git itself.

Open in Web View Automation 

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>
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