feat(c0re): per-container disk-size sampler on container-load (#1659)

This commit is contained in:
damocles 2026-06-17 18:43:01 +02:00 committed by mara
commit d57f8845b4
3 changed files with 107 additions and 4 deletions

View file

@ -195,7 +195,11 @@ bar against the `memory.max` quota. Backed by
files read-only (world-readable; no `hive-priv`) and skips agents whose
scope dir is absent (= not running). Pull-only: `core.js` polls every
5 s **only while the C0NT41N3R L04D sub-tab is active** (CPU needs a fresh
sample each refresh), and stops on sub-tab change. Network is intentionally
sample each refresh), and stops on sub-tab change. Disk size (`disk_bytes`)
rides the same row but is fed by a separate ~5 min background `du` sampler
(state dir + container writable rootfs, shared nix store excluded via
`du -x`), so the 5 s poll stays cheap cgroup-only reads; the row carries the
last-sampled value (`null` until the first sample). Network is intentionally
omitted — agents share the host netns, so there is no per-container net
counter (per-agent network needs the netns-isolation roadmap in
`docs/network.md`).
@ -994,9 +998,13 @@ that's a browser-level decision, not ours.
- `GET /api/container-resources` — live per-agent-container CPU +
memory from cgroup v2 (C0R3 C0NT41N3R L04D panel). Returns one
row per running agent (`name`, `cpu_pct`, `mem_current_bytes`,
`mem_peak_bytes`, `mem_max_bytes`); samples CPU over ~200 ms so the
call briefly awaits. Skips non-running agents (no scope dir). No
network field — agents share the host netns.
`mem_peak_bytes`, `mem_max_bytes`, `disk_bytes`); samples CPU over
~200 ms so the call briefly awaits. Skips non-running agents (no scope
dir). No network field — agents share the host netns. `disk_bytes` is
the last value from a **separate slow sampler** (not this hot path):
a background `du -sxb` of the agent's state dir + container writable
rootfs every ~5 min, `-x` excluding the shared read-only nix store.
`null` until the first sample lands.
- `POST /cancel-reminder/{id}` — hard-delete a pending reminder.
- `POST /retry-reminder/{id}` — re-arm a reminder whose delivery
failed (clears the failure state so the scheduler retries).