Skip to main content

Module limit_probe

Module limit_probe 

Source
Expand description

Finding out that a limited agent can work again when nothing else will say so. A stored usage limit ends at its reset, a clean turn, a sign-in or an account move; if the account was changed out of band (the plan was raised, the limit was lifted by hand) none of those happens, and every message to the agent stays held. So a message that must not wait (urgent, or naming a task that waits on the agent) is still held, and in addition one small turn is started on the pane. A clean turn clears the failure and wakes the replay, which then sends what was held; a turn that fails again leaves the agent limited and the message held. The message itself never rides the probe, so a failed turn loses nothing. Spec: docs/specs/SPEC_AGENT_AVAILABILITY_ONE_STATE_2026_10_26.md.

Enumsยง

Check ๐Ÿ”’
What check_now did.

Constantsยง

CHECK_STAGGER_MS ๐Ÿ”’
The pause between the starts of the check turns of one account.
PERSON_CHECK_EVERY_MS ๐Ÿ”’
The least time between two checks a personโ€™s message starts on one agent.
PROBE_EVERY_MS ๐Ÿ”’
The least time between two probes of one agent.
PROBE_NOTE ๐Ÿ”’
What the agent is asked; any reply is a clean turn.
PROBE_WINDOW_MS ๐Ÿ”’
How long after it started a probeโ€™s turn is taken to still be running.

Staticsยง

LAST_PROBE ๐Ÿ”’
PROBING ๐Ÿ”’
The panes with a probe turn in flight, and when it began.

Functionsยง

check_limited ๐Ÿ”’
โ€œCheck nowโ€ for the panes block_ids: each one out of quota gets a check turn (check_now), staggered by account. Ok when its check started, runs, or starts in a moment; Err says why not (not out of quota, a route out of credits, not registered). The way to say โ€œthe plan changed, look againโ€, so nobody needs to know that an urgent message is what starts one.
check_now ๐Ÿ”’
Starts a check turn on the agent of block_id because a personโ€™s message waits for it: it does not wait for the 15-minute slot a message between agents does, but one turn runs at a time and a new one starts no sooner than a minute after the last. The message itself never rides the turn.
maybe_probe ๐Ÿ”’
After req was held for a limited agent: start a probe turn if it warrants one and the agentโ€™s slot is free.
stagger_delays ๐Ÿ”’
How long after the first each check of one account starts: the first at once, the others CHECK_STAGGER_MS apart, so the agents of an account do not all start a turn in the same second. accounts[i] is pane iโ€™s account (None: its own).
start_check ๐Ÿ”’
take_person_check ๐Ÿ”’
Takes the right to start a check on block_id, and marks its turn in flight (the hold lasts until it clears the limit, unavailable_while_probing). false when one runs or ran less than PERSON_CHECK_EVERY_MS ago.
take_slot ๐Ÿ”’
Takes the probe slot of key if its last probe is at least PROBE_EVERY_MS ago; false leaves it as it was.
unavailable_while_probing ๐Ÿ”’
The limit of the agent on block_id while its probe turn runs. A turn in flight makes the pane working, so the usual check would let a replay pass release held messages into the probe, and a probe that fails would lose them. The hold lasts until the probe clears the stored failure (a clean turn) or PROBE_WINDOW_MS has passed. BLOCKING.
wants_probe ๐Ÿ”’
Whether a held message to this agent warrants a probe: the agent is out of quota until a known reset (without one, messages are delivered and a turn finds out), and the message cannot wait.