fix(missions): give each phase its own task and its own capture base
ci / gates (push) Failing after 5s
ci / rust (push) Skipped
ci / frontend (push) Skipped
ci / e2e (push) Skipped
ci / publish (push) Skipped

The first push run against a scratch repo (mission 019fc42b) delivered
two branches correctly but exposed two bugs behind them.

Per-phase instructions were inert. `phase_task_text` took only
(kind, title, description), so `mission_phases.config.task` was accepted
by the API, stored, and read by nothing. Every phase of a mission
received byte-identical text differing only by the kind directive —
so both coding phases did the whole mission instead of their slice,
producing the same two files. The task now reaches the agent as a
trailing THIS PHASE'S TASK block, scoped against the shared brief.

The capture base never advanced. `.git/clawmates-base` is written once
at clone time, so phase two diffed against the original clone point and
reported the union of both phases' files as its own. It now moves to
each phase's committed head after the patch is on disk; the pushed
branch stays cumulative because it is built from HEAD.

Both regression tests were confirmed to fail with their fix disabled.

Co-Authored-By: Claude Opus 5 <[email protected]>
This commit is contained in:
Omar Sobh
2026-08-02 13:39:40 -07:00
co-authored by Claude Opus 5
parent e2871c4361
commit 8bad869248
4 changed files with 163 additions and 4 deletions
+8
View File
@@ -247,6 +247,14 @@ pub async fn capture_phase_diff_at(
}
};
// Hand the next phase a base that excludes this one's work. Done here
// rather than inside `commit_phase_work` so the patch on disk is already
// written: if the process dies between the two, the worst case is a phase
// that re-reports work, not a phase whose work is invisible.
if let Some(c) = committed.as_ref() {
mission_workspace::advance_base_commit(&repo, &c.sha);
}
// Gate, then publish. Both are best-effort on top of an artifact that has
// already landed: a phase whose tests fail, or whose push is rejected,
// still has its patch on disk and its work on a local branch.