Skip to main content

Module failover

Module failover 

Source
Expand description

Automatic failover (docs/specs/SPEC_AGENTS_OPERATE_OTHER_MACHINES_2026_10_30.md §4.4, D4): an agent whose pane hit a usage limit moves itself to another signed-in account of its provider that has quota, once its turn is over, and says so in one note to the agent and one to its lead.

It is agent.account.switch (switch::switch_to, after_turn) chosen by srv, so the move relinks, clears the old account’s limit and restarts the pane the way every other switch does. It never picks:

  • an account the operator marked “never fail over to this” (context.never_failover);
  • an account that is not signed in (valid/ok; an unchecked one is not trusted with an unattended move), or one a pane of another agent has just found out of quota;
  • an account of another provider.

agent:accountfailover (default on; false turns it all off) is the one setting.

Structs§

IdentityAccountSetFailoverReq
identity.account.set_failover.
IdentityAccountSetFailoverResult
identity.account.set_failover: how the account stands now.

Constants§

ACTOR 🔒
Who the audit row names, and what tells notify a switch was a failover.
ACTOR_EXPIRED 🔒
The same for the move off a login that expired (login_expiry).
NEVER_FAILOVER
The account’s mark (in context): never move an agent onto it by itself. The account’s mark (in context): never move an agent onto it by itself. server::account_episodes::failover re-exports it.
SETTING
agent:accountfailover: move an agent that hit its limit to an account with quota. On unless false.
UNKNOWN_RESET_MS 🔒
How long to avoid an account left over a limit with no known reset.

Statics§

LEFT 🔒
Accounts an agent was moved off after a limit, and when that limit lifts (unix ms): the move clears the stored failure, so without this the next failover could send the agent straight back to an account no pane has re-tested yet.

Functions§

enabled 🔒
is_actor 🔒
Whether actor is one of the failovers (their moves are told to the agent and its lead).
is_never
Whether the operator marked a “never fail over to this”.
notify 🔒
The one-line notes for a failover that landed: to the agent’s panes, and to its lead’s first open pane. Held for each one’s next turn: neither is woken for it, and the agent’s pane is not asked to run before its account is in place. expired says the login ended, not the quota; the panes in woken get their own note that starts a turn (login_expiry), so not this one.
recently_left 🔒
remember_left 🔒
run 🔒
Move each agent with a pane out of quota (a usage limit, not a refused sign-in) to an account that can run. panes are the blocked panes of this refresh. An agent with a move already queued is left to it. BLOCKING (store reads, link writes, restarts).
set_failover 🔒
identity.account.set_failover. BLOCKING (a store write).
target 🔒
The account pane’s agent moves to: one of its provider’s other accounts that is signed in, has quota, isn’t marked and wasn’t just left over its own limit, else why not.