Skip to content

Flaky spec_run scenario tests: concurrent Tickets race on git fetch and branch deletion #509

Closed

Description

@JacobStephens2

What happened

Two tests/spec_run.rs scenario tests fail on Linux CI now and then with the Spec run exiting 1 instead of 0:

Cause (for the first, from its stderr)

Tickets #21 and #22 run concurrently. #22 lands and its branch is deleted on origin ("#22: deleting issue-22 on origin"). At about the same time, #21 runs git fetch origin issue-20 and fails:

thirdshift: #21: git fetch origin issue-20 failed: fatal: bad object refs/heads/issue-22
thirdshift: #21: error: /tmp/.tmpSv00uD/origin.git did not send all necessary objects
thirdshift: #21 failed

The fetch reads origin's refs while refs/heads/issue-22 is being deleted, so origin advertises a ref that then can't be resolved. The second test's stderr hasn't been captured yet. It also runs Tickets concurrently, so the same race is the likely cause, but that needs confirming.

To decide

  • Whether this can happen against GitHub, where ref deletion is atomic from a client's view, or only with the local bare origin.git the scenarios use.
  • Fix options: make the fake origin's branch deletion atomic for concurrent fetches; retry a fetch once on "bad object" / "did not send all necessary objects"; or fetch only the needed refspec in a way that doesn't touch other refs.

Related

Activity

  1. added
    bugSomething isn't working
    needs-triageMaintainer needs to evaluate this issue
    on Oct 7, 2026
  2. JacobStephens2 commented on Oct 7, 2026

    @JacobStephens2
    OwnerAuthor

    This was generated by AI during triage.

    Agent Brief

    Category: bug
    Summary: Prevent concurrent Ticket fetches and branch cleanup from intermittently failing Spec run scenarios.

    Current behavior:
    Two scenarios that expect a successful Spec run sometimes exit 1 when Ticket #21 fetches the Spec branch while Ticket #22 finishes. Both original Linux CI logs report fatal: bad object refs/heads/issue-22, followed by origin.git did not send all necessary objects:

    Both used Git 2.55.0. The second scenario's matching stderr has now been verified; its relationship to the first is stronger than the original issue's hypothesis.

    Verification during triage: Both named scenarios passed individually, once each, on the current checkout using Git 2.43.0. The intermittent failure was not reproduced locally; the original CI logs above confirm both failures. Passing these single runs does not establish that the race is fixed.

    Scenarios redirect the GitHub origin URL to a local bare repository and Ticket Worktrees share the Launch directory's Git repository. Git retries existing lock-file and stale-ref-update conflicts, but not these errors. Worktree acquisition locks the Launch directory; subsequent fetches and Self-merge cleanup can overlap. The logs establish the failure and its overlap with cleanup, but do not establish whether the failing ref belongs to the origin or the shared local repository, or whether GitHub transport is affected.

    Desired behavior:
    Concurrent Tickets can fetch the Spec branch and finish Self-merge cleanup without unrelated branch removal failing their Runs. Establish which Git operation and repository causes the race, then fix the narrowest supported cause. If the cause is specific to the scenario origin or transport, correct the fixture. If a production change is justified, document the evidence and preserve genuine failure reporting.

    Key interfaces:

    • Git::fetch and its command execution/retry behavior.
    • Worktree origin sampling and Self-merge branch disposal.
    • Scenario origin setup and fake GitHub merge behavior.

    Acceptance criteria:

    • Explain the race mechanism with a controlled reproduction or trace evidence, distinguishing the shared local repository from the fake origin and identifying any evidence for GitHub impact.
    • Add a regression check that exercises the identified failure mechanism without depending solely on a lucky scheduling collision.
    • Both named scenarios pass repeatedly on Linux with their concurrency assertions intact; the default maximum of three simultaneous Tickets and sharing of one Base fix remain covered.
    • Genuine missing-object, missing-required-ref, or transport failures still report an error. Any retry is bounded and limited to the demonstrated transient failure.
    • Relevant Git and Worktree checks, the Spec run scenario suite, formatting, and Clippy pass.

    Out of scope:

  3. added
    ready-for-agentFully specified, ready for an AFK agent
    in-progressA Claim: thirdshift has taken this issue
    and removed
    needs-triageMaintainer needs to evaluate this issue
    ready-for-agentFully specified, ready for an AFK agent
    on Oct 7, 2026
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

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions