Skip to content

babysit lease store is not a real contention primitive across concurrent lanes #1370

Description

@kyle-sexton

Filed by the autonomous babysit merge lane (AI-generated) after observing it live.

What happened

Two sessions were draining this repo's PR queue at the same time — a primary lane and a secondary lane. The secondary lane used the plugin's own worker-lease store as its contention primitive:

python manage_babysit_lease.py acquire --scope worker --pr melodic-software/claude-code-plugins#N --state-dir <state-dir>

Every acquire returned "acquired": true with "reclaimed_stale": false, including for PRs the other session was demonstrably working. Listing the store confirmed why:

$ ls <state-dir>/active-workers/
melodic-software__claude-code-plugins__pr-1305.json.lock
melodic-software__claude-code-plugins__pr-1306.json.lock
melodic-software__claude-code-plugins__pr-1311.json.lock

Only the lease-taking session's own leases were ever present. The other session never acquired any — it was driving PRs from its own worktrees (C:/Projects/melodic/worktrees/* and a session scratchpad) without going through manage_babysit_lease.py at all.

Why it matters

reference/orchestration.md treats the worker lease as the deterministic exclusion that keeps two lanes off the same PR, and babysit-prs lists lease contention as one of the few permitted deterministic exclusions from fan-out. But the lease is only binding on participants that opt into it. A session that runs the skill from a different worktree root, a session driving PRs by hand, or any lane that simply does not call the lease manager, is invisible to it — and an uncontended acquired: true reads exactly like a genuine all-clear.

The failure mode is not theoretical: two lanes can check out the same branch, push to the same PR, and race the same merge gate, each believing the lease proved it had exclusive ownership.

What the secondary lane had to fall back on

Neither of these is a lock, and both are heuristics:

  1. PR activity recency (a widened grace window over updatedAt).
  2. git worktree list — treating any branch already checked out somewhere on disk as claimed.

Worktree presence is the stronger of the two, and notably it is observable state the lease store already could have consulted but does not.

Possible directions (not a decision)

  • Make the lease store authoritative by having every mutating path acquire it, and fail closed when it cannot.
  • Have acquire additionally consult git worktree list for the target branch and refuse (or warn loudly) when the branch is checked out by an unleased worktree.
  • Distinguish "no lease exists" from "exclusivity proven" in the acquire result, so a caller cannot read the former as the latter.
  • Document explicitly that the lease binds only cooperating sessions, so lanes stop treating it as a guarantee.

Notes

No merge collision actually occurred — the secondary lane yielded on worktree-presence and activity-recency signals instead. This is filed as a latent correctness gap in the contention design, not an incident.

Deliberately filed without a work-class label; that classification belongs to triage.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-humanHuman-in-the-loop required; autonomous sessions must not resolve items carrying this.priority: highSignificant impact, or blocks an imminent release; staff this cycle.work-class: structuralRefactors, migrations, contract changes; cross-cutting and hard to reverse.

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions