hive-c0re + harness: filter agent-sockets.json by .bound marker (#784, atlas concern)
closes the gate atlas raised on PR #813: without per-agent opt-in signal, agent-sockets.json listed every sub-agent, and any agent that hadn't flipped hyperhive.web.useUnixSocket would 502 the gateway (its harness still binds TCP, no socket at the published path). harness side (web_ui::bind_unix): - after successful bind + chmod, drop a `.bound` marker in the per-agent dir as a stable 'this agent has a unix socket here' signal. best-effort: a failed marker write logs at WARN but doesn't abort serve (the socket still binds fine; gateway just keeps using TCP for one more poll). c0re side (agent_sockets): - new READY_MARKER const + ready_marker_for(name) helper - build_map filters by ready_marker_for(name).exists() — only agents whose harness has bound the socket appear in the JSON map - new build_map_with<F> internal extracts the predicate so tests pass a controlled is_ready closure (no real fs access) - new spawn_poll() background task: re-fires agent_sockets::write every 10s so the JSON catches up to fresh markers without needing a container-start hook. write() idempotency means steady-state cost is one stat per agent per tick. 10 tests: 6 prior + new build_map_filters_by_ready_predicate + ready_marker_path_is_sibling_of_socket. existing tests adjusted to call build_map_with(_, |_| true) since the default path now hits the fs. once this lands + #822 lands, atlas's gateway-side step 3 can drop its eval-time `pathExists` fallback — c0re only publishes opted-in agents, so the gateway can trust the JSON unconditionally.
This commit is contained in:
parent
777d26812a
commit
5e0cb5e0f5
3 changed files with 140 additions and 8 deletions
|
|
@ -12,9 +12,9 @@ use hive_sh4re::{HostRequest, HostResponse};
|
|||
// explicit (any new daemon entry point reads off the next add).
|
||||
use hive_c0re::coordinator::Coordinator;
|
||||
use hive_c0re::{
|
||||
auto_update, broker, client, crash_watch, dashboard, dashboard_events, events_vacuum, forge,
|
||||
manager_server, matrix, migrate, rebuild_queue, reminder_scheduler, scheduled_prompts_worker,
|
||||
server, stats_vacuum,
|
||||
agent_sockets, auto_update, broker, client, crash_watch, dashboard, dashboard_events,
|
||||
events_vacuum, forge, manager_server, matrix, migrate, rebuild_queue, reminder_scheduler,
|
||||
scheduled_prompts_worker, server, stats_vacuum,
|
||||
};
|
||||
|
||||
#[derive(Parser)]
|
||||
|
|
@ -253,6 +253,15 @@ async fn cmd_serve(
|
|||
// when a previously-running container goes away without an
|
||||
// operator-initiated transient state.
|
||||
crash_watch::spawn(coord.clone());
|
||||
// Agent-sockets marker poll: re-fires `agent_sockets::write`
|
||||
// every 10s so the JSON picks up newly-bound `.bound` markers
|
||||
// (a sub-agent flipping `hyperhive.web.useUnixSocket = true`,
|
||||
// rebuilding, then having its harness bind the socket) without
|
||||
// needing an explicit hook on each container start. write() is
|
||||
// idempotent so steady-state cost is one stat per agent per
|
||||
// tick. closes atlas's #813 concern that agents in the JSON
|
||||
// would 502 the gateway until they actually opt in.
|
||||
agent_sockets::spawn_poll(coord.clone());
|
||||
// Reminder scheduler: drains due reminders + handles
|
||||
// file_path payload persistence. See reminder_scheduler.rs.
|
||||
reminder_scheduler::spawn(coord.clone());
|
||||
|
|
|
|||
Loading…
Reference in a new issue