huskies: merge 981
This commit is contained in:
@@ -131,6 +131,78 @@ impl AgentPool {
|
||||
);
|
||||
}
|
||||
}
|
||||
} else if crate::db::read_content(crate::db::ContentKey::MergeFixupPending(
|
||||
story_id,
|
||||
))
|
||||
.is_some()
|
||||
{
|
||||
// Merge gate fixup coder completed (story 981).
|
||||
// Route back to merge on success, or to MergeFailure on failure.
|
||||
// Neither path counts against retry_count (AC4).
|
||||
crate::db::delete_content(crate::db::ContentKey::MergeFixupPending(story_id));
|
||||
crate::db::delete_content(crate::db::ContentKey::CommitRecoveryPending(
|
||||
story_id,
|
||||
));
|
||||
// The FixupRequested transition set retry_count=1 so the gate output
|
||||
// was injected into the spawn. Reset to 0 now so the fixup does not
|
||||
// consume a retry slot (AC4).
|
||||
crate::crdt_state::set_retry_count(story_id, 0);
|
||||
|
||||
if completion.gates_passed {
|
||||
slog!(
|
||||
"[pipeline] Merge fixup coder '{agent_name}' passed gates for \
|
||||
'{story_id}'. Re-triggering merge."
|
||||
);
|
||||
if let Err(e) = crate::agents::lifecycle::move_story_to_merge(story_id) {
|
||||
slog_error!(
|
||||
"[pipeline] Failed to move '{story_id}' to 4_merge/ after \
|
||||
fixup: {e}"
|
||||
);
|
||||
} else {
|
||||
self.trigger_server_side_merge(&project_root, story_id);
|
||||
}
|
||||
} else {
|
||||
slog!(
|
||||
"[pipeline] Merge fixup coder '{agent_name}' failed gates for \
|
||||
'{story_id}'. Transitioning back to MergeFailure."
|
||||
);
|
||||
// Two-step: Coding → Merge → MergeFailure.
|
||||
// feature_branch follows the project convention; commits_ahead=1
|
||||
// is a safe approximation (the actual count doesn't matter here —
|
||||
// it is only used to reconstruct Merge via Unblock if a human
|
||||
// later retries).
|
||||
let branch =
|
||||
crate::pipeline_state::BranchName(format!("feature/story-{story_id}"));
|
||||
let commits_ahead = std::num::NonZeroU32::new(1).unwrap();
|
||||
let qa_skip = crate::pipeline_state::PipelineEvent::QaSkipped {
|
||||
feature_branch: branch,
|
||||
commits_ahead,
|
||||
};
|
||||
if let Err(e) =
|
||||
crate::pipeline_state::apply_transition_str(story_id, qa_skip, None)
|
||||
{
|
||||
slog_error!(
|
||||
"[pipeline] Failed to move '{story_id}' Coding→Merge for \
|
||||
fixup failure: {e}"
|
||||
);
|
||||
}
|
||||
let reason = format!(
|
||||
"Merge fixup coder could not resolve gate failures: {}",
|
||||
truncate_gate_output(&completion.gate_output)
|
||||
);
|
||||
if let Err(e) =
|
||||
crate::agents::lifecycle::transition_to_merge_failure(story_id, &reason)
|
||||
{
|
||||
slog_error!(
|
||||
"[pipeline] Failed to transition '{story_id}' to MergeFailure \
|
||||
after fixup failure: {e}"
|
||||
);
|
||||
}
|
||||
let _ = self.watcher_tx.send(WatcherEvent::MergeFailure {
|
||||
story_id: story_id.to_string(),
|
||||
reason,
|
||||
});
|
||||
}
|
||||
} else if completion.gates_passed {
|
||||
// Clear any stale recovery key when the coder succeeds normally.
|
||||
crate::db::delete_content(crate::db::ContentKey::CommitRecoveryPending(
|
||||
|
||||
Reference in New Issue
Block a user