Skip to main content

Module mail_watch

Module mail_watch 

Source
Expand description

Idle notices for every harness, from session activity.

Knowing that a session finished does not need control of it: supercode’s normalized activity (crate::session_activity) reports busy/idle for a native Claude session, a running Codex, and any runtime supercode hosts. A sender that asked for --notify-when-idle gets one notice when the receiver is seen working after the message and then idle, one when the receiver ends, or one saying the subscription expired after IDLE_SUBSCRIPTION_LIFETIME. The notice is delivered through the one router (crate::mail_route), so each subscriber gets it by its own door.

Structs§

IdleWatcher
Polls the activity of every session someone subscribed to.
MailCarrier
The mailbox’s own delivery (D140): every message filed with a wake (by a filer that does not wait, such as a board’s dispatcher, or by a send to a hooked session) is handed to its session by the session’s own door, by the daemon that runs this watch loop. Mail for another machine is carried there through Teams (supercode teams mail), the only cross-machine leg, and filed with the same wake, so that machine’s watch loop delivers it. A failed attempt waits [FIRST_RETRY] doubling to [LAST_RETRY], kept in the wake itself, so a restarted watcher waits as the last one did. A wake expires only once it has failed WAKE_ATTEMPTS counted times and its first counted failure is older than its bound (LOCAL_WAKE_LIFETIME here, REMOTE_WAKE_LIFETIME for another machine): the message stays filed and unread, and the expiry is recorded in its mailbox (supercode message expired), which the board’s diagnostics read. Mail for a machine that is offline is not failing: the machine is probed once per [LAST_RETRY] (one Teams call for all of its mail, the wait kept once per machine), all of its mail is carried when it answers, and the mail expires only past OFFLINE_CEILING.

Constants§

IDLE_SUBSCRIPTION_LIFETIME
How long a subscription waits for the receiver to work and go idle.
LOCAL_WAKE_LIFETIME
How long a wake to a session on this machine keeps trying, from its first counted failure. Its basis is a session restart: the board relaunches or resumes a lost card session within its launch window (300 s, launchWindowSeconds), the machine daemon restarts its watch loop within 5 s, and a person resuming a closed session does so within minutes; thirty minutes outlasts several of those. Past it the session is not coming back soon, and the message waits unread for whenever it does (a session reads its unread mail first).
OFFLINE_CEILING
How long mail waits for a machine that keeps answering offline before it expires, saying so: thirty days, past which the machine is gone (retired, wiped, re-enrolled under another id) rather than away.
REMOTE_WAKE_LIFETIME
How long a wake to another machine keeps trying, from its first counted failure (a refusal by that machine or by Teams, or Teams unreachable). Three days outlasts a weekend with the server down. A refusal saying the machine is offline (a reboot, a closed lid) is never counted: that mail waits for the machine, however long, and is carried within [LAST_RETRY] of its link coming back.
WAKE_ATTEMPTS
Counted failures a wake has at least before it may expire.

Functions§

deliver_waiting_user_turns
Type the user’s waiting turns into their sessions’ panes, each once its composer is empty. A turn waits when the person has a draft; the mailbox is where it waits.