Answer architecture round 1: 0 🔴, 3 🟡 (0 misread); keep the slot's share beside ROOM_SHARE in machine_load, move the rule's predicate into rule_hook, and have capped set both limits itself instead of leaning on docker taking the last option

This commit is contained in:
2026-10-24 11:24:21 +02:00
parent 4c1ab3f185
commit 52641079b7
7 changed files with 60 additions and 31 deletions
+1 -1
View File
@@ -80,7 +80,7 @@ The cap is 5, `bin/todo_table.py`'s `BUNDLE_MAX_R`, from the same chunks: by the
2026-10-24, lilleman. Serves goal 1.5. On 2026-10-23 ai-sandbox, then with 8 CPUs and 7.6 GiB of memory, hung until a hard reset, although its one heavy command held a slot. Beside that mutation run, a reviewer's stress probes ran in `docker run` with no memory limit, each to 2 GiB. A limit makes a runaway container fail alone instead of taking the machine with it. A swap limit is needed too: without one, docker lets a container swap as much again as its memory limit, and swapping is how the machine hung. The session sizes both limits, since lilleman wants a project to run heavier work where it needs to. rule-hook reads only the `docker run` and `docker create` in a session's Bash commands. A container a script starts is out of its sight, and so is a compose service, whose limits live in its compose file. `CLAUDE.md` → "Working with the codebase" asks a session for limits there.
The heavy command in that hang started its container from the project's own script, out of rule-hook's sight. So run-heavy puts first on its command's `PATH` a `docker`, `bin/run_heavy/path_entry/docker`, which gives each `docker run` or `docker create` that lacks a limit the slot's share: three quarters of MemTotal, which the quarter a worker waits for leaves, split evenly across the slots (todo item 227). A container that sets its own memory limit keeps it, with a swap limit as large, since docker refuses less swap than memory. run-heavy cannot place the command in a cgroup instead: none is delegated to the user, and dockerd starts the containers outside the command's process tree. A compose service, and a docker named by its full path, keep no cap.
The heavy command in that hang started its container from the project's own script, out of rule-hook's sight. So run-heavy puts first on its command's `PATH` a `docker`, `bin/run_heavy/path_entry/docker`, which gives each `docker run` or `docker create` that lacks a limit the slot's share: three quarters of MemTotal, which the quarter a worker waits for leaves, split evenly across the slots (todo item 227). A container that sets one of the two limits keeps it, and gets the other as large, since docker refuses less swap than memory; an unlimited swap, `--memory-swap -1`, gives way. run-heavy cannot place the command in a cgroup instead: none is delegated to the user, and dockerd starts the containers outside the command's process tree. A compose service, and a docker named by its full path, keep no cap.
A daemon-wide cap would see every container: dockerd's `cgroup-parent`, given a memory limit. lilleman turned it down, since it is host config and would cap a project's heavy work too. Valid while sessions start their work in containers on a machine they share.