Repository navigation
feat(kernel): resolve merge conflicts on open Patchmill pull requests in the run loop - #416
Open
rochecompaan wants to merge 9 commits into
Open
rochecompaan wants to merge 9 commits into
rochecompaan wants to merge 9 commits into
Conversation
…r closed pull requests
rochecompaan
marked this pull request as ready for review
November 23, 2026 13:18
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #405
Before new work, an unattended
run-once/patchmill runpass now finds a Done issue whose open Patchmill implementation pull request conflicts with the base branch. It resolves that conflict first, with an agent session that merges the base (never a rebase or force push). Patchmill then verifies the pushed branch.Spec:
docs/specs/2026-11-23-issue-405-resolve-merge-conflicts-on-open-patchmill-pull-r-design.md· Plan:docs/plans/2026-11-23-issue-405-resolve-merge-conflicts-on-open-patchmill-pull-r-plan.mdWhat changed
KernelGit.mergeConflictrunsgit merge-tree --write-treeon the fetched refs, so it behaves the same on every host and has no "unknown" state.KernelGit.isAncestoris new too.Facts.mergeConflictis set for an open implementation pull request into the base.src/kernel/merge-conflicts.ts:findConflictingPullRequestssearches a candidate list that the caller supplies: open Done issues now, and the runner's own assignments in Add assignments and the patchmill run runner loop #360.<runsDir>/issue-N/merge-conflict-attempt.json) andrun.conflictRetryMinutes(default 30) set the backoff.conflictResolutionGapschecks three things after the session: the branch still conflicts, its history was rewritten, or the base is missing. The result goes toverifyOutcome, and a failure stops with Needs Info.runOneIssue: the search runs for unattended runs without--issueonly. The run takes the first issue lock that is free, so a held lock falls back to normal selection. A conflict that is already gone stops with Done and no session.ownsPullRequestis now exported frompull-request.ts, so that ownership has one rule.patchmill doctorhas a newgitcheck. The Nix wrapper puts nixpkgs Git first onPATH(--prefix), and the install check verifies this.## Merge conflictssection, and the installed copy was refreshed withskills update. README and site docs are updated, andGLOSSARY.mdhas a new Conflict resolution entry.Rulings (cost if wrong)
Deferred minor findings
listOpenIssuestwice: once for the search and once for selection.merged-cleanup.tskeeps its own copy of the base-branch rule. It could callresolveBaseBranch.Validation
npm run lint: pass (0 errors)npm test: 1780 pass, 0 failnix build -L(includesnpm testand the install check): pass80cc34a: Node test and lint, Nix package build, and Site audit and build all passFrontend review
Not applicable: kernel, Git, packaging, skill text, and docs only. There is no browser-visible change.
Human Reviewer Callouts (Non-Blocking)
patchmill doctorreports why.PATHfor Patchmill and all its child processes (Pi,gh,tea). A system credential helper named by a short name (for examplelibsecret) will no longer be found. The README documents this.run.conflictRetryMinutes(default 30). The change is additive; unknown-key rejection is unchanged.<runsDir>/issue-N/merge-conflict-attempt.json. It is a backoff hint only, so no migration is needed.doneissues back toinProgressand push merge commits to open PR branches without asking. No force push is used.Patchmill run cost
Includes all retained local runs for this issue, including specification and planning PRs. Prompt tokens include uncached input, cache reads, and cache writes. Estimated cost uses Pi's recorded model pricing and includes parent and subagent sessions.