diff --git a/hive-ag3nt/src/bin/hive-ag3nt.rs b/hive-ag3nt/src/bin/hive-ag3nt.rs index 23f3c9b..2a8d8d8 100644 --- a/hive-ag3nt/src/bin/hive-ag3nt.rs +++ b/hive-ag3nt/src/bin/hive-ag3nt.rs @@ -166,7 +166,13 @@ async fn serve( turn::emit_turn_end(&bus, &outcome); bus.set_state(TurnState::Idle); } - Ok(AgentResponse::Empty) => {} + Ok(AgentResponse::Empty) => { + // Idle: brief sleep before next poll to avoid busy-looping + // on consecutive Empty responses. The recv() call already + // waits up to 180s for messages, so this is just for + // responsiveness if recv() times out. + tokio::time::sleep(interval).await; + } Ok(AgentResponse::Ok | AgentResponse::Status { .. } | AgentResponse::Recent { .. } @@ -180,7 +186,6 @@ async fn serve( tracing::warn!(error = ?e, "recv failed; retrying"); } } - tokio::time::sleep(interval).await; } }