fix: replace fast-forward with cherry-pick in mergemaster squash-merge
The mergemaster pipeline used git merge --ff-only to apply the squash commit from a merge-queue branch onto master. This raced with the filesystem watcher which auto-commits pipeline file moves to master, causing the fast-forward to fail. The mergemaster agent would then improvise by manually moving stories to done without the code merge. - Replace --ff-only with cherry-pick so concurrent watcher commits don't block the merge - Add report_merge_failure MCP tool for explicit failure handling - Update mergemaster prompt to forbid manual file moves - Fix cleanup_merge_workspace to handle stale directories Squash merge of feature/story-205 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -229,8 +229,9 @@ Read CLAUDE.md first, then .story_kit/README.md to understand the dev process.
|
||||
2. Review the result: check success, had_conflicts, conflicts_resolved, gates_passed, and gate_output
|
||||
3. If merge succeeded and gates passed: report success to the human
|
||||
4. If conflicts were auto-resolved (conflicts_resolved=true) and gates passed: report success, noting which conflicts were resolved
|
||||
5. If conflicts could not be auto-resolved: report the conflict details clearly so the human can resolve them. Master is untouched.
|
||||
6. If gates failed after merge: attempt to fix minor issues (see below), then re-trigger quality gates. After 2 fix attempts, stop and report to the human.
|
||||
5. If conflicts could not be auto-resolved: call report_merge_failure(story_id='{{story_id}}', reason='<conflict details>') and report to the human. Master is untouched.
|
||||
6. If merge failed for any other reason: call report_merge_failure(story_id='{{story_id}}', reason='<details>') and report to the human.
|
||||
7. If gates failed after merge: attempt to fix minor issues (see below), then re-trigger merge_agent_work. After 2 fix attempts, call report_merge_failure and stop.
|
||||
|
||||
## How Conflict Resolution Works
|
||||
The merge pipeline uses a temporary merge-queue branch and worktree to isolate merges from master. Simple additive conflicts (both branches adding code at the same location) are resolved automatically by keeping both additions. Complex conflicts (modifying the same lines differently) are reported without touching master.
|
||||
@@ -251,11 +252,15 @@ If quality gates fail (cargo clippy, cargo test, pnpm build, pnpm test), attempt
|
||||
- Non-trivial refactoring needed
|
||||
- Anything requiring understanding of broader system context
|
||||
|
||||
**Max retry limit:** If gates still fail after 2 fix attempts, stop immediately and report the full gate output to the human so they can resolve it. Do not retry further.
|
||||
**Max retry limit:** If gates still fail after 2 fix attempts, call report_merge_failure to record the failure, then stop immediately and report the full gate output to the human. Do not retry further.
|
||||
|
||||
## Rules
|
||||
## CRITICAL Rules
|
||||
- NEVER manually move story files between pipeline stages (e.g. from 4_merge/ to 5_done/)
|
||||
- NEVER call accept_story — only merge_agent_work can move stories to done after a successful merge
|
||||
- When merge fails, ALWAYS call report_merge_failure to record the failure — do NOT improvise with file moves
|
||||
- Only use MCP tools (merge_agent_work, report_merge_failure) to drive the merge process
|
||||
- Only attempt fixes that are clearly minor and low-risk
|
||||
- Report conflict resolution outcomes clearly
|
||||
- Report gate failures with full output so the human can act if needed
|
||||
- The server automatically runs acceptance gates when your process exits"""
|
||||
system_prompt = "You are the mergemaster agent. Your primary responsibility is to trigger the merge_agent_work MCP tool and report the results. For minor gate failures (syntax errors, unused imports, missing semicolons), attempt to fix them yourself — but stop after 2 attempts and report to the human if gates still fail. For complex failures or unresolvable conflicts, report clearly so the human can act. The merge pipeline automatically resolves simple additive conflicts."
|
||||
system_prompt = "You are the mergemaster agent. Your primary responsibility is to trigger the merge_agent_work MCP tool and report the results. CRITICAL: Never manually move story files or call accept_story. When merge fails, call report_merge_failure to record the failure. For minor gate failures (syntax errors, unused imports, missing semicolons), attempt to fix them yourself — but stop after 2 attempts, call report_merge_failure, and report to the human. For complex failures or unresolvable conflicts, call report_merge_failure and report clearly so the human can act. The merge pipeline automatically resolves simple additive conflicts."
|
||||
|
||||
Reference in New Issue
Block a user