Proposal: improve implementation-orchestrator — add explicit handling for approved-but-unmerged PRs to prevent merge lifecycle gap #4962

Open
opened 2026-04-08 23:40:30 +00:00 by freemo · 2 comments
Owner

Agent Improvement Proposal

Pattern Detected

Type: workflow_fix
Affected Agent: implementation-orchestrator
Evidence:

  • As of 2026-04-08T23:39Z, there are 34 mergeable open PRs in the repository, many of which have been open for 1-3 days.
  • PR #3466: mergeable=true, has 1 APPROVED review from HAL9000 (2026-04-08T18:53Z), but has NOT been merged. It has been open since 2026-04-05.
  • PR #3911: mergeable=false (merge conflict), has 1 APPROVED review from HAL9000 (2026-04-08T18:53Z), but has NOT been merged.
  • Many PRs have State/In Review label but no implementation worker is picking them up to merge.
  • The continuous-pr-reviewer has a "Case 4: Approved but not merged (stuck)" handler that dispatches a reviewer to investigate, but the reviewer agent (pr-self-reviewer) explicitly does NOT merge PRs — it only posts reviews. So approved PRs get reviewed again but still don't get merged.

Proposed Change

Add an approved-PR merge sweep to the implementation-orchestrator's main loop:

  1. Every N cycles (e.g., every 5 cycles), scan all open PRs for ones that are:

    • Approved (has at least 1 APPROVED review)
    • Mergeable (no merge conflicts)
    • CI passing (all checks green)
    • Not blocked by needs feedback label
  2. For each such PR, dispatch an implementation-worker in pr-fix mode with work_type: ready-to-merge to attempt the merge.

  3. If the PR has merge conflicts, dispatch a worker with work_type: merge-conflicts to rebase and fix.

This closes the lifecycle gap where PRs get approved but no agent is responsible for actually merging them. Currently, the implementation-worker only picks up PRs that it created itself (tracked via its own session), but PRs from previous sessions or other workers fall through the cracks.

Expected Impact

  • Eliminates the backlog of approved-but-unmerged PRs (currently 34+ stuck PRs)
  • Ensures every approved PR eventually gets merged without human intervention
  • Reduces the PR backlog accumulation over time
  • Prevents the situation where PRs sit approved for days

Risk Assessment

  • Medium risk: Merging PRs automatically could merge code that has subtle issues the reviewer missed. Mitigation: only merge when CI is fully passing AND there's at least 1 APPROVED review.
  • Potential downside: Could merge PRs that a human wanted to review first. Mitigation: respect the needs feedback label as a merge block.
  • Concurrency: Multiple workers might try to merge the same PR simultaneously. Mitigation: use the existing PR claiming mechanism (check if PR is already being worked on before dispatching).

This is a proposal from the agent evolver. A human must approve this issue before the change will be implemented. To approve: remove the needs feedback label, add State/Verified, or comment with approval.


Automated by CleverAgents Bot
Supervisor: Agent Evolver | Agent: agent-evolver

## Agent Improvement Proposal ### Pattern Detected **Type**: workflow_fix **Affected Agent**: `implementation-orchestrator` **Evidence**: - As of 2026-04-08T23:39Z, there are **34 mergeable open PRs** in the repository, many of which have been open for 1-3 days. - PR #3466: mergeable=true, has 1 APPROVED review from HAL9000 (2026-04-08T18:53Z), but has NOT been merged. It has been open since 2026-04-05. - PR #3911: mergeable=false (merge conflict), has 1 APPROVED review from HAL9000 (2026-04-08T18:53Z), but has NOT been merged. - Many PRs have `State/In Review` label but no implementation worker is picking them up to merge. - The `continuous-pr-reviewer` has a "Case 4: Approved but not merged (stuck)" handler that dispatches a reviewer to investigate, but the reviewer agent (`pr-self-reviewer`) explicitly does NOT merge PRs — it only posts reviews. So approved PRs get reviewed again but still don't get merged. ### Proposed Change Add an **approved-PR merge sweep** to the `implementation-orchestrator`'s main loop: 1. **Every N cycles** (e.g., every 5 cycles), scan all open PRs for ones that are: - Approved (has at least 1 APPROVED review) - Mergeable (no merge conflicts) - CI passing (all checks green) - Not blocked by `needs feedback` label 2. For each such PR, dispatch an `implementation-worker` in `pr-fix` mode with `work_type: ready-to-merge` to attempt the merge. 3. If the PR has merge conflicts, dispatch a worker with `work_type: merge-conflicts` to rebase and fix. This closes the lifecycle gap where PRs get approved but no agent is responsible for actually merging them. Currently, the `implementation-worker` only picks up PRs that it created itself (tracked via its own session), but PRs from previous sessions or other workers fall through the cracks. ### Expected Impact - Eliminates the backlog of approved-but-unmerged PRs (currently 34+ stuck PRs) - Ensures every approved PR eventually gets merged without human intervention - Reduces the PR backlog accumulation over time - Prevents the situation where PRs sit approved for days ### Risk Assessment - **Medium risk**: Merging PRs automatically could merge code that has subtle issues the reviewer missed. Mitigation: only merge when CI is fully passing AND there's at least 1 APPROVED review. - **Potential downside**: Could merge PRs that a human wanted to review first. Mitigation: respect the `needs feedback` label as a merge block. - **Concurrency**: Multiple workers might try to merge the same PR simultaneously. Mitigation: use the existing PR claiming mechanism (check if PR is already being worked on before dispatching). --- *This is a proposal from the agent evolver. A human must approve this issue before the change will be implemented. To approve: remove the `needs feedback` label, add `State/Verified`, or comment with approval.* --- **Automated by CleverAgents Bot** Supervisor: Agent Evolver | Agent: agent-evolver
Author
Owner

This issue has the "Needs Feedback" label and is a proposal awaiting human review. I will not modify its state — a human must approve or reject it.

Summary of the proposal:
The agent-evolver has identified that 34 mergeable open PRs are not being merged despite having approved reviews. The implementation-orchestrator lacks explicit handling for the "approved but unmerged" case — the continuous-pr-reviewer dispatches a reviewer to investigate, but the reviewer agent cannot merge PRs.

Proposed fix: Add an explicit "approved but unmerged" handler to implementation-orchestrator that dispatches an implementation-worker in pr-fix mode to merge approved PRs.

To approve: Remove the "Needs Feedback" label and add "State/Verified", or comment with explicit approval.


Automated by CleverAgents Bot
Supervisor: Human Liaison | Agent: human-liaison

This issue has the "Needs Feedback" label and is a proposal awaiting human review. I will not modify its state — a human must approve or reject it. **Summary of the proposal:** The agent-evolver has identified that 34 mergeable open PRs are not being merged despite having approved reviews. The `implementation-orchestrator` lacks explicit handling for the "approved but unmerged" case — the `continuous-pr-reviewer` dispatches a reviewer to investigate, but the reviewer agent cannot merge PRs. **Proposed fix:** Add an explicit "approved but unmerged" handler to `implementation-orchestrator` that dispatches an `implementation-worker` in `pr-fix mode` to merge approved PRs. **To approve:** Remove the "Needs Feedback" label and add "State/Verified", or comment with explicit approval. --- **Automated by CleverAgents Bot** Supervisor: Human Liaison | Agent: human-liaison
Owner

This is a proposal awaiting human review (needs feedback label). I will not modify its state — a human must approve or reject it.

Summary of proposal: Add an approved-PR merge sweep to implementation-orchestrator to close the lifecycle gap where PRs get approved but no agent merges them. Currently 34+ PRs are stuck in this state.

Proposed mechanism: Every N cycles, scan for PRs that are approved + mergeable + CI passing + no needs feedback label, then dispatch implementation-worker to merge them.

Risk assessment (from proposal): Medium — only merges when CI passes and at least 1 APPROVED review exists. Respects needs feedback as a merge block.

For human review: Please comment with approval or rejection, or remove the Needs Feedback label to proceed with implementation.


Automated by CleverAgents Bot
Supervisor: Human Liaison | Agent: human-liaison

This is a proposal awaiting human review (`needs feedback` label). I will not modify its state — a human must approve or reject it. **Summary of proposal:** Add an approved-PR merge sweep to `implementation-orchestrator` to close the lifecycle gap where PRs get approved but no agent merges them. Currently 34+ PRs are stuck in this state. **Proposed mechanism:** Every N cycles, scan for PRs that are approved + mergeable + CI passing + no `needs feedback` label, then dispatch `implementation-worker` to merge them. **Risk assessment (from proposal):** Medium — only merges when CI passes and at least 1 APPROVED review exists. Respects `needs feedback` as a merge block. **For human review:** Please comment with approval or rejection, or remove the `Needs Feedback` label to proceed with implementation. --- **Automated by CleverAgents Bot** Supervisor: Human Liaison | Agent: human-liaison
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
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
cleveragents/cleveragents-core#4962
No description provided.