Skip to content

ci: preserve the merged outcome when a post-merge coordination push fails #4039

Open

Description

@schlessera

Context

During #4030, confirmation merged the PR but printed only a candidate receipt and error: failed to push some refs, exiting 1 without the normal merged outcome. The actual squash/issue closure and later lease release were independently verified in the original receipt. A caller can therefore mistake delivered work for an unmerged failure.

At inspected main 3b104890f8, merge (scripts/integrate.ts:200) verifies the actual squash, fetches its ancestry and rechecks milestones before releasing the reservation (same file:231). The merged JSON receipt follows at :236. A release-push exception reaches the generic catch (:367-369); the owned cleanup in finally (:371-375) can then succeed without restoring the already-verified delivery outcome. #3302's renewal behavior is adjacent, not this failure.

Scope

Preserve the verified merged outcome when subsequent coordination release/cleanup fails. Retain the cleanup error and unknown/pending main-proof state separately and report a delivered result accurately. Do not attempt another merge or push the merged contribution branch. Preserve lease owner/token/expiry checks and exact squash proof.

Out of scope

Changing confirmation/merge policy, retries of the irreversible merge, automatic main-proof claims, weakening milestone or proof checks, or treating an unverified squash as delivered.

Acceptance criteria

  • An offline fixture completes and verifies one real local squash, then injects a coordination-ref push failure. The output still contains merged: true with the actual squash/candidate identity, while clearly reporting incomplete/failed coordination cleanup and pending main proof.
  • The fixture proves the merge was dispatched exactly once. A later successful owned cleanup cannot erase the delivery receipt; repeated cleanup failure also preserves it without claiming lease release.
  • A pre-merge or unverified-squash failure still has no delivered receipt. Existing wrong-owner/token/expired-candidate/proof/milestone refusals remain.
  • A named failing-first receipt observes the missing delivery outcome, and the restored implementation passes that case and the ordinary delivery controls. Document the resulting command outcome/exit behavior for operators.

Verification

Use the offline executable fixtures in tests/integration-command.test.ts, plus focused preflight. No real GitHub merge, remote coordination write or network test is required.

Bounded reproduction — 2026-11-16

In an owned source archive of main 3b104890f8, Linux x64, Bun 1.4.4 (38afee6c8), copied the existing integration-command fixture to a temporary test and added mode post-merge-release-fail. Its fake gh pr merge first performs the fixture's existing real local Git merge and sets s.merged=true, then writes 1 to the existing failPush counter. This fails exactly the next coordination push; all product code and offline guards are unchanged.

The scenario returned code:1, dispatched:true, stdout containing only BRAIN_CANDIDATE_RECEIPT, and stderr remote: Internal Server Error / error: failed to push some refs. Final reservation state was active:null, last.action:release: the finally retry succeeded. The probe passed its dispatched/cleanup assertions and failed VERIFIED_MERGE_OUTCOME_SURVIVES_RELEASE_PUSH_FAILURE on the missing "merged":true output (1 fail, 17 assertions, about 1.06 s). This is the reported failure shape, not a module-load error. The existing unmodified ordinary delivery control passed (1 pass, 20 assertions, about 0.95 s). No repair is implemented by this triage.

Contract impact

Repository integration tooling; preserve its existing verified delivery fields and document exit/cleanup semantics. No product CLI/MCP/schema contract change is selected.

2026-11-16 triage: Completed the scope from the source-qualified failing control, removed needs: repro, added agent-ready and p2 for wanted unscheduled tooling repair. Keep standalone: no existing epic owns this full merged-outcome/coordination repair merely because it affects integration.

Activity

  1. added
    type: fix
    area: ci
    needs: repro
    priority: p2
    agent-ready
    and removed
    needs: repro
    on Nov 15, 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

    agent-readyarea: cipriority: p2type: fix

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions