Skip to main content

Module healing

Module healing 

Source
Expand description

Auto-heal for dead seats: the supervisor that brings a durable lead or worker back when its subprocess closes while it should be up.

Re-exportsΒ§

use std::collections::HashMap; πŸ”’
use std::sync::Arc; πŸ”’
use std::sync::Mutex; πŸ”’
use std::sync::Weak; πŸ”’
use std::time::Instant; πŸ”’
use std::time::SystemTime; πŸ”’
use forge_primitives::SessionSlot; πŸ”’
use crate::Workspace; πŸ”’
use crate::crons::IST_OFFSET_MINUTES; πŸ”’
use crate::mcp::peers::types::MessageId; πŸ”’
use crate::mcp::peers::types::WrappedKind; πŸ”’
use crate::mcp::peers::types::WrappedPrompt; πŸ”’
use crate::mcp::peers::types::seat_name; πŸ”’
use crate::protocol::Command; πŸ”’
use crate::workspace::DYNAMIC_WORKER_RESTART_NOTE; πŸ”’
use policy::HealPolicy; πŸ”’
use policy::SeatFacts; πŸ”’

ModulesΒ§

policy πŸ”’
When a dead seat earns a restart, and how long the next one waits.

StructsΒ§

Healing πŸ”’
The auto-heal supervisor. One per workspace, built lazily the first time a death reaches it.
Seat πŸ”’
The supervisor’s per-slot memory: deaths since the last stable run, when the current occupant connected, and a token that makes a superseded timer a no-op.
WorkspaceRestart πŸ”’
The production restart: the workspace’s own spawn paths, which are the ones the boot re-spawn and the cron wake already use.

TraitsΒ§

SeatRestart πŸ”’
How the supervisor brings a seat back. Production dispatches through the workspace; a test records the call instead of spawning a child.

FunctionsΒ§

attempt_notice πŸ”’
The notice one worker death earns: the instant, the diagnostic, the attempt and what it did. The seat is named the way an envelope names it, so the lead can address it back.
clock_text πŸ”’
The instant as the notice spells it: IST first and UTC in parentheses, so the reader needs no arithmetic on either clock.
escalation_notice πŸ”’
The notice a spent budget earns: the restarts are over and the seat stays down with the diagnostic that ended it.
heal_resume_kick πŸ”’
The kick a heal’s worker resume carries.
lead_notice πŸ”’
The command that carries a worker’s notice to its project’s lead: the same envelope path agents__send_message uses, so a delivery to a sleeping lead parks and lands on wake.
restart_worker πŸ”’
Resume one worker through the spawn its boot re-spawn uses: that path ensures the worktree it needs, so a missing one is re-created rather than refused.
seat_facts πŸ”’
The facts eligibility is decided on, read from the workspace’s current state at each death, so a live config reload applies.

Type AliasesΒ§

Notify πŸ”’
How the supervisor tells a project’s lead about a worker. Production dispatches a peer message; a test records the prose.