Skip to content

The operator lock refuses a second coordinator; it should only RECORD who is working where #285

Description

@localai-bot

scripts/agent-role.py claim operator fails outright when another worktree holds the repo-wide lock:

ERROR: the operator role is already held by session ppid:1527831 on mudler-ubuntu-box.
This session cannot be the operator; take the helper role instead

Why the exclusivity is wrong for how we work

The lock's stated rationale (scripts/agent-role.py:28-37) is that "the shared case is the operator's primary checkout, where one role is the correct answer anyway."

That premise does not hold. Every task takes its own worktree and lands by merge, so there is no shared checkout to protect. An operator is a coordinator: its maximum powers are merging PRs directly and dispatching sub-agents into separate worktrees. It never rewrites shared history — main is never force-pushed, so a plain git push refuses any non-fast-forward and git itself is the interlock. Several coordinators on one machine serialise naturally.

What the exclusivity costs

It blocks. LOCK_TTL_SECONDS is 2 hours, so when a session dies mid-flight — as one did today, killed by a disk cleanup, leaving a dead pid and a frozen heartbeat — no session can coordinate for up to two hours, with no way to proceed but hand-deleting a file in .git/.

Wanted

Keep the lock as a record, never a refusal: it should show who is coordinating where, across concurrent sessions. That visibility was genuinely useful today; the refusal was not.

  • claim operator records this worktree and succeeds even when other worktrees are recorded.
  • show reports the other live coordinators rather than a single owner.
  • Ownership keys on the worktree, which lock_is_ours already does.
  • The 2-hour TTL and stale-record pruning stay — they are correct and already work; a refusal at 78 minutes is not evidence otherwise.

Docs and policy to follow: AGENTS.md:100 ("The operator coordinates, owns main integration and the GPU") should say plainly that the role is a coordinator, that several may run at once, and that main is never force-pushed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions