Skip to content

Per-repo (gitCommonDir-keyed) lock around fetch + resolveRemoteTrackingCommit in worktree provisioning #4

Description

@fzoll

Evidence — 2026-09-04 15:05–15:06 burst (9 failed dispatches)

9 simultaneous dispatches against fzoll/tellmemore all failed in ~2 s, before any worktree or CC session existed (t3ThreadId: null, on both rpi and ha nodes):

OrchestrationDispatchCommandError: Git command failed in GitVcsDriver.resolveRemoteTrackingCommit (/home/fzowl/SHARED/tellmemore): fatal: Needed a single revision

Mechanism (confirmed against GitVcsDriverCore.ts:2339): resolveRemoteTrackingCommit runs git rev-parse --verify refs/remotes/<remote>/<branch>^{commit} in the SHARED main clone. Concurrent dispatches each run git fetch into the same gitCommonDir; the fetch rewrites refs/remotes/* refs, and a rev-parse landing inside that window fails to resolve the ref → fatal: Needed a single revision.

  • Only settings/sqlite/provider paths are serialized today; worktree provisioning's git phase has no per-repo lock.
  • Even 2 concurrent dispatches reproduced the failure (ha node); single dispatches at 14:52 and 15:41 on the same node were clean.

Ask

Serialize the base-ref phase of worktree provisioning per repo: a semaphore/mutex keyed by the clone's resolved gitCommonDir, held across git fetch and resolveRemoteTrackingCommit (the whole base-ref resolution), so N dispatches into one shared clone can never interleave fetch with rev-parse. Per-node scope is sufficient (each node has its own clone); the lock must not span CC execution or push phases.

Related dispatcher-side gaps (retry + offer throttle) tracked in fzoll/cc_runner.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions