Skip to content

fix: repair stale PRs on every supervision pass - #36

Merged
lemarier merged 2 commits into
mainfrom
lemarier/stale-pr-repair-rule
Sep 27, 2026
Merged

lemarier merged 2 commits into
mainfrom
lemarier/stale-pr-repair-rule

Conversation

@lemarier

@lemarier lemarier commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #34. On 2026-09-27, km43 #165 went CONFLICTING when sibling #164 merged at 17:47Z, and nothing repaired it for about 20 minutes. The repair rule ran only before claiming new issues, so a coordinator busy supervising never reached it, and the precheck matched only CONFLICTING while GitHub still reported UNKNOWN right after the base moved.

Changes in the Idle pickup and Merge gate sections of unattended-run.md:

  • The coordinator owns repair of its repositories' open, non-draft PRs whose worker has settled, and checks at the start of every supervision pass, not only before pickup.
  • A PR needs repair when it is CONFLICTING, or still UNKNOWN after reading it with gh api repos/owner/repo/pulls/<number> and listing again, lacks needs-human-review and human-only, and no live agent holds its worktree.
  • For a still-UNKNOWN PR, the repair worker test-merges the base locally and pushes nothing when that is clean, so an unneeded update does not restart reviews; a PR still UNKNOWN on a later pass is handed over.
  • A dirty or diverged worktree, or a resolution that chooses between behaviours, is handed over: needs-human-review (which stops later passes repeating it), a PR comment, the report, and a Roger Ask when set up.
  • The Merge gate Skip rule no longer says the author's follow-up always resolves conflicts; it does so only while it runs.

Repair still merges the base in, never rebases or force-pushes, and does not use issue slots. pr-review-follow-up.md is unchanged.

Validation: just check passes (32 tests). The #repair-conflicting-prs anchor resolves.

Closes #35

Copilot AI lite review requested due to automatic review settings September 27, 2026 18:12

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-27T18:15:03.557987Z 269b2e3 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.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: QUIET

Plan: Advanced

Run ID: 6533ebfa-e118-4c43-b86a-79671884fb99

📥 Commits

Reviewing files that changed from the base of the PR and between 269b2e3 and f05133e.

📒 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.


📝 Walkthrough

Walkthrough

Idle pickup now starts runs for open, non-draft PRs that need repair, including PRs with persistent UNKNOWN mergeability. Repair checks run at the start of every supervision pass. Dirty worktrees, changed heads, and conflicts that require a behavior choice are routed to the user. Roger is used when configured. Merge-gate guidance states that idle pickup owns conflicts after review follow-up ends.

Priority: ⬇️ Low

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

Severity of issue fixed: Low

Merge Risk: 🟡 Moderate · up to f0513

PRs that remain UNKNOWN may trigger repeated no-op repair runs before handoff. Clarify how the next supervision pass uses the prior result before merging.

Architecture Summary

Architecture risk: 🔵 Low · up to f0513

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 now starts a run for an open, non-draft PR needing repair under the repair criteria, not only for a base-conflicting PR without a working agent in its worktree. The trigger still bypasses the issue limit. For UNKNOWN mergeability, coordinators read the PR to start computation and list again after a short wait.
  • observed — Modified behavior in skills/origin89-orca/references/unattended-run.md: Repair checks now run at the start of every supervision pass, including while workers run. Eligible PRs are CONFLICTING or remain UNKNOWN after rechecking, lack needs-human-review and human-only, and have no live agent holding the worktree or live Dispatch owning the branch. Dirty worktrees or heads differing from the pushed head are handed over with needs-human-review, a PR comment, a report entry, and a Roger request when configured.
  • observed — Modified behavior in skills/origin89-orca/references/unattended-run.md: For an UNKNOWN PR, the worker now test-merges the base locally and pushes nothing if the merge is clean; if a later pass still sees UNKNOWN, the coordinator hands it over. A resolution requiring a choice between behaviors remains a blocker, but the coordinator now hands over the PR rather than only adding needs-human-review; the PR comment is retained.
  • observed — Modified behavior in skills/origin89-orca/references/unattended-run.md: The merge-gate skip description now says review follow-up resolves conflicts only while it runs; after it ends, idle pickup repair owns them until the PR merges.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The change satisfies the coding requirements in issue #35. Idle pickup assigns repair checks at the start of every supervision pass, including while workers run and when the issue limit is reached. …
Out of Scope Changes check ✅ Passed The pull request changes only skills/origin89-orca/references/unattended-run.md. The changes implement issue #35 by updating the repair trigger, UNKNOWN handling, ownership, escalation, and Merge …
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…
Title check ✅ Passed The title clearly and concisely identifies the primary change: repairing stale pull requests during every supervision pass.
Description check ✅ Passed The description explains the problem, resulting behavior, implementation constraints, validation command, test result, and resolved anchor. It covers the required Change and Validation information, al…

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: 269b2e32f2

ℹ️ 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 thread skills/origin89-orca/references/unattended-run.md Outdated
Comment thread skills/origin89-orca/references/unattended-run.md Outdated

@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 (1)
skills/origin89-orca/references/unattended-run.md-275-282 (1)

275-282: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Define the persistent UNKNOWN handoff.

The pickup trigger includes PRs that remain UNKNOWN after the API recheck. The repair worker then follows guidance that only defines actions for DIRTY and BEHIND branches. No action changes or hands off a clean PR that remains UNKNOWN. After the worker settles, the same trigger can select the PR again.

Add a bounded handoff and exclude handed-off PRs from the repair trigger.

Suggested fix
-or when one of the user's open, non-draft PRs needs repair as
-[Repair conflicting PRs](#repair-conflicting-prs) defines it. That condition
+or when one of the user's open, non-draft PRs needs repair as
+[Repair conflicting PRs](#repair-conflicting-prs) defines it and does not
+already have `needs-human-review`. That condition
@@
 Read each such PR with `gh api repos/owner/repo/pulls/<number>` to
-start the computation, then list again after a short wait.
+start the computation, then list again after a short wait. If it remains
+`UNKNOWN`, add `needs-human-review`, report it to the user, and do not start
+a repair worker.
@@
-A PR needs repair when its `mergeable` is `CONFLICTING`, or still `UNKNOWN`
-after the `recheck` above, and no live agent holds its worktree and no live
+A PR needs repair when its `mergeable` is `CONFLICTING`, and no live agent
+holds its worktree and no live

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: QUIET

Plan: Advanced

Run ID: 4d59d5eb-d0ee-4a7f-ad1d-f765dac11672

📥 Commits

Reviewing files that changed from the base of the PR and between 7c4f584 and 269b2e3.

📒 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; 2 remain after this review.

@lemarier

Copy link
Copy Markdown
Contributor Author

CodeRabbit's persistent UNKNOWN finding (lines 275-282) is addressed in f05133e: a clean test-merge pushes nothing, a still-UNKNOWN PR on a later pass is handed over with needs-human-review, and labelled PRs are excluded from repair.

@lemarier
lemarier merged commit 007d10f into main Sep 27, 2026
6 checks passed
@lemarier
lemarier deleted the lemarier/stale-pr-repair-rule branch September 27, 2026 18:32
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.

Idle pickup misses PRs that go stale while supervising or report UNKNOWN

2 participants