integration: Add AI-driven conflict resolution#1251
Open
ed-irl wants to merge 4 commits into
Open
Conversation
Collaborator
Author
This was referenced Jun 12, 2026
Open
bced906 to
8dfba8a
Compare
2744c7a to
b0ecc92
Compare
8dfba8a to
e08f418
Compare
b0ecc92 to
af57956
Compare
4b4fe32 to
40200ac
Compare
Adds an opt-in fallback that invokes a user-configured shell script
when an integration-rebuild merge conflicts. Rerere and the regenerate
merge driver already handle the mechanical conflicts; this is for
the residue.
The resolver follows a strict JSON protocol on stdout:
{"assumptions": [...], "questions": [...], "unresolved_files": [...]}
Empty (or assumptions-only) means "all resolved." Questions trigger
an interactive Q&A loop whose pairs persist to .integration_resolution.json
at the repo root. unresolved_files with no questions surfaces as an
error for manual investigation. Non-zero exit or invalid JSON falls
through to the existing conflict-surfacing path.
The resolution file accumulates Q&A across rebuilds so the user
doesn't re-answer for already-resolved (ours, theirs) pairs. Entries
are pruned when branches are untracked, deleted, or removed by sync.
Scoped exclusively to gs integration rebuild and the MaybeRebuild
hook on restack — no impact on branch_merge, restack, or any
user-visible merge. Blast radius: one throwaway branch.
Configured via spice.integration.resolver (script) and
spice.integration.autoResolve (default behavior); --auto-resolve /
--no-auto-resolve override per invocation. Iteration cap is 10 to
prevent runaway loops.
42fe375 to
2fe1405
Compare
2cd315d to
572934b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
integration: Add AI-driven conflict resolution
Adds an opt-in fallback that invokes a user-configured shell script
when an integration-rebuild merge conflicts. Rerere and the regenerate
merge driver already handle the mechanical conflicts; this is for
the residue.
The resolver follows a strict JSON protocol on stdout:
{"assumptions": [...], "questions": [...], "unresolved_files": [...]}
Empty (or assumptions-only) means "all resolved." Questions trigger
an interactive Q&A loop whose pairs persist to .integration_resolution.json
at the repo root. unresolved_files with no questions surfaces as an
error for manual investigation. Non-zero exit or invalid JSON falls
through to the existing conflict-surfacing path.
The resolution file accumulates Q&A across rebuilds so the user
doesn't re-answer for already-resolved (ours, theirs) pairs. Entries
are pruned when branches are untracked, deleted, or removed by sync.
Scoped exclusively to gs integration rebuild and the MaybeRebuild
hook on restack — no impact on branch_merge, restack, or any
user-visible merge. Blast radius: one throwaway branch.
Configured via spice.integration.resolver (script) and
spice.integration.autoResolve (default behavior); --auto-resolve /
--no-auto-resolve override per invocation. Iteration cap is 10 to
prevent runaway loops.
integration: AI-driven auto-resolve for merge conflicts
Adds an auto-resolve path for integration-rebuild merge conflicts.
When configured and enabled, git-spice invokes a user-supplied
script on every merge conflict and, if the script reports the
conflict resolved, stages the files and commits the merge without
intervention.
Shared with the rest of git-spice's script-driven features via the
protocol surface on ed-irl/scriptrun:
scriptrun.QAPair for resolution-file entries -- no duplicated
types.
this feature) / GS_BRANCH (the tip being merged) / GS_BASE (the
integration branch) env via scriptrun.EnvFor.
(default 10) via Handler.MaxResolveIterations, replacing the
previously private constant. main.go wires it through.
spicedir; the old .integration_resolution.json root-level path
is gone. Save() auto-creates the parent directory.
shared protocol, extra fields are ignored.
iteration cap, fall-through) are documented once in
doc/src/guide/scripts.md; doc/src/guide/integration.md is
trimmed to defer there and only documents integration-specific
UX (Claude Code recipe, the GS_OPERATION value, resolution-file
key layout).
CLI:
--no-auto-resolve, with the default coming from
spice.integration.autoResolve.
(script body).
Tests:
unresolved_no_questions scripts updated to use the new
.spice/resolutions/integration.json path.
learned to mkdir the resolution dir before seeding.
contract and the configurable iteration cap (via
spice.scriptResolve.maxIterations).