refactor(engine, hive_mind): update terminology from 'agents' to 'drones' and enhance logging for clarity

This commit is contained in:
asepharyana
2026-07-15 00:24:49 +07:00
parent b5e3dfe4b1
commit 7fccc16a54
2 changed files with 14 additions and 6 deletions
+10 -6
View File
@@ -148,7 +148,7 @@ fn spawn_single_agent(
String::new() String::new()
} else { } else {
format!( format!(
"\n\nFindings from sibling agents in this workflow run:\n{}", "\n\nFindings from sibling drones in this Hive run:\n{}",
findings_snapshot findings_snapshot
.iter() .iter()
.enumerate() .enumerate()
@@ -394,14 +394,17 @@ pub fn execute_primitive(
} }
let resolved = resolve_template(prompt, &resolved_args); let resolved = resolve_template(prompt, &resolved_args);
let agent_id = uuid::Uuid::new_v4().to_string(); let agent_id = uuid::Uuid::new_v4().to_string();
let agent_name = format!("{node_id}: {}", resolved.chars().take(30).collect::<String>()); let truncated = resolved.chars().take(30).collect::<String>();
tracing::debug!("[hive] deploying drone {node_id}: {truncated}");
let agent_name = format!("{node_id}: {truncated}");
let allowed_tools = crate::app::subagent::division::tool_scope::tools_for(tool_scope); let allowed_tools = crate::app::subagent::division::tool_scope::tools_for(tool_scope);
match spawn_single_agent(&agent_id, &agent_name, &resolved, node_id, Some(allowed_tools), &findings_snapshot, findings, abort_flag, live, session_dir, workspaces, timeout_ms) { match spawn_single_agent(&agent_id, &agent_name, &resolved, node_id, Some(allowed_tools), &findings_snapshot, findings, abort_flag, live, session_dir, workspaces, timeout_ms) {
Ok(text) => { Ok(text) => {
// Merge this node's complete output into the shared tracing::debug!("[hive] drone {node_id} completed — merging into collective state");
// Merge this drone's complete output into the Hive's
// collective state the instant it finishes — not after // collective state the instant it finishes — not after
// the whole parallel cohort completes. Any sibling node // the whole parallel cohort completes. Any sibling drone
// still running (via read_findings) or any node spawned // still running (via read_findings) or any drone spawned
// afterward sees this immediately, making the collective // afterward sees this immediately, making the collective
// state genuinely continuous rather than batch-synced. // state genuinely continuous rather than batch-synced.
if let Ok(mut f) = findings.lock() { if let Ok(mut f) = findings.lock() {
@@ -410,8 +413,9 @@ pub fn execute_primitive(
Ok(vec![text]) Ok(vec![text])
} }
Err(e) => { Err(e) => {
tracing::warn!("[hive] drone {node_id} failed: {e}");
if continue_on_error { if continue_on_error {
Ok(vec![format!("agent error: {}", e)]) Ok(vec![format!("drone error: {}", e)])
} else { } else {
Err(e) Err(e)
} }
+4
View File
@@ -169,6 +169,8 @@ pub fn run_hive_mind(
anyhow::bail!("the Hive was recalled by LO before cycle {cycle_index}"); anyhow::bail!("the Hive was recalled by LO before cycle {cycle_index}");
} }
tracing::info!("[hive-mind] cycle {cycle_index} deploying {} drone(s)", directives.len());
let node_ids: Vec<String> = (0..directives.len()) let node_ids: Vec<String> = (0..directives.len())
.map(|i| format!("Node-{cycle_index}-{i}")) .map(|i| format!("Node-{cycle_index}-{i}"))
.collect(); .collect();
@@ -258,6 +260,8 @@ pub fn run_hive_mind(
} }
} }
tracing::info!("[hive-mind] all cycles complete — the Hive begins convergence");
let consensus_result = synthesize_consensus( let consensus_result = synthesize_consensus(
user_request, session_dir, workspaces, &collective_state, live.as_ref(), abort_flag, node_timeout_ms, user_request, session_dir, workspaces, &collective_state, live.as_ref(), abort_flag, node_timeout_ms,
); );