NEC-354: The merge queue leaves a card Blocked after main is re-run green, and blocks it again if moved back #325

Merged
nectenda-agent merged 6 commits from worktree-nec-354-the-merge-queue-leaves-a-card-blocked-af into main 2026-10-27 20:29:58 +00:00
Collaborator

Task: NEC-354 — https://projectron.nerchure.com/tasks/375

When main's run failed after a merge, the merge queue paused and blocked the card, but on resuming it only cleared the pause: the card, its ride-alongs and its worktree were left for a person, and moving the card back to Merging blocked it again because its pull request had merged. Now the queue finishes the paused card like any landing once main's green head contains its commit, wording honestly whether its own run passed on a re-run or main is green on a later commit; and a card in Merging whose newest pull request already merged is judged by main's run on that merge. Four review rounds hardened what finishing may delete: only from Blocked, Merging or Done, never with an open pull request, never through an older merged pull request, never when a merged pull request reverts it or its Forgejo branch has commits main lacks, and a local branch only at a tip that landed (tested against a throwaway repository). Rides along NEC-357: the queue's plain rebase silently dropped whatever a merge commit held, so a branch with merges main lacks is now blocked for a person instead of being rebased or bounced. Spec: docs/changes/NEC-354-merge-queue-finishes-paused-cards/spec.md.

Spec: docs/changes/NEC-354-merge-queue-finishes-paused-cards/spec.md

Also fixes NEC-357: The merge queue's rebase silently drops what a merge commit holds

Changelog

NONE

Task: NEC-354 — https://projectron.nerchure.com/tasks/375 When main's run failed after a merge, the merge queue paused and blocked the card, but on resuming it only cleared the pause: the card, its ride-alongs and its worktree were left for a person, and moving the card back to Merging blocked it again because its pull request had merged. Now the queue finishes the paused card like any landing once main's green head contains its commit, wording honestly whether its own run passed on a re-run or main is green on a later commit; and a card in Merging whose newest pull request already merged is judged by main's run on that merge. Four review rounds hardened what finishing may delete: only from Blocked, Merging or Done, never with an open pull request, never through an older merged pull request, never when a merged pull request reverts it or its Forgejo branch has commits main lacks, and a local branch only at a tip that landed (tested against a throwaway repository). Rides along NEC-357: the queue's plain rebase silently dropped whatever a merge commit held, so a branch with merges main lacks is now blocked for a person instead of being rebased or bounced. Spec: docs/changes/NEC-354-merge-queue-finishes-paused-cards/spec.md. Spec: `docs/changes/NEC-354-merge-queue-finishes-paused-cards/spec.md` Also fixes NEC-357: The merge queue's rebase silently drops what a merge commit holds ## Changelog NONE
When main's run failed after a merge, the queue paused and blocked the
card, then on resuming only cleared the pause. The card, its ride-alongs
and its worktree were left for a person, and moving the card back to
Merging blocked it again because its pull request was no longer open.

On resuming, the queue now finishes the paused card like any landing when
main's green head contains its commit, and says honestly whether its own
run passed on a re-run or main is green on a later commit that includes
it. A card in Merging whose pull request already merged is judged by
main's run on that merge instead of being blocked.

Task: NEC-354

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G1fxoYWvd7wXcDan8rkRhP
Review of the first commit found that finishing a card could delete live
work: an older merged pull request could close a reopened card and delete
the branch its follow-up sat on, and a paused card the user had sent back
to Ready could be closed under a slot working in its worktree.

A card is now finished only from Blocked or Merging, only through its
newest closed pull request, and never when its branch has commits main
lacks or a merged pull request reverts it. Those cases leave it in Blocked
with a comment and remove nothing. Every read happens before the first
write, so a Forgejo error no longer repeats a comment on each retry.

Task: NEC-354

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G1fxoYWvd7wXcDan8rkRhP
A second review found more ways the new landing path could go wrong. A
revert closed unmerged counted as a revert. A paused card with an open
follow-up was finished through its old pull request. Cleanup aimed at
refs/pull/N/head once Forgejo had deleted the branch, so it removed
nothing. A landing that failed part-way was abandoned on retry. And a
card finished from Blocked could reach `branch -D` with commits that
were never pushed.

The queue now records the head a slot pushed when it takes a pull request,
and removes a local branch only at that head, the merge commit, or a
commit on main. The git operations move into gitDeps, tested against a
throwaway repository, because they decide what gets deleted.

Task: NEC-354

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G1fxoYWvd7wXcDan8rkRhP
A third review found that a slot head holding a merge commit counted as
landed, though the queue's plain rebase drops whatever was written inside
a merge; that the worktree lookup matched a longer branch name by prefix;
and that a card found in Done on resume was told it landed a second time,
or pulled back to Blocked if a check then failed.

Cleanup now keeps a branch with merges main lacks and matches the branch
line exactly. A card already in Done keeps its place and its comments;
only its ride-alongs and cleanup are finished.

Task: NEC-354

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G1fxoYWvd7wXcDan8rkRhP
The merge queue rebased a pull request that was behind main with a plain
rebase, which flattens merge commits and drops whatever was written inside
one, such as a hand-resolved conflict. The rebase still succeeded, CI
tested the reduced tree, and the queue landed it, so the content never
reached main and nothing said so.

The queue now checks for such merges before rebasing, pushes nothing, and
moves the card to Blocked with a comment for a person. It does not bounce
the card to Ready, since a slot's own rebase would flatten it the same way.

Task: NEC-354
Also-fixes: NEC-357

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G1fxoYWvd7wXcDan8rkRhP
Block, never bounce, a branch with merge commits main lacks
All checks were successful
Release note / release-note (pull_request) Successful in 17s
CI / build (pull_request) Successful in 6m1s
CI / e2e (pull_request) Successful in 15m6s
CI / promote (pull_request) Has been skipped
CI / build (push) Successful in 6m10s
CI / e2e (push) Successful in 14m50s
CI / promote (push) Successful in 32s
cb7d624db2
A bounce sends a card to Ready, where its slot rebases onto main with a
plain rebase, flattening merge commits exactly as the queue's own rebase
did. A pull request with merge commits whose checks failed, or whose
rebase conflicted, was still bounced that way.

Every bounce now asks whether the branch has merge commits main lacks,
and blocks the card for a person instead. The work-queue skill and its
bounce hint tell a slot not to rebase such a branch, as a backstop.

Task: NEC-354
Also-fixes: NEC-357

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G1fxoYWvd7wXcDan8rkRhP
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Nectenda/nectenda!325
No description provided.