Problem
When multiple agents (builders, tester, issue fixer) push to main while feature branches are active, merge_milestone_to_main() fails on merge conflicts that are almost always trivially resolvable — both sides added different code to the same file region (e.g., new DI registrations in Program.cs, new test methods in the same test class).
The current recovery is: abort merge → try rebase once → retry same merge 5 times → give up → unclaim story → re-plan from scratch → rebuild entire milestone. This wastes multiple Copilot premium requests per failure.
Observed in the stretto test run (20260226-143251):
- Builder-2 failed on
GlobalExceptionHandlerMiddleware.cs + AuthService.cs (issue fixer modified on main)
- Builder-1 failed twice — first on
Program.cs (issue fixer), then on AuthControllerTests.cs (tester pushed new tests to main)
Proposed Solution
After git merge --no-ff fails with conflicts, instead of aborting immediately, invoke Copilot CLI to resolve the conflict markers in-place:
- Leave the conflicted working tree as-is (conflict markers in files)
- Identify conflicted files via
git diff --name-only --diff-filter=U
- Invoke a short Copilot session with a prompt like: "These files have git merge conflict markers. Resolve each by keeping BOTH sides — both branches are adding code. Remove the markers,
git add each file."
- If Copilot succeeds and all conflicts are resolved, complete the merge commit
- If Copilot fails or conflicts remain, fall back to the existing abort-and-retry behavior
Why This Works
- The conflicts are overwhelmingly additive — both branches added different things to the same region
- LLMs handle "combine these two additions" trivially — much easier than writing the code originally
- The conflict markers provide perfect context about both sides' intent
- Cost: 1 premium request per resolution vs. N requests to rebuild an entire milestone from scratch
Implementation Location
merge_milestone_to_main() in src/buildteam/git_helpers.py (lines ~215-245) — after the merge conflict is detected, before git merge --abort.
Considerations
- Should attempt resolution only on the first conflict (before the rebase attempt), or after rebase also fails
- Need to verify no conflict markers remain after Copilot runs (
grep -r "<<<<<<" .)
- Should log the resolution as a distinct step for diagnostics
- The Copilot session needs access to
run_copilot_session or equivalent from utils.py
Migrated from markgar/multi-agent-dev#7
Problem
When multiple agents (builders, tester, issue fixer) push to main while feature branches are active,
merge_milestone_to_main()fails on merge conflicts that are almost always trivially resolvable — both sides added different code to the same file region (e.g., new DI registrations inProgram.cs, new test methods in the same test class).The current recovery is: abort merge → try rebase once → retry same merge 5 times → give up → unclaim story → re-plan from scratch → rebuild entire milestone. This wastes multiple Copilot premium requests per failure.
Observed in the stretto test run (20260226-143251):
GlobalExceptionHandlerMiddleware.cs+AuthService.cs(issue fixer modified on main)Program.cs(issue fixer), then onAuthControllerTests.cs(tester pushed new tests to main)Proposed Solution
After
git merge --no-fffails with conflicts, instead of aborting immediately, invoke Copilot CLI to resolve the conflict markers in-place:git diff --name-only --diff-filter=Ugit addeach file."Why This Works
Implementation Location
merge_milestone_to_main()insrc/buildteam/git_helpers.py(lines ~215-245) — after the merge conflict is detected, beforegit merge --abort.Considerations
grep -r "<<<<<<" .)run_copilot_sessionor equivalent fromutils.pyMigrated from markgar/multi-agent-dev#7