Meta
type: DesignDecision
stage: draft
maturity: L1
created: 2026-05-10
inputs:
- "Luis85/specorator specs/specorator-agent-orchestrator/design.md — open question #2"
related: ["#43", "#47"]
Purpose. Choose between cherry-pick and git merge --no-ff as the post-success worktree integration strategy.
Context
Open question #2 from the SAO design doc. After an agent run succeeds (all sensors pass), the worktree changes must be integrated into the main branch. The strategy affects conflict probability, history legibility, and concurrent-run safety.
Options
Option A — git merge --no-ff
Merge the full worktree branch into main. All commits from the agent run are preserved.
- Pro: clean, merge-commit history; all agent reasoning commits retained; conceptually simple
- Pro: safest when worktrees are branched from HEAD at creation time and runs complete quickly
- Con: if another feature's run merged while this one was in progress, drift increases conflict probability
Option B — git cherry-pick
Cherry-pick only the specific commit(s) produced by the agent run.
- Pro: surgical; only the relevant change is integrated
- Con: cherry-pick conflicts are harder to resolve than merge conflicts; loses merge-commit lineage
- Con: the agent may produce multiple commits; determining which to cherry-pick adds complexity
Option C — git merge --squash + single commit
Squash all worktree commits into a single commit with a structured message.
- Pro: clean linear history; easy to bisect
- Con: loses intermediate agent reasoning commits; harder to audit what the agent did step-by-step
Factors specific to SAO
- Concurrent runs: multiple features may be running simultaneously. The higher the concurrency, the higher the drift probability, favouring cherry-pick.
- Worktree creation strategy: worktrees are created from HEAD at claim time. If a run takes 10–30 minutes, HEAD may have advanced.
- Conflict resolution: who resolves conflicts — the SAO (automated), or a human? Automated conflict resolution is a significant scope increase.
- History auditability: preserving agent commits aids post-hoc review; squash discards them.
Recommendation
Option A (--no-ff) for V1, with a worktree-refresh step before merge:
- Before merging, fetch and rebase the worktree onto latest HEAD (or fail fast with a conflict signal)
- Merge with
--no-ff
- On conflict: transition to
released with MERGE_CONFLICT reason; surface for human resolution
This avoids the complexity of cherry-pick while maintaining conflict safety.
Acceptance
Meta
Context
Open question #2 from the SAO design doc. After an agent run succeeds (all sensors pass), the worktree changes must be integrated into the main branch. The strategy affects conflict probability, history legibility, and concurrent-run safety.
Options
Option A —
git merge --no-ffMerge the full worktree branch into main. All commits from the agent run are preserved.
Option B —
git cherry-pickCherry-pick only the specific commit(s) produced by the agent run.
Option C —
git merge --squash+ single commitSquash all worktree commits into a single commit with a structured message.
Factors specific to SAO
Recommendation
Option A (
--no-ff) for V1, with aworktree-refreshstep before merge:--no-ffreleasedwithMERGE_CONFLICTreason; surface for human resolutionThis avoids the complexity of cherry-pick while maintaining conflict safety.
Acceptance
after_runhook updated to reflect merge stepMERGE_CONFLICTreason code added toreleasedstate taxonomy if applicable