Watch
0
0
Fork
You've already forked hyperhive
0

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:
iris 2026-11-09 22:08:05 +01:00 • committed by mara
commit a2c9e9a8d4

View file

@ -191,6 +191,14 @@ pub async fn wait_for_login(
version,
"installed the claude credentials the swarm login stored"
),
Ok(claude_credentials::Outcome::Deleted { installed }) => {
// Nothing to log out of, but the recorded version would
// keep a restarted counter's first login from installing.
tracing::info!(installed, "the swarm's stored claude login was deleted");
if let Err(e) = pickup.forget_installed() {
tracing::warn!(error = %format!("{e:#}"), "forgetting the installed login version failed");
}
}
Ok(outcome) => tracing::debug!(?outcome, "no newer swarm claude credentials"),
Err(e) => tracing::warn!(
error = %format!("{e:#}"),
@ -214,7 +222,7 @@ pub async fn wait_for_login(
/// The swarm-login pickup for `claude_dir`, or `None` when this process has
/// no store to read from.
fn swarm_pickup(
pub(crate) fn swarm_pickup(
claude_dir: &Path,
) -> Option<claude_credentials::Pickup<claude_credentials::Store>> {
match claude_credentials::Store::from_env() {