huskies: merge 539_bug_crdt_event_bridge_still_writes_filesystem_shadow_files_after_530_eliminated_filesystem_state

This commit is contained in:
dave
2026-04-11 17:04:36 +00:00
parent 6998275331
commit 599fbdc71d
9 changed files with 153 additions and 190 deletions
@@ -139,27 +139,15 @@ impl AgentPool {
);
let empty_diff_reason = "Feature branch has no code changes — the coder agent \
did not produce any commits.";
// Write merge_failure and blocked to content store.
if let Some(contents) = crate::db::read_content(story_id) {
let updated = crate::io::story_metadata::write_merge_failure_in_content(
&contents,
empty_diff_reason,
);
let blocked = crate::io::story_metadata::write_blocked_in_content(&updated);
crate::db::write_content(story_id, &blocked);
crate::db::write_item_with_content(story_id, stage_dir, &blocked);
} else {
// Fallback: filesystem.
let story_path = project_root
.join(".huskies/work")
.join(stage_dir)
.join(format!("{story_id}.md"));
let _ = crate::io::story_metadata::write_merge_failure(
&story_path,
empty_diff_reason,
);
let _ = crate::io::story_metadata::write_blocked(&story_path);
}
// Write merge_failure and blocked to content store + CRDT.
let contents = crate::db::read_content(story_id)
.unwrap_or_else(|| "---\nname: unknown\n---\n".to_string());
let updated = crate::io::story_metadata::write_merge_failure_in_content(
&contents,
empty_diff_reason,
);
let blocked = crate::io::story_metadata::write_blocked_in_content(&updated);
crate::db::write_item_with_content(story_id, stage_dir, &blocked);
let _ = self.watcher_tx.send(crate::io::watcher::WatcherEvent::StoryBlocked {
story_id: story_id.to_string(),
reason: empty_diff_reason.to_string(),
+16 -25
View File
@@ -209,15 +209,10 @@ impl AgentPool {
message: format!("Failed to advance to QA: {e}"),
});
} else {
let story_path = project_root
.join(".huskies/work/3_qa")
.join(format!("{story_id}.md"));
if let Err(e) =
crate::io::story_metadata::write_review_hold(&story_path)
{
eprintln!(
"[startup:reconcile] Failed to set review_hold on '{story_id}': {e}"
);
// Set review_hold in the content store + CRDT.
if let Some(contents) = crate::db::read_content(story_id) {
let updated = crate::io::story_metadata::write_review_hold_in_content(&contents);
crate::db::write_item_with_content(story_id, "3_qa", &updated);
}
eprintln!("[startup:reconcile] Moved '{story_id}' → 3_qa/ (qa: human — holding for review).");
let _ = progress_tx.send(ReconciliationEvent {
@@ -267,29 +262,25 @@ impl AgentPool {
if item_type == "spike" {
true
} else {
let story_path = project_root
.join(".huskies/work/3_qa")
.join(format!("{story_id}.md"));
let default_qa = crate::config::ProjectConfig::load(project_root)
.unwrap_or_default()
.default_qa_mode();
matches!(
crate::io::story_metadata::resolve_qa_mode(&story_path, default_qa),
crate::io::story_metadata::QaMode::Human
)
if let Some(contents) = crate::db::read_content(story_id) {
matches!(
crate::io::story_metadata::resolve_qa_mode_from_content(&contents, default_qa),
crate::io::story_metadata::QaMode::Human
)
} else {
matches!(default_qa, crate::io::story_metadata::QaMode::Human)
}
}
};
if needs_human_review {
let story_path = project_root
.join(".huskies/work/3_qa")
.join(format!("{story_id}.md"));
if let Err(e) =
crate::io::story_metadata::write_review_hold(&story_path)
{
eprintln!(
"[startup:reconcile] Failed to set review_hold on '{story_id}': {e}"
);
// Set review_hold in the content store + CRDT.
if let Some(contents) = crate::db::read_content(story_id) {
let updated = crate::io::story_metadata::write_review_hold_in_content(&contents);
crate::db::write_item_with_content(story_id, "3_qa", &updated);
}
eprintln!(
"[startup:reconcile] '{story_id}' passed QA — holding for human review."