Skip to content

feat: add conflict resolution for bot PRs to nightly cleaner - #1307

Merged
max-sixty merged 2 commits into
mainfrom
nightly/resolve-bot-conflicts
Mar 6, 2026
Merged

max-sixty merged 2 commits into
mainfrom
nightly/resolve-bot-conflicts

Conversation

@worktrunk-bot

Copy link
Copy Markdown
Collaborator

Summary

  • Adds a "Step 0" to the nightly cleaner that checks for open worktrunk-bot PRs with merge conflicts
  • Conflicted PRs are resolved using Claude subagents (Task tool), run in parallel
  • Each subagent checks out the PR branch, merges main, resolves conflicts, pushes, and monitors CI
  • Falls back to commenting on the PR if conflicts are too complex to resolve confidently

Requested by @max-sixty in #1253.

Test plan

  • Trigger via workflow_dispatch when a bot PR has conflicts to verify end-to-end
  • Verify no-op behavior when no bot PRs are conflicted

🤖 Generated with Claude Code

Adds a Step 0 to the nightly cleaner prompt that checks for open
worktrunk-bot PRs with merge conflicts and resolves them using
Claude subagents before proceeding to the code review sweep.

Each conflicted PR gets a dedicated subagent that checks out the
branch, merges main, resolves conflicts, pushes, and monitors CI.
PRs are processed in parallel via the Task tool.

Requested in #1253.

Co-Authored-By: Claude Opus 4.6 <[email protected]>

@worktrunk-bot worktrunk-bot left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Two issues with the parallel subagent design:

Parallel checkout conflict (should fix): The instructions tell subagents to run gh pr checkout <number> in parallel, but all subagents share the same git working directory. When two subagents check out different PR branches simultaneously, they'll clobber each other's state. Each subagent needs an isolated working directory — e.g., clone to a temp dir or use git worktree add per PR branch.

/tmp/comment.md never created (minor): Step 5 references gh pr comment <number> -F /tmp/comment.md, but nothing in the instructions creates that file. If the intent is for the subagent to write the comment content first, this should be explicit. Additionally, parallel subagents would collide on the same /tmp/comment.md path — use a unique path per PR or just use --body inline.

- Instruct subagents to use isolated directories (worktree/clone) to
  avoid checkout conflicts when resolving multiple PRs in parallel
- Replace `-F /tmp/comment.md` (never created, collides across agents)
  with `--body "..."` inline

Co-Authored-By: Claude <[email protected]>
@max-sixty
max-sixty merged commit ac0ade9 into main Mar 6, 2026
21 checks passed
@max-sixty
max-sixty deleted the nightly/resolve-bot-conflicts branch March 6, 2026 16:46
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