fix(missions): give each phase its own task and its own capture base
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:
co-authored by
Claude Opus 5
parent
e2871c4361
commit
8bad869248
@@ -165,6 +165,31 @@ pub(crate) fn record_base_commit(path: &std::path::Path) {
|
||||
}
|
||||
}
|
||||
|
||||
/// Move the capture base forward to a commit a phase just produced.
|
||||
///
|
||||
/// The base is recorded once at clone time, which is right for the mission's
|
||||
/// first phase and wrong for every phase after it: a later phase would diff
|
||||
/// against the original clone point and claim its predecessors' commits as its
|
||||
/// own work. Mission `019fc42b` showed this plainly — two coding phases, and
|
||||
/// the second phase's artifact reported the *union* of both phases' files.
|
||||
///
|
||||
/// Advancing after each successful commit makes each artifact the incremental
|
||||
/// work of one phase. The pushed branch stays cumulative, because it is built
|
||||
/// from `HEAD` and therefore still carries the earlier commits.
|
||||
pub(crate) fn advance_base_commit(path: &std::path::Path, sha: &str) {
|
||||
let sha = sha.trim();
|
||||
if sha.is_empty() {
|
||||
return;
|
||||
}
|
||||
if let Err(e) = std::fs::write(path.join(".git/clawmates-base"), format!("{sha}\n")) {
|
||||
eprintln!(
|
||||
"mission_workspace: could not advance base commit for {} ({e}) — the next \
|
||||
phase will re-report this phase's work as its own",
|
||||
path.display()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// The commit this mission's checkout started from, if it was recorded.
|
||||
pub(crate) fn base_commit(path: &std::path::Path) -> Option<String> {
|
||||
std::fs::read_to_string(path.join(".git/clawmates-base"))
|
||||
|
||||
Reference in New Issue
Block a user