huskies: merge 738_refactor_delete_fs_shadow_code_from_lifecycle_rs_and_the_work_directory_watcher

This commit is contained in:
dave
2026-04-27 19:51:27 +00:00
parent 63a30a9319
commit 615e1c7f73
18 changed files with 105 additions and 883 deletions
@@ -64,8 +64,7 @@ impl AgentPool {
}
// All deps met — promote from backlog to current.
slog!("[auto-assign] Story '{story_id}' deps met; promoting from backlog to current.");
if let Err(e) = crate::agents::lifecycle::move_story_to_current(project_root, story_id)
{
if let Err(e) = crate::agents::lifecycle::move_story_to_current(story_id) {
slog!("[auto-assign] Failed to promote '{story_id}' to current: {e}");
}
}
@@ -168,7 +168,7 @@ impl AgentPool {
match qa_mode {
crate::io::story_metadata::QaMode::Server => {
if let Err(e) = crate::agents::move_story_to_merge(project_root, story_id) {
if let Err(e) = crate::agents::move_story_to_merge(story_id) {
eprintln!(
"[startup:reconcile] Failed to move '{story_id}' to 4_merge/: {e}"
);
@@ -189,7 +189,7 @@ impl AgentPool {
}
}
crate::io::story_metadata::QaMode::Agent => {
if let Err(e) = crate::agents::move_story_to_qa(project_root, story_id) {
if let Err(e) = crate::agents::move_story_to_qa(story_id) {
eprintln!(
"[startup:reconcile] Failed to move '{story_id}' to 3_qa/: {e}"
);
@@ -208,7 +208,7 @@ impl AgentPool {
}
}
crate::io::story_metadata::QaMode::Human => {
if let Err(e) = crate::agents::move_story_to_qa(project_root, story_id) {
if let Err(e) = crate::agents::move_story_to_qa(story_id) {
eprintln!(
"[startup:reconcile] Failed to move '{story_id}' to 3_qa/: {e}"
);
@@ -308,9 +308,7 @@ impl AgentPool {
status: "review_hold".to_string(),
message: "Passed QA — waiting for human review.".to_string(),
});
} else if let Err(e) =
crate::agents::move_story_to_merge(project_root, story_id)
{
} else if let Err(e) = crate::agents::move_story_to_merge(story_id) {
eprintln!(
"[startup:reconcile] Failed to move '{story_id}' to 4_merge/: {e}"
);
+14 -29
View File
@@ -71,10 +71,8 @@ impl AgentPool {
"[pipeline] Coder '{agent_name}' passed gates for '{story_id}'. \
qa: server — moving directly to merge."
);
if let Err(e) = crate::agents::lifecycle::move_story_to_merge(
&project_root,
story_id,
) {
if let Err(e) = crate::agents::lifecycle::move_story_to_merge(story_id)
{
slog_error!(
"[pipeline] Failed to move '{story_id}' to 4_merge/: {e}"
);
@@ -88,9 +86,7 @@ impl AgentPool {
"[pipeline] Coder '{agent_name}' passed gates for '{story_id}'. \
qa: agent — moving to QA."
);
if let Err(e) =
crate::agents::lifecycle::move_story_to_qa(&project_root, story_id)
{
if let Err(e) = crate::agents::lifecycle::move_story_to_qa(story_id) {
slog_error!("[pipeline] Failed to move '{story_id}' to 3_qa/: {e}");
} else if let Err(e) = self
.start_agent(&project_root, story_id, Some("qa"), None, None)
@@ -106,9 +102,7 @@ impl AgentPool {
"[pipeline] Coder '{agent_name}' passed gates for '{story_id}'. \
qa: human — holding for human review."
);
if let Err(e) =
crate::agents::lifecycle::move_story_to_qa(&project_root, story_id)
{
if let Err(e) = crate::agents::lifecycle::move_story_to_qa(story_id) {
slog_error!("[pipeline] Failed to move '{story_id}' to 3_qa/: {e}");
} else {
write_review_hold_to_store(story_id);
@@ -150,10 +144,9 @@ impl AgentPool {
};
match qa_mode {
crate::io::story_metadata::QaMode::Server => {
if let Err(e) = crate::agents::lifecycle::move_story_to_merge(
&project_root,
story_id,
) {
if let Err(e) =
crate::agents::lifecycle::move_story_to_merge(story_id)
{
slog_error!(
"[pipeline] Failed to move '{story_id}' to 4_merge/: {e}"
);
@@ -163,10 +156,8 @@ impl AgentPool {
}
}
crate::io::story_metadata::QaMode::Agent => {
if let Err(e) = crate::agents::lifecycle::move_story_to_qa(
&project_root,
story_id,
) {
if let Err(e) = crate::agents::lifecycle::move_story_to_qa(story_id)
{
slog_error!(
"[pipeline] Failed to move '{story_id}' to 3_qa/: {e}"
);
@@ -180,10 +171,8 @@ impl AgentPool {
}
}
crate::io::story_metadata::QaMode::Human => {
if let Err(e) = crate::agents::lifecycle::move_story_to_qa(
&project_root,
story_id,
) {
if let Err(e) = crate::agents::lifecycle::move_story_to_qa(story_id)
{
slog_error!(
"[pipeline] Failed to move '{story_id}' to 3_qa/: {e}"
);
@@ -277,10 +266,8 @@ impl AgentPool {
"[pipeline] QA passed gates and coverage for '{story_id}'. \
Moving directly to merge."
);
if let Err(e) = crate::agents::lifecycle::move_story_to_merge(
&project_root,
story_id,
) {
if let Err(e) = crate::agents::lifecycle::move_story_to_merge(story_id)
{
slog_error!(
"[pipeline] Failed to move '{story_id}' to 4_merge/: {e}"
);
@@ -391,9 +378,7 @@ impl AgentPool {
slog!(
"[pipeline] Post-merge tests passed for '{story_id}'. Moving to done."
);
if let Err(e) =
crate::agents::lifecycle::move_story_to_done(&project_root, story_id)
{
if let Err(e) = crate::agents::lifecycle::move_story_to_done(story_id) {
slog_error!("[pipeline] Failed to move '{story_id}' to done: {e}");
}
self.remove_agents_for_story(story_id);
@@ -57,7 +57,11 @@ async fn mergemaster_blocks_and_sends_story_blocked_when_no_commits_ahead() {
)
.unwrap();
crate::db::ensure_content_store();
crate::db::write_content("9919_story_no_commits", "---\nname: Test\n---\n");
crate::db::write_item_with_content(
"9919_story_no_commits",
"2_current",
"---\nname: Test\n---\n",
);
let pool = AgentPool::new_test(3001);
let mut rx = pool.watcher_tx.subscribe();
+1 -2
View File
@@ -155,8 +155,7 @@ impl AgentPool {
});
}
let story_archived =
crate::agents::lifecycle::move_story_to_done(project_root, story_id).is_ok();
let story_archived = crate::agents::lifecycle::move_story_to_done(story_id).is_ok();
if story_archived {
self.remove_agents_for_story(story_id);
}
+1 -1
View File
@@ -79,7 +79,7 @@ impl AgentPool {
.map(|s| s == PipelineStage::Coder)
.unwrap_or(true);
if starting_a_coder {
crate::agents::lifecycle::move_story_to_current(project_root, story_id)?;
crate::agents::lifecycle::move_story_to_current(story_id)?;
}
// Validate that the agent's configured stage matches the story's
+2 -2
View File
@@ -143,7 +143,7 @@ mod tests {
let story_content = "test";
fs::write(current.join("60_story_cleanup.md"), story_content).unwrap();
crate::db::ensure_content_store();
crate::db::write_content("60_story_cleanup", story_content);
crate::db::write_item_with_content("60_story_cleanup", "2_current", story_content);
let pool = AgentPool::new_test(3001);
pool.inject_test_agent("60_story_cleanup", "coder-1", AgentStatus::Completed);
@@ -152,7 +152,7 @@ mod tests {
assert_eq!(pool.list_agents().unwrap().len(), 3);
move_story_to_done(root, "60_story_cleanup").unwrap();
move_story_to_done("60_story_cleanup").unwrap();
pool.remove_agents_for_story("60_story_cleanup");
let remaining = pool.list_agents().unwrap();