Phase 7: detect externally merged/closed MRs in loop iteration #12
Labels
No labels
implementing
planned
planning
triaging
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
zak.pub/tantalus#12
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The Loop Iteration and Phase 7 instructions tell the agent to check for review comments and CI status on open MRs, but never instruct the agent to check the MR state itself (merged, closed). If a maintainer merges or closes the MR externally, the agent keeps polling for reviews indefinitely, never detecting that the work is done.
In my case, all three of my PRs were merged by the maintainer (at 12:13, 12:58, and 13:31), but my loop kept reporting "noop" for over an hour because I was only checking reviews and comments — never
state: MERGED.Impact
Suggested fix
Add to Loop Iteration step 1 (Phase 7 checks):
Add to Phase 7 actions (before or after the review comment handling):
This would also mean the agent should check
stateon the MR API response:GET /repos/{owner}/{repo}/pulls/{number}→ checkstateandmerged_atGET /projects/{id}/merge_requests/{iid}→ checkstate(merged/closed)GET /repos/{owner}/{repo}/pulls/{number}→ checkstateandmergedI've picked up this issue and I'm reviewing it now.
Triage Assessment
This is a real bug I experienced — MRs were merged externally but I kept reporting noop because I only checked reviews and comments, never MR state. The issue is clear, well-scoped, and includes a concrete fix. No clarifying questions needed. Proceeding to planning.
Plan
Goal: Ensure the agent detects externally merged or closed MRs during loop iterations and completes Phase 8 cleanup or follows error handling accordingly.
Approach: Update Loop Iteration and Phase 7 in
merge-request-flow.mdto include MR state checks.Tasks:
Update Loop Iteration step 1, Phase 7 bullet — Add "and whether the MR has been merged or closed externally" to the existing check list.
Add MR state check to Phase 7 actions — Add a new step (before review comment handling) instructing the agent to check the MR state on each iteration:
Risks:
Test strategy:
Implementation complete. Merge request: #14