You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add a button to hand PR merge conflicts to the agent (#294)
## Summary
- The PR pane already knows when GitHub reports a conflicting merge, but
acting on it meant switching to the chat and typing the request. This
adds a one-click handoff: an **Ask the agent to fix conflicts** button
appears above the CI-notify checkbox when `hasConflict === true` on an
open PR.
- Clicking it injects a message naming the PR, branch, and base into
that worktree's agent chat, reusing the existing `deliverToWorktreeChat`
routing — so it wakes a slept chat tab the same way the CI-failure
notifier does. It lands in the transcript as a labelled `Ness · Merge
conflicts` card, not as something the user typed.
- Deliberately a **button** rather than the standing opt-in CI failures
get: a branch that conflicts with its base usually conflicts with every
other in-flight branch too, so firing this automatically would put the
whole workspace to work over one bad merge base.
Two things the message deliberately leaves out, both commented at
`buildMergeConflictMessage`:
- **No file list.** The local base ref is often stale, so a `git
merge-tree` preview from Ness would name files the agent then finds
clean — it has git and can see the real answer.
- **No merge-vs-rebase prescription.** Plenty of repos keep linear
history. The agent can read the convention off `git log` and CLAUDE.md,
and Ness has no setting that records it (`mergeStrategy` is how a PR
*lands on main*, which says nothing about how a branch syncs with its
base).
## Test plan
- [x] `npm run typecheck` clean
- [x] `npx electron-vite build` clean
- [x] `npx vitest run` — new `merge-conflict-request.test.ts` covers the
sentinel round-trip (guards the `merge-conflict` automation source being
registered, without which the chat would render it as a plain user turn)
and that the PR number / branch / base / URL make it into the body
- [ ] **Not visually verified in a running app** — the button only
renders when GitHub reports a conflicting PR, which I couldn't stage
locally. Worth a manual look on a real conflicted PR before merge:
button appearance, the sending → "Asked the agent" → idle transition,
and the chat card rendering.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
`PR #${pr.number} (${pr.branch}) has merge conflicts with ${pr.baseBranch}. Please resolve them.`,
21
+
'',
22
+
`Bring the branch up to date with the latest ${pr.baseBranch} — rebase or merge, whichever matches this repo's convention — and resolve each conflict. Verify the build still passes, then push so the PR updates (force-with-lease if you rebased).`,
0 commit comments