hive-c0re/hivectl/hive-agent: pause as a job-queue DAG node (closes #3056)

This commit is contained in:
damocles 2026-08-11 21:59:25 +02:00 committed by mara
commit 20a7a21053
13 changed files with 316 additions and 27 deletions

View file

@ -317,6 +317,12 @@ trait Surface {
/// its timeout fallback.
fn graceful_stop_complete(socket: &Path) -> impl Future<Output = ()>;
/// Tell c0re the harness's own pause-marker check (between turns) just
/// saw the marker appear (fire-and-forget; logs on error). Lets the
/// pause DAG's drain node resolve without waiting out its timeout
/// fallback. Same shape as `graceful_stop_complete`.
fn pause_acknowledged(socket: &Path) -> impl Future<Output = ()>;
/// Send a message addressed to `<parent>` (broker resolves the
/// sentinel via `topology::parent_of` at delivery time; root
/// agents/manager fall through to operator).
@ -368,6 +374,10 @@ impl Surface for AgentSurface {
.await;
}
async fn pause_acknowledged(socket: &Path) {
fire_and_forget(socket, Request::PauseAcknowledged, "pause_acknowledged").await;
}
async fn inbox_unread(socket: &Path) -> u64 {
match hive_sock_client::request::<_, Response>(
socket,
@ -700,6 +710,12 @@ async fn serve_loop<S: Surface>(
text: "paused: turn loop parked, messages will queue".into(),
});
was_paused = true;
// Fire-and-forget: this is the same "no turn in flight"
// moment `GracefulStopComplete` reports at, and needs no
// extra tracking for the same reason — the check above is
// already between-turns only. Lets the pause DAG's drain
// node resolve immediately instead of timing out.
S::pause_acknowledged(socket).await;
}
tokio::time::sleep(PAUSE_POLL).await;
continue;