Adds take-side fallback for all conflict types in AI Resolve - #5393#5396
Conversation
🤖 Augment PR SummarySummary: Extends the Commit Graph AI Resolve panel to handle non-text conflicts by classifying conflict kinds and offering manual take-side actions when AI can’t auto-merge. Changes:
Notes: Manual take-side resolutions share the same Apply/Discard lifecycle as AI resolutions; rename/rename also queues the losing path as a pending delete to avoid leaving both names in the working tree. 🤖 Was this summary useful? React with 👍 or 👎 |
There was a problem hiding this comment.
Pull request overview
This PR expands the Commit Graph WIP AI Resolve panel to better handle non-text merge conflicts by classifying conflict types, surfacing clearer labels, and enabling manual “take-side” fallbacks that queue pending resolutions until Apply. It also improves conflict parsing by decoding UTF-16/BOM-encoded files when reading conflicted content for the resolver.
Changes:
- Adds conflict-kind classification (including rename-aware detection) and attaches conflict metadata to skipped/errored resolve rows.
- Adds manual take-side fallback actions in the resolve panel that queue resolutions into the existing Apply/Discard lifecycle.
- Fixes conflict read/write to preserve encoding (UTF-16/BOM) and line endings (CRLF/LF) when integrating with
@gitkraken/conflict-tools.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/webviews/rebase/tests/conflictResolution.utils.test.ts | Adds unit coverage for classifyConflictKind behavior across statuses/modes/oids/hints. |
| src/webviews/plus/graph/graphWebview.ts | Enriches skipped/errored resolve results with conflict-type info and adds RPC to queue take-side resolutions. |
| src/webviews/plus/graph/graphService.ts | Extends graph inspect service types to carry conflict fallback metadata and take-side RPC result types. |
| src/webviews/apps/plus/graph/components/gl-graph-details-panel.ts | Wires resolve panel events to the new take-side workflow action and passes staging state. |
| src/webviews/apps/plus/graph/components/gl-details-resolve-mode-panel.ts | Renders conflict-type labels for skipped/errored rows and adds take-side fallback buttons. |
| src/webviews/apps/plus/graph/components/detailsWorkflowController.ts | Implements the webview-side workflow for queuing take-side resolutions and promoting rows to resolved. |
| src/webviews/apps/plus/graph/components/detailsState.ts | Adds transient state to track in-flight take-side actions for per-row busy UI. |
| src/webviews/apps/plus/graph/components/detailsActions.ts | Adds an action wrapper calling the new takeConflictSide RPC. |
| src/plus/coretools/conflict/integration.ts | Reads conflicted files as bytes and decodes/encodes by detected encoding; preserves EOLs on write. |
| src/plus/coretools/conflict/encoding.ts | Introduces minimal BOM/UTF-16 detection + decode/encode helpers for conflict-tools I/O. |
| src/plus/coretools/conflict/tests/encoding.test.ts | Adds unit tests for encoding detection/round-trip (including marker parseability). |
| src/git/utils/-webview/conflictKind.utils.ts | Adds host-side conflict info builder including rename correlation via merge-base diff status. |
| src/git/utils/-webview/tests/conflictKind.utils.test.ts | Adds unit tests for rename detection scenarios. |
| packages/git/src/utils/conflictResolution.utils.ts | Adds ConflictKind classification and getConflictKindLabel utilities. |
| CHANGELOG.md | Documents the new resolve-panel fallback actions, labels, and UTF-16/BOM decoding behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The AI Resolve mode in the Commit Graph WIP details panel could only auto-merge text conflicts; binary, symlink, submodule, file-mode, add/add, and rename conflicts were skipped (or errored) and left as dead-end "needs review" rows with no way to act on them. - Classifies every conflict by kind from its XY status + per-stage file modes/oids, and detects rename/rename, rename/delete, and rename/modify conflicts by reusing the merge-base rename correlation already used for conflict diffs - Labels skipped and errored rows by conflict type and offers inline Take Current / Take Incoming / Delete actions, gated by which side has content to take - Queues a chosen side as a pending resolution that rides the same review-then-Apply lifecycle as AI resolutions (applied on Apply, dropped on Discard) rather than mutating the working tree on click; the rename/rename loser is queued as a pending delete so the panel mirrors exactly what will be applied - Decodes UTF-16/BOM-encoded files in the conflict read path so their conflicts parse and resolve instead of being skipped as marker-less
8837996 to
1d9367f
Compare
Summary
The AI Resolve mode in the Commit Graph WIP details panel (shipped in 18.2.0) could only auto-merge text conflicts. Binary, symlink, submodule, file-mode, add/add, and rename conflicts were skipped (or errored) and left as dead-end "needs review" rows with no way to act on them — the user had to leave the panel and resolve them by hand. This addresses the AI-panel portion of #5393.
What's included
classifyConflictKindderives a richer kind (binary / symlink / submodule / mode-only / add-add / delete-modify / both-deleted / rename-*) from the XY status + per-stage file modes/oids. Rename/rename, rename/delete, and rename/modify are detected by reusing the merge-base rename correlation (resolveConflictFilePaths) already used for conflict diffs — no new git plumbing.AU→ current only,UA→ incoming only,DD→ delete).applyResolutionsalready appliestake-ours/take-theirs/deletedwith no content.)Testing
classifyConflictKind(status × mode/oid/hint matrix),detectRename(rename/rename, rename/delete, rename/modify + negatives), and the UTF-16/BOMdetectEncodinground-trip.pnpm run checkclean.git ls-files -uoutput; buttons gate correctly per status.