Public: anyone can read this; the crew can change it.

Serving first: background work at SCHED_IDLE, and new checks and crew runs wait while the forge is under pressure #17235

opened this

Merged 31h 2m ago, live in production

vxrail at 20:22Z on 2026-12-01: load 113 on 80 cores. The forge's own tasks waited for a CPU 7–13% of the time (its cgroup's cpu.pressure), with checks and crew runs in its container at SCHEDBATCH and nice 10. This is steps 1 and 3 of talk-research/serving-slices-design.md.

Notes

opened this

vxrail at 20:22Z on 2026-12-01: load 113 on 80 cores. The forge's own tasks waited for a CPU 7–13% of the time (its cgroup's cpu.pressure), with checks and crew runs in its container at SCHED_BATCH and nice 10. This is steps 1 and 3 of talk-research/serving-slices-design.md. Step 2, a low-weight slice for the runner containers, is a host change and goes to the owner.

  • Step 1: apps/background.ts asks for SCHED_IDLE (chrt -i, needs no privilege), weight 3 against the forge's 1024. It was SCHED_BATCH at nice 10 (weight 110). Nice 10 stays as the fallback where chrt is refused, and best-effort IO stays.
  • The pressure hold, runs/pressure_hold.ts:
    • It reads the forge's own /sys/fs/cgroup/{cpu,io}.pressure, "some avg10", else /proc/pressure.
    • At the limits no new pull check (the check lane's scheduler) and no crew run the crew picked (dispatch) starts. Each says why once in its log: "queued, held: serving first: the forge's CPU pressure is 27%…".
    • Running work is never cut. Main's checks, a rebase's check, a person's own pull's check and a run a person sent are never held.
    • Bounded: it releases below half the limits, or after 10 minutes. A spent hold does not hold again until the pressure has fallen below half once.
    • FORGE_PRESSURE_HOLD=cpu,io (default 40,20, so it acts only in a real overload; lower it once SCHED_IDLE has landed and the probe shows where pressure settles; 0 is off).
    • A forge that cannot read its pressure (macOS) never holds and says so.
  • Both doors: Settings → Capacity and the terminal's Capacity screen show "Serving first: the forge's CPU pressure N%, IO M%; new checks and crew runs wait at 40% / 20%…". The hold's cause is in vitals as "serving first" (held.ts).
  • docs/features/serving-first.md.
  • Lending (#17161, not on main yet) should treat a hold as "nothing to lend". That is wired once it lands.

Tests:

  • pressure-hold: the rule (parsing, hold at the limit, release below half, at most 10 min, re-arm, IO alone, off, unreadable).
  • pressure-hold, the check lane: with pressure 50%, main's check runs and the pull's waits with its log line, and both doors say it. At 5% the pull's starts.
  • serving-priority: updated for SCHED_IDLE.
  • Rule batches: 15 files, then 12 hold and crew files. boundary-pull-egress fails the same way on main on this Mac.

Try: open /settings/capacity; its Serving first line says the forge's CPU and IO pressure and whether new work waits Direction: the forge's own pages stay fast while checks fill the machine (serving-slices design, 2026-12-01) Looks: /settings/capacity No door: no new screen; the line is on two existing ones, Settings → Capacity (src/web/pages/capacity.ts) and the terminal's Capacity screen (src/tui/screens/capacity.ts)

Co-Authored-By: Claude Fable 5 <[email protected]>

Context: on 2026-12-01 the forge container ran about 25 cores of its own batch work beside serving, with its cgroup cpu.pressure at 17–33%. The host side, forge-ci.slice (runners at CPUWeight 20), is applied with the owner's go; this is the in-container half.

🤖 Generated with Claude Code

commented

<!-- look-pages ef98d458e3c6 --> Look pages for ef98d45, from the gate:

  • look pages (none): "Looks: /settings/capacity" is not a page of app.looks in forge.json; this pull changes src/web/pages/capacity.ts but the forge could not trace the route of /settings/security/controls (an inline or wrapped handler), so it could not infer a page; the reviewer decides. A "Looks: <path>" line naming the nearest page, or a "No look: <why>" line (10+ characters), says it
Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs