Skip to content

Adds take-side fallback for all conflict types in AI Resolve - #5393#5396

Merged
ianhattendorf merged 1 commit into
mainfrom
feature/#5393-conflict-types
Jun 25, 2026
Merged

Adds take-side fallback for all conflict types in AI Resolve - #5393#5396
ianhattendorf merged 1 commit into
mainfrom
feature/#5393-conflict-types

Conversation

@ianhattendorf

Copy link
Copy Markdown
Contributor

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

  • Conflict-type classificationclassifyConflictKind derives 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.
  • Take-side fallback in the resolve panel — skipped and errored rows are now labeled by conflict type and offer inline Take Current / Take Incoming / Delete actions, gated by which side actually has content (e.g. AU → current only, UA → incoming only, DD → delete).
  • Queued, not immediate — choosing a side queues a pending resolution that rides the same review-then-Apply lifecycle as AI resolutions: written to the working tree only on Apply, dropped on Discard. The rename/rename loser is queued as a pending delete so the panel mirrors exactly what will be applied. (The library's applyResolutions already applies take-ours/take-theirs/deleted with no content.)
  • Encoding fix — the conflict read path decodes UTF-16/BOM-encoded files so their conflicts parse and resolve instead of being skipped as marker-less.

Testing

  • UnitclassifyConflictKind (status × mode/oid/hint matrix), detectRename (rename/rename, rename/delete, rename/modify + negatives), and the UTF-16/BOM detectEncoding round-trip. pnpm run check clean.
  • Live — exercised against a real conflicted merge (all 13 conflict types) in a scratch repo via the Pro + AI simulators:
    • Classification matches real git ls-files -u output; buttons gate correctly per status.
    • Take side → working tree unchanged (queued); Discard applies nothing; Apply resolves with the correct blob/deletion and accurate "Apply N" count.
    • rename/rename: keeping one name queues the loser's deletion; on Apply the tree isn't left carrying both names.
    • No new console errors.

@augmentcode

augmentcode Bot commented Jun 24, 2026

Copy link
Copy Markdown
🤖 Augment PR Summary

Summary: 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:

  • Added ConflictKind + classifyConflictKind and user-facing labels/descriptions for richer conflict-type reporting
  • Introduced host-side conflict enrichment (getConflictFileInfos + rename correlation) to attach kind + stageability to skipped/errored rows
  • Added UI fallback actions (Take current / Take incoming / Delete) for skipped/errored conflicts and queued them as pending resolutions applied only on Apply
  • Implemented RPC plumbing to queue take-side resolutions and promote affected rows into the resolved list without re-running AI
  • Added BOM/UTF-16 decode+encode support in the conflict-tools git port to avoid silently skipping marker-less UTF-16 conflicts
  • Added unit tests for conflict kind classification, rename detection, and encoding round-trips

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 👎

@augmentcode augmentcode Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review completed. 2 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Comment thread packages/git/src/utils/conflictResolution.utils.ts
Comment thread src/webviews/plus/graph/graphWebview.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Comment thread packages/git/src/utils/conflictResolution.utils.ts
Comment thread src/plus/coretools/conflict/__tests__/encoding.test.ts Outdated
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
@ianhattendorf ianhattendorf force-pushed the feature/#5393-conflict-types branch from 8837996 to 1d9367f Compare June 25, 2026 00:21
@ianhattendorf ianhattendorf merged commit 1ca090d into main Jun 25, 2026
6 checks passed
@ianhattendorf ianhattendorf deleted the feature/#5393-conflict-types branch June 25, 2026 00:24
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