Skip to main content

Module route_credits

Module route_credits 

Source
Expand description

A model route out of credits (HTTP 402): every agent on it is stopped, and each lead is told once. A model route whose key has no credits left (HTTP 402).

Every agent on the route fails the same way until someone adds credits. Without this, only the agent that happened to hit the 402 showed the failure; the others stayed idle and available, messages kept starting turns that failed, and nobody was told.

What follows from the first 402 of an episode (a route, from its first 402 to its next success):

  • the failure (agents::failure classes it UsageLimit with ROUTE_CREDITS_TITLE, and limit_reset gives it a reset ten minutes ahead) is written to every other open pane on the route, so each shows as limited and holds its messages until the reset, when a turn probes the route;
  • each distinct lead of those agents gets one [AgentMux] note naming its agents, and no note about the route after it (a worker’s own failure note is left out, worker_notes);
  • the first successful response on the route (spend_watch::settled) ends the episode and takes the failure off every pane that still shows it.

An agent on no route (a harness on its own provider key) has an episode of its own, and is noted the same way; a turn that works clears its own failure.

Functions§

cleared
A response on route worked: its episode ends, and the failure goes off every pane that shows it. BLOCKING (store reads and writes), but only once per episode; any other call is a map lookup.
install
Start listening. Called once from main.