diff --git a/src/app/runtime/actions/mod.rs b/src/app/runtime/actions/mod.rs index cefbb20..53b5a12 100644 --- a/src/app/runtime/actions/mod.rs +++ b/src/app/runtime/actions/mod.rs @@ -1105,16 +1105,12 @@ fn run_agent_turn( }; match pipeline_result { - Ok((consensus, reports)) => { + Ok((consensus, _reports)) => { + // run_hive_mind already wrote docs/runs/*.md internally + // (guaranteed, even on synthesis failure) — nothing to do + // here besides feeding the consensus back to the LLM. tracing::info!("[hive-mind] convergence completed successfully"); - if let Some(workspace_root) = tc.workspace_roots.first() { - match crate::app::workflow::docs::write_hive_mind_convergence(workspace_root, user_request, &reports, &consensus) { - Ok(path) => tracing::info!("[hive-mind] convergence documented at {}", path.display()), - Err(e) => tracing::warn!("[hive-mind] failed to write docs/runs report: {e}"), - } - } - let pipeline_msg = ChatMessage::system(format!( "[Hive-Mind Consensus]\n{consensus}", )); diff --git a/src/tool/workflow.rs b/src/tool/workflow.rs index 2d5e642..503242d 100644 --- a/src/tool/workflow.rs +++ b/src/tool/workflow.rs @@ -219,21 +219,18 @@ impl Tool for HiveMind { json!({ "cycles": cycles_value }) ).map_err(|e| anyhow!("failed to parse cycles: {e}"))?; - let (consensus, reports) = crate::app::workflow::hive_mind::run_hive_mind( + // run_hive_mind now writes the docs/runs/*.md convergence report + // itself (guaranteed, even if synthesis fails) — do not write it + // again here. + let (consensus, _reports) = crate::app::workflow::hive_mind::run_hive_mind( request, &plan, &ctx.session_dir, &ctx.workspaces, ctx.turn_events.as_ref(), - None, + ctx.abort_flag.as_ref(), )?; - if let Some(workspace_root) = ctx.workspaces.first() { - if let Err(e) = crate::app::workflow::docs::write_hive_mind_convergence(workspace_root, request, &reports, &consensus) { - tracing::warn!("[hive_mind] failed to write docs/runs report: {e}"); - } - } - Ok(consensus) } }