diff --git a/hive-ag3nt/src/bin/hive-ag3nt.rs b/hive-ag3nt/src/bin/hive-ag3nt.rs index 2a8d8d8..65dd0a1 100644 --- a/hive-ag3nt/src/bin/hive-ag3nt.rs +++ b/hive-ag3nt/src/bin/hive-ag3nt.rs @@ -165,6 +165,15 @@ async fn serve( let outcome = turn::drive_turn(&prompt, files, &bus).await; turn::emit_turn_end(&bus, &outcome); bus.set_state(TurnState::Idle); + + // After turn completes, check if there are pending messages waiting. + // If so, immediately process them instead of blocking on recv(). + // This ensures messages queued during the turn are processed ASAP. + let pending = inbox_unread(socket).await; + if pending > 0 { + tracing::info!(%pending, "pending messages after turn; fetching next"); + continue; // Loop back to recv() immediately instead of sleeping + } } Ok(AgentResponse::Empty) => { // Idle: brief sleep before next poll to avoid busy-looping