hive-agent: a logged-in agent polls the swarm login, and logs out when it is deleted
wait_for_login read the store leaf only while the agent waited for a login. A logged-in agent now reads it every 5 minutes, and a paused one once before it resumes, so a login made or deleted in the swarm UI reaches an agent that never failed. A newer version is installed; a store that answers nothing stored after a version was installed means the stored login was deleted, and the agent is logged out as /api/logout does it, with the recorded version forgotten so the next login installs. A read that fails changes nothing.
This commit is contained in:
parent
71a4d1d255
commit
a2c9e9a8d4
1 changed files with 188 additions and 23 deletions
|
|
@ -20,6 +20,7 @@ mod events;
|
|||
mod harness_state;
|
||||
mod identity;
|
||||
mod login;
|
||||
mod login_watch;
|
||||
mod mcp_config;
|
||||
mod otel_turn_metrics;
|
||||
mod paths;
|
||||
|
|
@ -540,6 +541,7 @@ async fn serve_main<S: Surface>(socket: &Path, poll_ms: u64) -> Result<()> {
|
|||
// hive-c0re, because the files are agent-owned — see `vacuum` module docs.
|
||||
tokio::spawn(crate::vacuum::run());
|
||||
tokio::spawn(claude_usage_watch::run());
|
||||
tokio::spawn(login_watch::run(login_state.clone(), bus.clone()));
|
||||
tokio::spawn(subagent_role_watch::run());
|
||||
// Log web_ui::serve's error instead of dropping it. A bare
|
||||
// `tokio::spawn(web_ui::serve(...))` discards the JoinHandle, so
|
||||
|
|
@ -780,6 +782,9 @@ async fn serve_loop<S: Surface>(
|
|||
});
|
||||
was_paused = false;
|
||||
todo_miss_streak = 0;
|
||||
// A login the operator deleted or renewed while the agent was parked
|
||||
// counts before its first turn, not five minutes into it.
|
||||
login_watch::check_once(&login_state, &bus).await;
|
||||
}
|
||||
let next = match next_outcome(
|
||||
S::recv_next(socket),
|
||||
|
|
|
|||
Loading…
Reference in a new issue