Expand description
The idle lead sweep: forge injects the board sweep when a project’s lead has nothing in flight.
The trigger is this module’s whole subject, not the procedure: the lead charter already carries how a sweep is walked, so the injected prompt only names the moment and the ending it owes. The pass never wakes a sleeping session - a lead with no session is skipped, and its next session start sweeps, as the charter says.
Re-exports§
use std::sync::Arc;🔒use std::time::SystemTime;🔒use forge_primitives::tasks::TaskStatus;🔒use tracing::Instrument;🔒use crate::SessionSlot;🔒use crate::chase::Deliver;🔒use crate::chase::Delivery;🔒use crate::chase::PromptDeliver;🔒use crate::mcp::workers::types::WorkerEntry;🔒use crate::workspace::Workspace;🔒
Structs§
- Sweep
Clock 🔒 - One lead’s injected-sweep clock, held in memory so a restart re-arms every lead.
Constants§
- IDLE_
SWEEP_ FALLBACK_ PROMPT - The fallback’s own lead-in. The fallback fires precisely when the lead is NOT idle, so it must not claim the board is quiet.
- IDLE_
SWEEP_ FALLBACK_ SECS - A lead that has stayed busy this long is swept anyway: the prompt queues behind the running turn, so it is a nudge and not an interruption.
- IDLE_
SWEEP_ INTERVAL_ SECS - How often the loop looks. A lead that goes idle is swept within this.
- IDLE_
SWEEP_ MIN_ GAP_ SECS - At most one idle-triggered sweep per lead inside this window.
- IDLE_
SWEEP_ PROMPT - The idle path’s prompt.
Functions§
- age_
secs 🔒 - How long
nowis aftersince, and zero when the clock went backwards. An age that cannot be measured is unknown, never infinitely old: one NTP step must not sweep every lead. - lead_
is_ 🔒idle - Whether
leadis idle: it is the project’s own agent, its session is live, no turn is running, it owns no row in progress, and the project has no live worker.