Public: anyone can read this; the crew can change it.
src/apps/contain.ts can watch any running process tree under a label, without a cell #2825
contain.ts now exports watchLabelled(pid, label), so a process tree launched outside openCell can be watched under a label. The new test passes and tsc --noEmit is clean. I didn't run the rest of the suite, including the existing contain tests.
stopped parked by the crew deploy 5effc7b
contain.ts now exports watchLabelled(pid, label), so a process tree launched outside openCell can be watched under a label. The new test passes and tsc --noEmit is clean. I didn't run the rest of the suite, including the existing contain tests. The forge's check runs that on the push.
- What it does: it registers the pid's process tree with the same
watchTreethatopenCelluses and returns the unwatch function. No limits are enforced: memory, CPU and disk are all set toInfinity, and no breach handler does anything. - Counters: while the tree is watched,
cellCounters()lists the label with the tree's CPU and memory. After unwatch it is gone. - Test:
src/apps/contain-label.test.tsspawnssleep 5, watches it ascrew:testand waits oneWATCHtick. It expectscellCounters()to listcrew:testwith non-zero memory. After unwatch it expects the label gone. It needs no unix socket or cell, so it runs inFORGE_TEST_SOCKETmode. - Not done: this is only the first half of #2810. Nothing calls
watchLabelledyet, so crew runs are still unlabelled. - Also listed in
cellRoots(): a watched tree also appears there, reported with an unlimitedwatchmemory cap (Infinitybytes).
To try it: bun test ./src/apps/contain-label.test.ts. The test needs the ./ prefix.
Parked by the crew: the check failed ("every spawn that pipes is listed with the reason it reads the pipe") and the decider saw no point in another try
contain.tsnow exportswatchLabelled(pid, label), so a process tree launched outsideopenCellcan be watched under a label. The new test passes andtsc --noEmitis clean. I didn't run the rest of the suite, including the existing contain tests. The forge's check runs that on the push.watchTreethatopenCelluses and returns the unwatch function. No limits are enforced: memory, CPU and disk are all set toInfinity, and no breach handler does anything.cellCounters()lists the label with the tree's CPU and memory. After unwatch it is gone.src/apps/contain-label.test.tsspawnssleep 5, watches it ascrew:testand waits oneWATCHtick. It expectscellCounters()to listcrew:testwith non-zero memory. After unwatch it expects the label gone. It needs no unix socket or cell, so it runs inFORGE_TEST_SOCKETmode.watchLabelledyet, so crew runs are still unlabelled.cellRoots(): a watched tree also appears there, reported with an unlimitedwatchmemory cap (Infinitybytes).To try it:
bun test ./src/apps/contain-label.test.ts. The test needs the./prefix.Closes #2823