Skip to content

BUG: Git delivery: a hand merge after checks is failed rather than adopted by the apply job (Codex F5) #448

Closed

Description

@ephico2real2

Part of #286. Found by Codex (another model family) reviewing the Git delivery layer on main b8ee59e (PRs #288, #299), 2026-11-19. Severity per Codex: High.

Location: cmapi/src/cmapi/jobs/apply.py:65–:80; _stop at :48; lifecycle table core/lifecycle.py:80.

Checks pass and queue apply. A person merges the PR and deletes its branch before apply runs. Main's apply job treats branch absence as head movement, transitions to failed and schedules cleanup rather than recording the merge and continuing delivery. Keeping the branch also fails the base comparison after main already contains the plan. A retry of sync_failed after a partial apply needs the same adoption path.

Full fix: inspect PR state before branch checks, and inspect again on branch/base-check failures; adopt merged PRs through the common post-merge verifier. Allow SYNC_FAILED -> MERGED for adoption during retry, retaining the lock. Appendix C: jobs/apply.py, core/lifecycle.py, lifecycle test update.

Tests: test_hand_merge_between_checks_and_apply_is_adopted[pr_open] and [sync_failed]: 2 fail main; 2 pass fixed. The fixed tests verify merge_sha and exactly the watch_sync/cleanup continuation, without a new merge or cluster write.

Evidence: workbench/cmapi/review-288b/codex-report.md (F5) and its regression test in codex-fixes.patch; Codex ran it failing on main and passing with its fix. Reviewer 2 (OB3) checks the fix and runs the PostgreSQL and SSH checks the sandbox could not, before it is applied.

Activity

  1. added
    bug
    status:open
    sev:high
    Backlog
    on Nov 19, 2026
  2. added
    Done
    and removed
    Backlog
    on Nov 19, 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

    Donebugsev:highstatus:open

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions