Skip to content

Fixes AI Resolve mode for conflicts without an active operation#5489

Merged
ianhattendorf merged 1 commit into
mainfrom
conflict-error-after-pull
Jul 10, 2026
Merged

Fixes AI Resolve mode for conflicts without an active operation#5489
ianhattendorf merged 1 commit into
mainfrom
conflict-error-after-pull

Conversation

@ianhattendorf

Copy link
Copy Markdown
Contributor

Fixes #5487

Problem

The Resolve mode in the Commit Graph WIP details panel (AI conflict resolution) failed immediately with "No active merge, rebase, or cherry-pick conflicts to resolve." whenever the conflicted files had no in-progress Git operation — e.g. a git stash pop/apply conflict, a git pull with autostash where the re-apply conflicts, or the tree left conflicted after git merge --quit. In these cases Git records unmerged index entries but writes no MERGE_HEAD/CHERRY_PICK_HEAD/REVERT_HEAD/rebase state, so getPausedOperationStatus() correctly returns undefined.

The entry point is gated purely on conflict status (correct), but three RPC handlers additionally required a paused operation, so the user could enter the flow only to be kicked out.

Fix

All changes are in src/webviews/plus/graph/graphWebview.ts:

  • resolveConflicts / reresolveFile — no longer require a paused operation. The status was only used to derive the resolver's ours/theirs/base refs, which @gitkraken/conflict-tools treats as optional enrichment (without refs it skips the three-way diff and resolves from the conflict markers). Refs are now derived via a small getResolutionRefs() helper that returns undefined when no operation is active — deliberately not guessing at a stash ref (e.g. stash@{0}), which could be wrong and would feed the resolver a misleading three-way diff.
  • applyResolutions — the apply-time paused-op stale guard is removed in favor of the existing per-file listUnmergedPaths guard. That guard already covers every external staleness scenario (merge/rebase --abort, --continue, reset, external resolution all clear unmerged entries), and the removed guard had false positives (merge --quit leaves files conflicted but removes MERGE_HEAD) it should never have refused.

No UI, protocol, or telemetry changes are needed — the resolve panel copy is already operation-agnostic, and telemetry records no operation type.

Testing

pnpm run check and pnpm run test (1057 passing) both clean.

Verified live against a prepared stash-pop repro (UU file, no operation state) across three rounds:

  • Op-less resolve → apply: run proceeds (no gate error), Take Current fallback → Apply → "Resolved 1 file.", disk merged/staged/clean.
  • reresolveFile (per-file retry with feedback): RPC completes, no "no longer in progress" error.
  • Apply staleness guard: externally git add-ing the conflicted file → Apply correctly refuses with "These files are no longer conflicted — nothing was applied.", disk untouched.
  • Op-backed regression: a real merge conflict (MERGE_HEAD present) still shows the paused-op banner and resolves normally; after git merge --abort, Apply refuses via the per-file guard with disk untouched.

The error string "No active merge, rebase, or cherry-pick conflicts to resolve." never appeared in the panel, console, or logs across all scenarios.

@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. No suggestions at this time.

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

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

Fixes AI conflict resolution in the Commit Graph WIP details “Resolve” flow when conflicts exist without an in-progress git operation (e.g., stash pop/apply conflicts, pull with autostash re-apply conflicts, or after git merge --quit). This aligns the RPC handlers with the entry point’s operation-agnostic conflict gating and allows conflict-tools to run without optional ref enrichment.

Changes:

  • Removed the hard requirement for a paused operation in resolveConflicts and reresolveFile, deriving optional ResolutionRefs via a new getResolutionRefs() helper.
  • Removed the apply-time paused-operation stale guard and relied on the existing per-file listUnmergedPaths guard to prevent applying stale resolutions.
  • Added a changelog entry documenting the fix for op-less conflict scenarios.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/webviews/plus/graph/graphWebview.ts Makes AI resolve/reresolve/apply work when conflicts exist without paused op state by making refs optional and adjusting staleness guarding.
CHANGELOG.md Documents the user-facing fix for AI Resolve mode in op-less conflict cases.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/webviews/plus/graph/graphWebview.ts Outdated
@gitkraken-services

gitkraken-services Bot commented Jul 9, 2026

Copy link
Copy Markdown

🟢 Conflict resolved with 100% confidence

Apply conflict resolution in GitKraken

Comment gitkraken apply to apply this conflict resolution.


Resolution details

🟢 CHANGELOG.md (merged, 100%)

Merged both sets of bug fixes into the CHANGELOG. The 'theirs' side contains the fix for AI conflict resolution (PR context), while 'ours' contains several other UI and functional fixes. Both are valid and non-overlapping.


Generated by GitKraken at 2026-07-10 14:19:33 UTC

@ianhattendorf ianhattendorf force-pushed the conflict-error-after-pull branch from efcca26 to 2a2d25c Compare July 9, 2026 17:16
@ianhattendorf ianhattendorf requested a review from a team July 9, 2026 17:16
Conflicts can exist without a paused git operation — stash pop/apply,
pull with autostash where the re-apply conflicts, or merge --quit —
but the graph's resolveConflicts, reresolveFile, and applyResolutions
handlers hard-required getPausedOperationStatus() and kicked the user
out with "No active merge, rebase, or cherry-pick conflicts to
resolve."

The paused-op status was only used to derive the resolver's
ours/theirs/base refs, which conflict-tools treats as optional
enrichment (without refs it skips the three-way diff and resolves from
the conflict markers). Refs are now derived via getResolutionRefs(),
which returns undefined when no operation is active rather than
guessing at a stash ref that could be wrong.

The apply-time paused-op stale guard is removed in favor of the
existing per-file listUnmergedPaths guard, which covers every external
staleness scenario (abort/continue/reset all clear unmerged entries)
without wrongly refusing op-less sessions or merge --quit states.

Fixes #5487
@ianhattendorf ianhattendorf force-pushed the conflict-error-after-pull branch from 2a2d25c to 84d6740 Compare July 10, 2026 15:44
@ianhattendorf ianhattendorf merged commit 97f2bc7 into main Jul 10, 2026
6 checks passed
@ianhattendorf ianhattendorf deleted the conflict-error-after-pull branch July 10, 2026 15:51
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.

AI Resolve mode fails for conflicts without an active merge/rebase/cherry-pick

2 participants