Skip to main content

Crate degenbot_workers

Crate degenbot_workers 

Source
Expand description

The role-switching worker fleet core .

One generalized, bounded worker fleet whose workers switch roles — hosting every execution resource the bot needs — replacing the per-era pile of independently-sized parallelism mechanisms. This crate is the F1+F2 migration steps plus the posture skeleton:

  • role — the sized WorkerRole enum (ALL_ROLES), its cordon classes and pin classes (ADR-042 §3.1, design doc §3.1).
  • slot — worker-slot states and the T1–T9 legal-transition table; every off-table move is a loud, typed rejection (design doc §3.2–3.3).
  • budget — FleetBudget, the single budget authority bounding the SUM of every consumer’s declared peak share against the cgroup quota (design doc §5), with floor-allocation of the fractional quota.
  • quota — the fleet-local fractional (pre-ceil) cgroup-quota detector: floor-allocation’s input Q (see budget).
  • posture — the Nominal ⇄ Cordoned posture FSM consuming cpu_budget::cgroup_throttle_delta deltas; typed, tunable thresholds (sign-off amendment 2026-09-09) (design doc §6).
  • dispatcher — per-role bounded queues, sim-before-solve lease precedence, and the slot host that grants leases only along the T-table (design doc §3–§4). No production callers yet: the conformance harness (NoopStubFleetHost mirror) is the consumer.
  • gauges — per-role busy/idle gauge surface for the activation dashboard (the instruments.rs mirror seam), plus worker-census self-registration of fleet slots (design doc §7).

Engine-agnostic by construction: it depends on degenbot-core (cpu_budget + worker_census) and degenbot-config ONLY. The engine plugs roles in as closures/tasks in later migration steps (F3–F5); there is deliberately no pyo3 dependency — simulation never round-trips Python and the FFI is crossed only for runtime/startup concerns (design doc §8).

Modules§

budget
FleetBudget — the ONE budget authority bounding the SUM (design doc §5; ADR-042 §3).
dispatcher
The dispatcher: per-role bounded queues, one precedence grant loop, and the slot host that grants leases ONLY along the T-table (design doc §3–§4).
gauges
Per-role busy/idle gauge surface : the activation dashboard’s fleet source, plus the instruments.rs-mirror seam.
lane
Seat context (LW-T2, Seam B): a lane unit takes ALL external capability through a passed LaneCtx — never through ambient state, and seats run with NO ambient tokio runtime (the Handle::try_current() == Err wedge test pins this structurally). Pyo3-free by construction (design doc §8).
plan
plan — the FleetPlan tiered boot authority (FLEETFLOOR FF-T2 / MEBF4V).
posture
The Nominal ⇄ Cordoned posture FSM (design doc §6) — the first consumer of degenbot.cgroup.throttled (cpu_budget::cgroup_throttle_delta).
quota
Fractional cgroup-quota detection for the fleet budget authority.
role
WorkerRole — the sized role enum and its policy attributes (ADR-042 design doc §3.1).
slot
Worker-slot states + the T1–T9 legal-transition table (design doc §3.2–§3.3).