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
|
|
@ -28,11 +28,13 @@ pins for agents, and its container's own nixpkgs' where the host pins none.
|
|||
stores the `.credentials.json` claude wrote at
|
||||
`swarm/agents/<agent>/claude-credentials` (field `value`), as a new version
|
||||
over any stored before, and removes the scratch directory.
|
||||
6. The agent's harness, while it waits for a login, reads that leaf every 30
|
||||
seconds under the agent's own certificate. When the stored version is newer
|
||||
than the one it installed last, it writes the file to
|
||||
`~/.claude/.credentials.json`, records the version, and resumes its turn
|
||||
loop as it does after a login from the agent's web UI.
|
||||
6. The agent's harness reads that leaf under the agent's own certificate: every
|
||||
30 seconds while it waits for a login, every 5 minutes while it has a
|
||||
session, and once as a paused agent resumes. When the stored version is
|
||||
newer than the one it installed last, it writes the file to
|
||||
`~/.claude/.credentials.json`, records the version, and, for an agent that
|
||||
waited, resumes its turn loop as it does after a login from the agent's web
|
||||
UI.
|
||||
|
||||
A started login waits 15 minutes for its code, then the minter stops it.
|
||||
Starting another login for the same agent replaces the running one. Each step
|
||||
|
|
@ -65,7 +67,11 @@ version it installed (`claude-credentials-version` under the harness dir):
|
|||
- it installs a newer version, that is, a new login;
|
||||
- it leaves an equal or older version alone, even when the agent needs a
|
||||
login again, so it never puts back a session that has gone bad;
|
||||
- it reads nothing while the agent has a session.
|
||||
- it logs the agent out when the store holds nothing although a version was
|
||||
installed: the operator deleted the stored login. A read that failed never
|
||||
does it, since an unreachable store says nothing about the login. The
|
||||
logout is the one `/api/logout` does, and the recorded version is
|
||||
forgotten so the next login installs.
|
||||
|
||||
## Credentials
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue