diff --git a/hive-ag3nt/src/bin/hive.rs b/hive-ag3nt/src/bin/hive.rs index da7bfff7..37cf3864 100644 --- a/hive-ag3nt/src/bin/hive.rs +++ b/hive-ag3nt/src/bin/hive.rs @@ -8,7 +8,6 @@ use std::path::{Path, PathBuf}; use std::sync::{Arc, Mutex}; use std::time::Duration; -use hive_ag3nt::web_ui::TurnLock; use anyhow::Result; use clap::{Parser, Subcommand}; @@ -429,7 +428,6 @@ async fn serve_main(socket: &Path, poll_ms: u64) -> Result<()> { } } let files = turn::TurnFiles::prepare(socket, &label).await?; - let turn_lock: TurnLock = Arc::new(tokio::sync::Mutex::new(())); // Plugin install failures come back as a Vec — route each // through `` via the `send_to_parent` failure-notify path. // The broker resolves `` per `topology::parent_of`; @@ -477,7 +475,6 @@ async fn serve_main(socket: &Path, poll_ms: u64) -> Result<()> { bus, stats, &files, - turn_lock, ) .await } @@ -499,7 +496,6 @@ async fn serve_loop( bus: Bus, stats: Option, files: &turn::TurnFiles, - turn_lock: TurnLock, ) -> Result<()> { tracing::info!(socket = %socket.display(), "harness serve"); S::requeue_inflight(socket).await; @@ -520,10 +516,7 @@ async fn serve_loop( // Idle: no message this poll. Service a queued operator // `/compact` here so it runs even when no turn is driving // (the in-flight case is handled at the end of drive_turn). - let compacted = { - let _guard = turn_lock.lock().await; - turn::run_pending_compact(files, &bus, &session).await - }; + let compacted = turn::run_pending_compact(files, &bus, &session).await; if !compacted { tokio::time::sleep(interval).await; } @@ -547,7 +540,6 @@ async fn serve_loop( &bus, stats.as_ref(), files, - &turn_lock, &session, graceful_stop_message(), ) @@ -558,7 +550,7 @@ async fn serve_loop( }, }; let ctrl = - handle_turn::(socket, &bus, stats.as_ref(), files, &turn_lock, &session, next).await; + handle_turn::(socket, &bus, stats.as_ref(), files, &session, next).await; if ctrl.auth_failed { *login_state.lock().unwrap() = LoginState::NeedsLogin; login::wait_for_login( @@ -586,7 +578,6 @@ async fn handle_turn( bus: &Bus, stats: Option<&TurnStats>, files: &turn::TurnFiles, - turn_lock: &TurnLock, session: &turn::AgentSession, first: hive_sh4re::DeliveredMessage, ) -> TurnControl { @@ -607,10 +598,7 @@ async fn handle_turn( let started_instant = std::time::Instant::now(); let model_at_start = bus.model(); let prompt = serve_common::format_wake_prompt(msg_id, &from, &body, unread, redelivered); - let outcome = { - let _guard = turn_lock.lock().await; - turn::drive_turn(&prompt, files, bus, session).await - }; + let outcome = turn::drive_turn(&prompt, files, bus, session).await; turn::emit_turn_end(bus, &outcome); bus.set_state(TurnState::Idle); if matches!( diff --git a/hive-ag3nt/src/web_ui.rs b/hive-ag3nt/src/web_ui.rs index 0383ca0c..34a36700 100644 --- a/hive-ag3nt/src/web_ui.rs +++ b/hive-ag3nt/src/web_ui.rs @@ -44,12 +44,6 @@ const SOCKET_FETCH_TIMEOUT: std::time::Duration = std::time::Duration::from_secs /// render. pub type LoginStateCell = Arc>; -/// Shared turn lock. The serve loop acquires this (as an async mutex) for the -/// duration of every `drive_turn` call. The `/api/compact` handler tries -/// `try_lock()` and rejects immediately if a turn is in flight, preventing -/// concurrent access to the claude session. -pub type TurnLock = Arc>; - #[derive(Clone)] struct AppState { label: String,