From 7fccc16a54a0a388f6cf4701d4234fa55c1ceca8 Mon Sep 17 00:00:00 2001 From: asepharyana Date: Wed, 15 Jul 2026 00:24:49 +0700 Subject: [PATCH] refactor(engine, hive_mind): update terminology from 'agents' to 'drones' and enhance logging for clarity --- src/app/workflow/engine.rs | 16 ++++++++++------ src/app/workflow/hive_mind.rs | 4 ++++ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/app/workflow/engine.rs b/src/app/workflow/engine.rs index 0d0f17d..23222cb 100644 --- a/src/app/workflow/engine.rs +++ b/src/app/workflow/engine.rs @@ -148,7 +148,7 @@ fn spawn_single_agent( String::new() } else { format!( - "\n\nFindings from sibling agents in this workflow run:\n{}", + "\n\nFindings from sibling drones in this Hive run:\n{}", findings_snapshot .iter() .enumerate() @@ -394,14 +394,17 @@ pub fn execute_primitive( } let resolved = resolve_template(prompt, &resolved_args); let agent_id = uuid::Uuid::new_v4().to_string(); - let agent_name = format!("{node_id}: {}", resolved.chars().take(30).collect::()); + let truncated = resolved.chars().take(30).collect::(); + 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); 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) => { - // 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 - // the whole parallel cohort completes. Any sibling node - // still running (via read_findings) or any node spawned + // the whole parallel cohort completes. Any sibling drone + // still running (via read_findings) or any drone spawned // afterward sees this immediately, making the collective // state genuinely continuous rather than batch-synced. if let Ok(mut f) = findings.lock() { @@ -410,8 +413,9 @@ pub fn execute_primitive( Ok(vec![text]) } Err(e) => { + tracing::warn!("[hive] drone {node_id} failed: {e}"); if continue_on_error { - Ok(vec![format!("agent error: {}", e)]) + Ok(vec![format!("drone error: {}", e)]) } else { Err(e) } diff --git a/src/app/workflow/hive_mind.rs b/src/app/workflow/hive_mind.rs index 3b45502..0dc7675 100644 --- a/src/app/workflow/hive_mind.rs +++ b/src/app/workflow/hive_mind.rs @@ -169,6 +169,8 @@ pub fn run_hive_mind( 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 = (0..directives.len()) .map(|i| format!("Node-{cycle_index}-{i}")) .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( user_request, session_dir, workspaces, &collective_state, live.as_ref(), abort_flag, node_timeout_ms, );