Skip to main content

Module delivery_status

Module delivery_status 

Source
Expand description

Whether cloud (MuxBus) messages are reaching this channel’s agents, made visible: a sign-in that stops working, or a relay that can’t be reached, used to leave nothing but a log line while agents silently stopped getting review, CI and cross-machine messages.

State (muxbus.status’s delivery, and the muxbus:status event on every change) is derived in machine::derive from two things only: what the cloud subscriber’s loop last reported (set_link, saw_session) and the credential broker’s state for the sign-in. It never reads the credential store itself.

What follows from it (machine::Effect):

  • one OS notification when a needs-sign-in episode starts (the notify Router’s CloudSignedOut kind), taken down when it ends;
  • after machine::PAUSE_NOTICE_MS paused, one AgentMux system note for every agent subscribed to the cloud, and one more when delivery resumes, with what was delivered and what expired meanwhile (notes). Each waits for the agent’s next turn and never starts one (reactive::held_notes); a pause that ends before that turn is one note. The notes come from srv itself, never through the relay; see notes::NOTE_MARKER for why one can’t be forged.

Re-exports§

Modules§

machine
The pure half of super: what state cloud delivery is in, given what the cloud subscriber and the credential broker last said, and what to do when it changes. No clock, no I/O; every call takes now_ms.
notes
The AgentMux system notes agents get about cloud delivery, and the per-agent bookkeeping behind the resume note. Pure: times come in as unix ms, and hhmm is the one place they become wall-clock text.

Constants§

EVENT_MUXBUS_STATUS
The WebSocket event carrying a changed MuxBusDeliveryStatus.

Functions§

can_work_again
agent can work: holds its one note about relay messages left at the relay, if any were. Call after its pull’s own messages are delivered, so the note comes last.
fetched
One agent’s pull answered: delivered messages reached it and the relay reported expired. Holds its resume or expiry note, if it has one; call after the pull’s own messages are delivered, so the note comes last.
fresh_sign_in
The user just signed in (muxbus.login).
has_left_at_relay
Whether relay messages for agent were left at the relay and it has not been told.
install
Where status changes and the notification go. Call once at startup; starts the tick. Before this, state is still tracked but nothing is sent.
left_at_relay
A relay message for agent was left at the relay, because the agent can’t work now (out of quota, signed out). Remembered, so it is told once when it can.
pull_failed
agent’s pull (fetch or claim) got no usable answer from the relay, though the WebSocket may be open: its messages aren’t arriving.
saw_session
The subscriber found a stored sign-in, or a sign-in just succeeded.
set_link
What the subscriber’s loop is doing now.
signed_out
The user signed out (muxbus.disconnect).
status
The current state, for muxbus.status.