huskies: merge 961
This commit is contained in:
@@ -78,10 +78,15 @@ impl AgentPool {
|
||||
// The coder exited with uncommitted content but no commits.
|
||||
// Check if this is already a second recovery attempt (the
|
||||
// first recovery respawn also produced no commits).
|
||||
let recovery_key = format!("{story_id}:commit_recovery_pending");
|
||||
if crate::db::read_content(&recovery_key).is_some() {
|
||||
if crate::db::read_content(crate::db::ContentKey::CommitRecoveryPending(
|
||||
story_id,
|
||||
))
|
||||
.is_some()
|
||||
{
|
||||
// Second attempt still produced no commits → block.
|
||||
crate::db::delete_content(&recovery_key);
|
||||
crate::db::delete_content(crate::db::ContentKey::CommitRecoveryPending(
|
||||
story_id,
|
||||
));
|
||||
slog!(
|
||||
"[pipeline] Coder '{agent_name}' (commit-recovery respawn) \
|
||||
still produced no commits for '{story_id}'. Blocking story."
|
||||
@@ -99,7 +104,10 @@ impl AgentPool {
|
||||
} else {
|
||||
// First occurrence: issue a commit-only recovery respawn.
|
||||
// This does NOT consume a retry_count slot.
|
||||
crate::db::write_content(&recovery_key, "1");
|
||||
crate::db::write_content(
|
||||
crate::db::ContentKey::CommitRecoveryPending(story_id),
|
||||
"1",
|
||||
);
|
||||
slog!(
|
||||
"[pipeline] Coder '{agent_name}' exited with uncommitted work \
|
||||
for '{story_id}'. Issuing commit-only recovery respawn."
|
||||
@@ -125,7 +133,9 @@ impl AgentPool {
|
||||
}
|
||||
} else if completion.gates_passed {
|
||||
// Clear any stale recovery key when the coder succeeds normally.
|
||||
crate::db::delete_content(&format!("{story_id}:commit_recovery_pending"));
|
||||
crate::db::delete_content(crate::db::ContentKey::CommitRecoveryPending(
|
||||
story_id,
|
||||
));
|
||||
// Determine effective QA mode for this story.
|
||||
let qa_mode = {
|
||||
let item_type = crate::agents::lifecycle::item_type_from_id(story_id);
|
||||
@@ -183,7 +193,9 @@ impl AgentPool {
|
||||
} else {
|
||||
// Clear any stale recovery key when gates fail normally (agent committed
|
||||
// but the build is broken — treat as a standard retry, not a recovery).
|
||||
crate::db::delete_content(&format!("{story_id}:commit_recovery_pending"));
|
||||
crate::db::delete_content(crate::db::ContentKey::CommitRecoveryPending(
|
||||
story_id,
|
||||
));
|
||||
// Bug 645 / 668: Before retry/block, check if the agent left committed
|
||||
// work AND the agent had a passing run_tests result captured during its
|
||||
// session. An agent may crash mid-output (e.g. Claude Code CLI PTY write
|
||||
@@ -195,8 +207,9 @@ impl AgentPool {
|
||||
// whenever script/test exits 0 inside a story worktree. Consume the
|
||||
// evidence here so it does not persist to the next agent session.
|
||||
let has_test_evidence =
|
||||
crate::db::read_content(&format!("{story_id}:run_tests_ok")).is_some();
|
||||
crate::db::delete_content(&format!("{story_id}:run_tests_ok"));
|
||||
crate::db::read_content(crate::db::ContentKey::RunTestsOk(story_id))
|
||||
.is_some();
|
||||
crate::db::delete_content(crate::db::ContentKey::RunTestsOk(story_id));
|
||||
let work_survived = has_test_evidence
|
||||
&& worktree_path.as_ref().is_some_and(|wt_path| {
|
||||
crate::agents::gates::worktree_has_committed_work(wt_path)
|
||||
@@ -258,7 +271,7 @@ impl AgentPool {
|
||||
// Persist gate_output so the retry spawn can inject it into
|
||||
// --append-system-prompt (story 881).
|
||||
crate::db::write_content(
|
||||
&format!("{story_id}:gate_output"),
|
||||
crate::db::ContentKey::GateOutput(story_id),
|
||||
&completion.gate_output,
|
||||
);
|
||||
// Increment retry count and check if blocked.
|
||||
@@ -384,7 +397,7 @@ impl AgentPool {
|
||||
// Persist gate_output so the retry spawn can inject it into
|
||||
// --append-system-prompt (story 881).
|
||||
crate::db::write_content(
|
||||
&format!("{story_id}:gate_output"),
|
||||
crate::db::ContentKey::GateOutput(story_id),
|
||||
&completion.gate_output,
|
||||
);
|
||||
if let Some(reason) = should_block_story(story_id, config.max_retries, "qa") {
|
||||
|
||||
Reference in New Issue
Block a user