Skip to content

ci: keep a confirmation's lease through a transient renewal failure #3302

Closed

Description

@schlessera

Part of #2934.

Problem

bun scripts/integrate.ts confirm renews its exact-candidate lease every RENEW_MS (60 s) against a LEASE_MS (5 min) lease (scripts/integration-reservation.ts:6). The heartbeat in scripts/integrate.ts sets lost on the first renewal error of any kind: heartbeat, scripts/integrate.ts:93-95. The confirm then aborts and releases the reservation.

On 2026-11-02 at 16:16:16 UTC, a single remote: Internal Server Error on the coordination-ref push ended the confirmation of #3279. That candidate's proof run (41477145795) had been running for 16 minutes, and the lease still had about 4 minutes left. Another candidate acquired the reservation 14 s later, so the whole confirmation was wasted. The reservation is busy nearly continuously, so each such abort costs a full proof run plus a fresh wait for the reservation.

change (scripts/integrate.ts:36-44) retries only a lost compare-and-swap. A transport error from GitReservationStore.write's push (scripts/integration-reservation.ts:139-145) is rethrown at once whenever the remote ref did not move.

Acceptance criteria

  • A transient renewal failure is retried on the next heartbeat tick. Transient here covers a push or ls-remote transport error, an HTTP 5xx, or the GitHub API being unavailable for the candidate read. The confirm aborts only when one of these holds:
    • the candidate's head or base changed;
    • the reservation no longer holds this lease (revoked, expired or taken by another holder);
    • no renewal has succeeded for LEASE_MS - RENEW_MS. The candidate must never act on a lease that may already have expired.
  • A failed standalone renew <id> never releases the lease. It exits nonzero and leaves the lease in place for the next renewal or for expiry. Only an explicit release <id>, or the confirm and merge paths' own completion or cleanup, releases a lease. Today the renew branch sets own (command === "release" || command === "renew", scripts/integrate.ts:215-222), so the finally cleanup releases the lease when renew() throws (scripts/integrate.ts:301-306).
  • Each failed renewal attempt is logged with its error. The final abort names the last error and the time since the last successful renewal.
  • Tests cover these cases:
    • one injected transport failure followed by success keeps the confirm alive;
    • repeated failures past the safety margin abort it;
    • a changed candidate or a lost lease still aborts on the first tick;
    • one injected coordination-ref push failure in renew <id> exits nonzero and leaves the lease active, with no release recorded.
  • Mutation receipts: restoring abort-on-first-error fails the transient-retry test, and letting the renew command's cleanup release again fails the standalone-renew test.

Out of scope

The lease length and the renewal interval, and whether a merge can resume after an abort.

Citations re-verified on 2026-11-04 against main at 3853e24f (after #3303 / #3571).

Activity

  1. added this to the 0.45.0 milestone on Nov 2, 2026
  2. added
    type: fixSomething is broken and must behave the way it is documented.
    area: ciCI workflows, the gates they run, release scripts, packaging.
    priority: p1Scheduled into the current or next milestone.
    agent-readyContext and acceptance criteria are complete enough for an agent to take this unattended.
    on Nov 2, 2026
  3. schlessera commented on Nov 3, 2026

    @schlessera
    OwnerAuthor

    Another instance, 2026-11-03 11:31 UTC: a confirm for #3309 held the lease when one API call failed with dial tcp ...:443: connect: connection refused. The confirm exited, the lease was released, and the candidate run it had started on the same head was left without a holder. Retrying meant a new lease and a new candidate request.

  4. schlessera commented on Nov 4, 2026

    @schlessera
    OwnerAuthor

    Another instance, 2026-11-04 15:33 UTC, on a path this issue's criteria do not yet name: the explicit renew <id> command, not confirm's heartbeat.

    A caller held lease 94080eb9… for #3564 through acquire and renewed it each minute with bun scripts/integrate.ts renew <id>. One renewal's coordination-ref push failed (error: failed to push some refs). The renew branch sets own = state.active before calling renew() (command === "release" || command === "renew", scripts/integrate.ts:212-217). When renew() threw, the finally cleanup saw a live lease it "owned" and released it (scripts/integrate.ts:291-297). The reservation ref records renew at 15:32:00 and release at 15:33:05, both against the same lease, with no release requested. Another candidate acquired the free reservation moments later, and #3564's in-progress candidate run lost its holder.

    So a single transient failure in renew <id> currently gives up the very lease it was asked to keep. Suggested addition to the acceptance criteria: a failed renew command never releases the lease. It exits nonzero and leaves the lease for the next renewal or for expiry. The tests should cover one injected push failure in renew <id> leaving the lease active.

  5. self-assigned this
    on Nov 4, 2026
  6. schlessera commented on Nov 4, 2026

    @schlessera
    OwnerAuthor

    Claimed (claim-3302-84b998). Branch fix/3302-transient-renewal from main 3853e24f (#3303 landed as #3571). 2026-11-04 body update: citations re-verified on that main (lines moved), and the standalone renew <id> case from this comment added to the acceptance criteria and tests. No open PR changes scripts/integrate.ts or scripts/integration-reservation.ts. Merge waits for #3571's main run to be green (proof-system lane).

  7. added 3 commits that reference this issue on Nov 4, 2026
    50a62d3
    0560252
    21c061e
  8. schlessera commented on Nov 4, 2026

    @schlessera
    OwnerAuthor

    Delivered by #3578, squash e08a8a99 on main: parent 70ce32e8, tree 90d78e05, the same tree candidate run 41900954538 tested on the ready_for_review merge checkout. It covers the confirm heartbeat and proof-poll tolerance, plus the standalone renew <id> case from the 2026-11-04 comment: a failed renew exits nonzero and keeps the lease. An earlier confirmation on base 401c66b0 was cancelled by the red-main coordinator (incident #3583). Main CI run 41904814455 is in progress.

  9. schlessera commented on Nov 4, 2026

    @schlessera
    OwnerAuthor

    Main CI run 41904814455 on squash e08a8a99 completed success with all 17 jobs settled success. The proof-system lane is open for the next change.

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

Metadata

Metadata

Assignees

Labels

agent-readyContext and acceptance criteria are complete enough for an agent to take this unattended.area: ciCI workflows, the gates they run, release scripts, packaging.priority: p1Scheduled into the current or next milestone.type: fixSomething is broken and must behave the way it is documented.

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions