Skip to content

fix: repair conflicting PRs in idle pickup - #34

Merged
lemarier merged 1 commit into
mainfrom
lemarier/repair-conflicting-prs
Sep 27, 2026
Merged

lemarier merged 1 commit into
mainfrom
lemarier/repair-conflicting-prs

Conversation

@lemarier

Copy link
Copy Markdown
Contributor

A picked-up PR that starts conflicting after its worker settles had no owner. The author's review follow-up handles conflicts only while it runs, the merge gate skips a conflicting PR for 24 hours and then hands it to the user, and idle pickup only claims issues. On 2026-09-27, km43 #159, #162 and #164 each went stale when a sibling allocation in protocol.toml merged first, and waited until someone noticed.

Idle pickup now owns that repair:

  • The precheck also starts a run when one of the user's open, non-draft PRs conflicts and no agent in its worktree is working, even when the issue limit is reached.
  • The coordinator starts one repair worker in the PR's existing worktree before any new issue. The worker applies the review follow-up's Wait for merge rules: merge the base in, never rebase or force-push, regenerate generated files, run the checks, and treat a behaviour choice as a blocker with needs-human-review.
  • Repairs do not use the issue limit and are capped at two at once.
  • Two issues that allocate in the same generated file no longer run at once.
  • The merge gate's Skip rule names the repair as the owner after the follow-up ends.
  • The job runs around the clock instead of on weekdays, so stale work does not wait for a working day.

Validation: just check passes. Exercised live in origin89-firmware's issue coordinator: its precheck flagged km43 #164 with both issue slots full, and the run dispatched a repair worker to it.

Copilot AI lite review requested due to automatic review settings September 27, 2026 17:02

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-27T17:06:52.142068Z 072d5cf PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

📝 Walkthrough

Walkthrough

Idle pickup now runs every 15–30 minutes around the clock. Its precheck can start a run for an eligible conflicting PR even when the issue limit is reached. Issue selection skips issues blocked by open issues and avoids concurrent issues that allocate in the same generated file. A new procedure repairs eligible conflicting PRs before issue claims. The merge-gate Skip description now assigns conflict handling to idle pickup until the PR merges.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: 🟡 Moderate · up to 072d5

Human-blocked repairs can be dispatched repeatedly, and the repair command omits required task and launch metadata. These issues can waste scheduled capacity and prevent the new conflict-repair workflow from operating correctly; fix them before merging.

Architecture Summary

Architecture risk: 🔵 Low · up to 072d5

The change affects 1 system.

Changed systems: skills

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — skills (service) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in skills/origin89-orca/references/unattended-run.md: Idle pickup’s schedule changes from every 15 minutes on weekdays to every 15–30 minutes around the clock.
  • observed — Modified behavior in skills/origin89-orca/references/unattended-run.md: The precheck gains a run-start condition for a user’s open, non-draft PR that conflicts with its base when no agent in its worktree is working; this condition applies even when the issue limit is reached.
  • observed — Modified behavior in skills/origin89-orca/references/unattended-run.md: Issue selection now skips issues blocked by an open issue and prevents concurrent issues that allocate in the same generated file, requiring the second to wait for the first to merge.
  • observed — Modified behavior in skills/origin89-orca/references/unattended-run.md: Adds a conflicting-PR repair procedure: before claiming issues, select PRs with no working agent or live Dispatch owner, and leave dirty worktrees or branches whose HEAD differs from the pushed head untouched. Start supervised repair workers in eligible PR worktrees; have them merge the base without rebasing or force-pushing, resolve only clear-intent conflicts (regenerating generated files after choosing a side), run checks, push, and confirm mergeability with CI started. Ambiguous behavior choices are escalated with needs-human-review. Repairs do not use the issue limit or relabel issues; at most two run concurrently, and the new head must be mergeable with checks green before worker release.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: repairing conflicting pull requests through idle pickup.
Description check ✅ Passed The description explains the problem, resulting behavior, key constraints, and validation. It includes the required Change and Validation content and reports both automated and live testing.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 072d5cf85c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +272 to +274
Before claiming new issues, list the user's open, non-draft PRs whose
`mergeable` is `CONFLICTING`. Take each one whose worktree has no `working`
agent and whose branch no live Dispatch in any Run owns; never add a second

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Restrict repair dispatches to idle-pickup PRs

This selection includes every open, non-draft PR authored by the user, rather than only PRs created by this idle-pickup workflow. If a manually maintained PR or a PR owned by another automation conflicts while its agent is idle, this job can start a worker that merges and pushes to that branch without the branch-specific authority assumed here. Require durable pickup ownership, such as the linked issue/worktree claim, before dispatching a repair.

AGENTS.md reference: AGENTS.md:L19-L21

Useful? React with 👍 / 👎.

Comment on lines +272 to +274
Before claiming new issues, list the user's open, non-draft PRs whose
`mergeable` is `CONFLICTING`. Take each one whose worktree has no `working`
agent and whose branch no live Dispatch in any Run owns; never add a second

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Skip PRs already handed over for human review

The repair worker adds needs-human-review when a conflict requires a behavioral choice, but this eligibility test ignores that label. Once that worker settles, the PR remains conflicting with no working agent or live Dispatch, so every 15–30 minute run can launch another repair worker and post the same handoff again. Exclude needs-human-review and human-only PRs from both the precheck and repair selection.

Useful? React with 👍 / 👎.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

Quiet mode is enabled, so only the most important comments were posted inline. Other review comments are grouped below.

🟡 Other comments (2)
skills/origin89-orca/references/unattended-run.md-278-280 (1)

278-280: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Pass the repair spec and launch metadata to worker-start.

This is a supervised scheduled launch. The documented contract requires --spec, --repo, --name, and --agent. The current command passes only --worktree, so it does not provide the required repair task and launch context.

Suggested fix
-worker-start --worktree path:<worktree>`. Its spec applies the Wait for merge
+worker-start --spec "<repair task>" --worktree path:<worktree> --repo <repo> --name <branch> --agent <agent> --json`. Its spec applies the Wait for merge
skills/origin89-orca/references/unattended-run.md-193-195 (1)

193-195: 🚀 Performance & Scalability | 🟡 Minor | ⚡ Quick win

Exclude human-blocked PRs from repair pickup.

After the coordinator adds needs-human-review for an ambiguous conflict, the PR still satisfies both the idle-pickup precheck and repair-selection criteria. The next run can dispatch another repair before a human removes the label.

Suggested fix
-or when one of the user's open, non-draft PRs conflicts with its base and no
-agent in its worktree is `working`. That condition starts a run even when the
-issue limit is reached; see [Repair conflicting PRs](#repair-conflicting-prs).
+or when one of the user's open, non-draft PRs conflicts with its base, lacks
+`needs-human-review`, and no agent in its worktree is `working`. That condition
+starts a run even when the issue limit is reached; see [Repair conflicting PRs](#repair-conflicting-prs).
 
-Take each one whose worktree has no `working`
-agent and whose branch no live Dispatch in any Run owns; never add a second
-writer.
+Take each one whose worktree has no `working` agent, whose branch no live
+Dispatch in any Run owns, and which lacks `needs-human-review`; never add a
+second writer.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: QUIET

Plan: Advanced

Run ID: 02779302-ca92-4069-abb3-8fb6de6bb9f8

📥 Commits

Reviewing files that changed from the base of the PR and between a42d206 and 072d5cf.

📒 Files selected for processing (1)
  • skills/origin89-orca/references/unattended-run.md

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

@lemarier
lemarier merged commit 7c4f584 into main Sep 27, 2026
6 checks passed
@lemarier
lemarier deleted the lemarier/repair-conflicting-prs branch September 27, 2026 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants