Skip to content

fix: repair dirty automerge prs#23

Merged
clawsweeper[bot] merged 1 commit intomainfrom
codex/automerge-dirty-repair
May 1, 2026
Merged

fix: repair dirty automerge prs#23
clawsweeper[bot] merged 1 commit intomainfrom
codex/automerge-dirty-repair

Conversation

@steipete
Copy link
Copy Markdown
Contributor

@steipete steipete commented May 1, 2026

Summary

  • route trusted automerge pass markers with dirty/behind/conflicting merge state into cloud repair instead of trying a blocked merge
  • keep the existing failing-checks repair path on the same dispatch helper
  • carry GitHub mergeable state into the PR target snapshot and cover the rebase trigger helper

Validation

  • pnpm run test:repair
  • pnpm run lint
  • pnpm exec oxfmt --check --threads=1 src/repair/comment-router.ts src/repair/comment-router-core.ts src/repair/comment-router-core.test.ts
  • git diff --check

@steipete
Copy link
Copy Markdown
Contributor Author

steipete commented May 1, 2026

@clawsweeper automerge

@clawsweeper clawsweeper Bot added the clawsweeper:automerge Maintainer opted this ClawSweeper PR into bounded ClawSweeper-reviewed automerge label May 1, 2026
@clawsweeper
Copy link
Copy Markdown
Contributor

clawsweeper Bot commented May 1, 2026

🦞🦞
ClawSweeper automerge is enabled for this PR.

I added clawsweeper:automerge and asked ClawSweeper to review this head. If ClawSweeper emits a repair marker or requests changes, I will repair/rebase the branch and ask for another review, up to the configured round limit.

Draft PRs stay fix-only until GitHub marks them ready for review. A maintainer can pause this with /clawsweeper stop.

@clawsweeper
Copy link
Copy Markdown
Contributor

clawsweeper Bot commented May 1, 2026

Codex review: passed for ClawSweeper automerge.

What this changes:

The PR routes trusted automerge pass markers with dirty, behind, or conflicting merge state into the repair dispatch path, adds mergeable state to PR target snapshots, refactors the passed-repair dispatch helper, and adds regression tests.

Automerge follow-up:

No repair-lane job is needed from this review; the PR is already opted into automerge and has no actionable review finding for an automated repair worker.

Security review:

Security review cleared: No concrete security or supply-chain issue found; the diff changes router logic and tests only, with no workflow, dependency, permission, secret, or package-resolution changes.

Review details

Best possible solution:

Land the narrow router change after the normal automerge gates pass, so trusted clean review markers trigger a repair pass when GitHub reports stale or conflicting merge state instead of ending as a blocked merge attempt.

Do we have a high-confidence way to reproduce the issue?

Yes. A high-confidence reproduction path is a trusted ClawSweeper automerge pass marker on an opted-in PR whose target has DIRTY or BEHIND merge_state_status, or CONFLICTING mergeable state; current main plans merge, while the PR's helper tests cover the repair-trigger cases.

Is this the best way to solve the issue?

Yes. Routing the decision in classifyAutomergePass is the narrowest maintainable fix because the target snapshot already carries GitHub merge state, exact-head validation still runs first, and autoRepairAlreadyPlanned continues to cap repeated repair dispatches.

What I checked:

  • Current pass routing: On current main, classifyAutomergePass dispatches repair only for repairable failing checks; with no failed checks it plans a merge action and has no dirty/behind/conflicting merge-state repair branch. (src/repair/comment-router.ts:556, 5f748993fae9)
  • Current merge-state snapshot: Current main carries merge_state_status into the PR target snapshot, but not mergeable, so the proposed conflicting-mergeable check is not already available in the pass classifier target. (src/repair/comment-router.ts:1474, 5f748993fae9)
  • Existing late merge gate: The later merge readiness check blocks non-MERGEABLE and non-CLEAN/HAS_HOOKS states, which explains the stuck behavior: current main catches dirty state only after it has already planned a merge rather than dispatching repair. (src/repair/comment-router.ts:1402, 5f748993fae9)
  • PR diff scope: The PR adds automergeRebaseRepairReason, reuses a shared classifyPassedAutomergeRepair helper for failing checks and rebase repair, adds mergeable to classifyPullTarget, and adds helper tests for DIRTY, BEHIND, CONFLICTING, and clean states. (src/repair/comment-router-core.ts:163, 3b3a1cfc372a)
  • Test placement fits repo pattern: tsconfig.repair includes src/repair/**/.ts and test:repair runs dist/repair/.test.js, matching the existing src/repair/fix-prompt-builder.test.ts pattern. (package.json:52, 5f748993fae9)
  • Feature history: Recent main-history commits for the same comment-router/automerge repair area include 06fd342 and 8d608f9, both by steipete. (src/repair/comment-router.ts:530, 06fd342a7bc6)

Likely related people:

  • steipete: The recent main history for src/repair/comment-router.ts, src/repair/comment-router-core.ts, and the repair test surface is dominated by automerge/comment-router commits from this handle, including the failing-check repair path this PR extends. (role: recent maintainer and feature-history owner; confidence: high; commits: 06fd342a7bc6, 8d608f9fe535, 808176c417f4; files: src/repair/comment-router.ts, src/repair/comment-router-core.ts, test/repair/comment-router-core.test.mjs)

Codex review notes: model gpt-5.5, reasoning high; reviewed against 6df47f88f85d.

@clawsweeper clawsweeper Bot merged commit 1f2ada4 into main May 1, 2026
4 checks passed
@clawsweeper
Copy link
Copy Markdown
Contributor

clawsweeper Bot commented May 1, 2026

🦞🦞
Thanks, ClawSweeper. ClawSweeper merged this PR after the passing review.

Source: clawsweeper[bot]
Feedback: structured ClawSweeper verdict: pass (sha=3b3a1cfc372a8e3f9c9e66a0b05cbef16122ed24)
Merge status: merged by ClawSweeper automerge
Merged at: 2026-05-01T01:31:24Z

The automerge loop is complete.

@clawsweeper clawsweeper Bot deleted the codex/automerge-dirty-repair branch May 1, 2026 01:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clawsweeper:automerge Maintainer opted this ClawSweeper PR into bounded ClawSweeper-reviewed automerge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant