FrankenTerm

Fleet Memory Controller

466 words2 min read5 subsectionsFrom the README at ft 0.15.21

On this page5
InputsSynthesis: worst-of4-tier pressure modelAsymmetric hysteresisCockpit data

The fleet memory controller synthesizes pressure from three independent subsystems into a single 4-tier model that drives uniform action across the system.

Inputs

  1. Pipeline backpressure — the capture queue and the storage-writer queue depths against their capacities (the same rows the resource cockpit's queue_backpressure domain reports).
  2. System memory utilization — process RSS / total RAM, with platform-specific source (sysctl on macOS, /proc/meminfo on Linux).
  3. Per-pane memory budgets — each pane's resident scrollback as the mux reports it (warm resident bytes plus in-memory rows), against [fleet_scrollback] per_pane_budget_bytes.

Synthesis: worst-of

The controller takes the worst tier across the three inputs. If pipeline backpressure is Green but per-pane budget is Red, the synthesized tier is Red. A single hot signal must always escalate.

4-tier pressure model

Tier Meaning Action
Normal All inputs healthy None
Elevated One input is yellow Idle panes may back off to a 4x longer poll ceiling; active panes keep their poll rate
Critical Any input is red Idle panes are paused (a 16x longer poll ceiling), plus ft watch asks the mux to move the most pressured panes' warm scrollback to the cold tier (mux codec 67+; older muxes log a recommendation)
Emergency Any input is black Idle panes are paused (16x ceiling); warm scrollback is evicted on every pane

Pausing an idle pane stretches its poll ceiling rather than stopping capture: its next poll captures what it printed meanwhile (a burst larger than the capture window becomes an explicit gap segment, as at any poll rate), and a pane that starts printing returns to the fast poll floor at once.

ft watch also evaluates the global admission controller every health tick for a standard new agent spawn: capture/write queue fullness and measured failure rate, the compound fleet tier, the mux warm-tier budget, and measured p95 stage latencies against their budgets. The verdict (admit, defer, degrade, or shed, with reason codes; missing evidence is reported, never guessed) is published in the resource cockpit's resource_admission domain in ft doctor --json. ft robot profile apply and a scaling-up ft robot fleet scale consult it before spawning: a fresh shed verdict refuses the spawn (robot.admission_shed; override with --force-admission), and every other verdict, including unavailable when no watcher answers or its snapshot is older than 90 s, proceeds and is reported in the response's admission field.

Asymmetric hysteresis

Escalation is fast: any input crossing into a hotter tier escalates immediately. De-escalation is slow: the controller requires N consecutive samples of the cooler state before stepping down a tier. This prevents flapping when an input oscillates near a tier boundary.

Cockpit data

During incidents, the resource-pressure cockpit contract gives operators the residency breakdown: rust_heap, mmap_file_backed, sqlite_page_cache, graphics_media, scrollback_cache, child_processes, unknown. Before calling anything a "leak," operators classify the residency source. The cockpit also exposes action_receipts — what mitigations have already been attempted and their outcomes.