docs: migrate scheduled-prompts worker + dashboard-events design prose to docs
This commit is contained in:
parent
1b8a6be8ce
commit
34cc68bdfb
4 changed files with 37 additions and 60 deletions
|
|
@ -1,39 +1,7 @@
|
|||
//! Background loop that drains due `scheduled_prompts` rows
|
||||
//! and fans the body out as inbox `Message`s to each active
|
||||
//! target. Mirrors `reminder_scheduler::spawn` shape:
|
||||
//! single `spawn(coord)` entry, 5s poll cadence, shutdown-aware.
|
||||
//!
|
||||
//! ## Catch-up semantics
|
||||
//!
|
||||
//! When hive-c0re comes back from being down, a recurring row
|
||||
//! whose `next_fire_at` is well in the past would otherwise fire
|
||||
//! N delayed pulses in a row. Instead we fire ONCE and let
|
||||
//! `ScheduledPrompts::rearm` bump `next_fire_at` to the next
|
||||
//! interval slot ≥ `now`, recording the skipped-cycle count in
|
||||
//! the per-target `last_result` so operators see how many
|
||||
//! firings were caught up rather than losing the signal.
|
||||
//!
|
||||
//! ## Missing-target failure
|
||||
//!
|
||||
//! When a target name doesn't resolve to a known agent (the
|
||||
//! container has been destroyed, the operator typo'd a name,
|
||||
//! etc.) the worker:
|
||||
//! 1. records `last_result = "no such agent: <name>"` against
|
||||
//! the per-target row,
|
||||
//! 2. sends a single advisory `Message` from `system` to
|
||||
//! `operator` describing the schedule + target + reason,
|
||||
//! 3. continues fanning out to the other (live) targets.
|
||||
//!
|
||||
//! Transient broker errors (sqlite lock contention, etc.) get
|
||||
//! the per-target `last_result` annotated AND a `tracing::warn`,
|
||||
//! but the post-fire bookkeeping treats the row the same way it
|
||||
//! does on a clean fire:
|
||||
//! - **recurring** rows re-arm — the next interval slot tries
|
||||
//! the broker send again, so transient errors self-heal.
|
||||
//! - **one-shots** delete unconditionally after their single
|
||||
//! fan-out pass; a broker failure on a one-shot is NOT
|
||||
//! retried (the operator advisory + `last_result` are the only
|
||||
//! audit trail).
|
||||
//! Background loop that drains due `scheduled_prompts` rows and fans
|
||||
//! the body to each active target. 5s poll cadence, shutdown-aware.
|
||||
//! Catch-up clamp, missing-target handling, and broker-error retry
|
||||
//! semantics: `docs/approvals.md::Scheduled prompt worker`.
|
||||
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
|
|
|
|||
Loading…
Reference in a new issue