Skip to content

heavy: fix the #727 review minors; note why the queue test failed - #760

Merged
scuttletoby merged 2 commits into
mainfrom
fix/569-heavy-queue-flake-744
Nov 21, 2026
Merged

scuttletoby merged 2 commits into
mainfrom
fix/569-heavy-queue-flake-744

Conversation

@scuttletoby

Copy link
Copy Markdown
Owner

What and why

#569: the queue test that left the lock taken

Root cause: the failing CI run did not test current main. It tested a merge onto an older base, from before #560.
On that base, the test's live() look used the queue built on the fake clock. The queue retries its non-blocking
flock every 0.05 s for up to 30 s, but on the fake clock those 30 s pass with no real time spent. So whenever a real
process (the killed waiter's sibling, or the second caller) held the lock for a few milliseconds, the look raised
LockBusy ("stayed taken"). The lock itself was released correctly: the kernel drops a flock while the killed
process closes its files, before its parent is told it ended, so the lock is free once wait() returns. #560 already
fixed this at the root: live() now uses a queue on the real clock.

Reproduced: 50 runs each of test_a_waiter_killed_with_9_frees_its_place and test_two_callers_at_the_same_instant,
with 8 CPU hogs on 12 cores:

Main already has deterministic tests of the release path:

  • test_a_lock_holder_killed_with_9_frees_the_lock_at_once
  • test_a_look_waits_in_real_time_for_a_process_holding_the_lock

So the queue code needs no change for #569. This PR closes the issue with that evidence.

#744: the 8 minors from the #727 reviews

  1. README: force-kill reaches sudo/setuid children. cgroup.kill also kills a sudo or setuid process the
    command started in its scope. The README now says so on purpose: the scope is the job's own.
  2. A refused docker-label under a shell. The refusal prints nothing, so --label "$(heavy docker-label)" becomes
    --label "". Docker rejects an empty label, so no container starts: this form fails closed. The refusal message now
    names the real cause when the process left heavy's scope (... so heavy would remove the container under it: pass --owner-pid PID ...). The README tells --value callers to check the exit code, since Docker accepts an empty
    label value (the sweep only reports such a container).
  3. Pid-reuse window. signal_in now sends signals only through a pidfd, after checking that the process is still
    in the scope. It never falls back to os.kill(pid). Without pidfds (before Linux 5.3) no TERM is sent; the KILL is
    cgroup.kill. So there is no window left where a reused pid gets hit.
  4. A test for done()'s wait. test_heavy_ends_only_after_its_guard stops the guard with SIGSTOP and checks that
    heavy does not exit until the guard ends.
  5. install.test.py leaves a note behind. The test now uses --owner-pid (a process owner writes no note) and
    checks that no note of its scope appeared in either folder.
  6. README: who refuses to start. The refusal to start when heavy is already gone is the command's, not the guard's.
    The README now says so. Two over-long prose lines are rewrapped too.
  7. Timeouts on every test read of heavy's output. Each test file has a read_line(p, timeout=60) helper that kills
    the process and fails instead of hanging. Every wait(), communicate() and subprocess.run() in the four heavy test
    files now has a timeout. A new Hygiene test parses the four files and fails on any read or wait without a timeout,
    so new ones cannot creep in.
  8. A note that never reaches heavy. heavy now reads notes from two folders:
    • /run/user/<uid>/heavy/labelled/, as before
    • ~/.local/state/heavy/labelled/, which heavy makes when it is missing
      heavy passes the device:inode of each folder it reads to the command as HEAVY_MARKS. docker-label writes its note
      in the first folder that is one of those, so a note in another mount namespace's /run/user (a sandbox), or in a
      /run/user that is full, is never counted as delivered: the note goes to the state folder instead. Only when
      neither folder reaches heavy does docker-label warn. heavy then cannot tell the run labelled a container, and the
      leftover sweep removes the container later. Each folder, and the folders above it up to the base, must be a
      directory owned by the user, with no group or other write permission, or heavy does not use it. So a
      group-writable ~/.local/state leaves only /run/user, as before this PR.

State question (runs again, stopped half-way, old/empty/missing state)

  • Runs again: a second docker-label in the same scope rewrites the same note. heavy deletes the note in both
    folders after asking Docker. Tested.
  • Stopped half-way: if heavy and its guard are both killed with kill -9, a 0-byte note can stay in
    ~/.local/state. That is harmless: a later scope with the same random 32-bit name would only ask Docker once more.
    The leftover sweep still finds the container.
  • Old state: with an older heavy (no HEAVY_MARKS), docker-label writes only to /run/user, as before. Tested.
  • Empty or missing state: heavy makes a missing state folder. A folder with bad permissions is skipped, and with no
    folder at all heavy asks Docker after every run, as before. Tested.

Tests

All run locally, each gated on t3-capacity:

  • queue.test.py: 70 tests OK
  • sweep.test.py: 78 tests OK (1 skipped, as on main: it is skipped when run inside a heavy scope)
  • install.test.py: 16 tests OK
  • heavy.test.py with HEAVY_REAL_TESTS=1 (real systemd user manager): 59 tests OK

New tests:

  • Parts.test_without_pidfds_nothing_is_signalled_by_pid (item 3; pidfd_open missing, and failing with ENOSYS)
  • Heavy.test_heavy_ends_only_after_its_guard (item 4)
  • Heavy.test_a_note_that_cannot_reach_heavy_in_run_user_goes_to_the_state_folder (item 8, end to end with fake
    docker)
  • Parts.test_marks_folder_the_same_for_heavy_and_docker_label_and_only_this_users, rewritten for two folders
    (item 8: missing, unusable and old state)
  • Parts.test_the_command_gets_heavy_marks_only_from_its_own_heavy (item 8)
  • Label.test_the_note_goes_where_heavy_reads_it (item 8: the normal case, running again, another namespace, an
    unusable folder, neither folder, an older heavy)
  • Label.test_a_process_that_left_heavys_scope_under_a_shell_is_told_to_name_its_owner (item 2)
  • Hygiene.test_every_wait_for_a_test_process_has_a_timeout and Hygiene.test_read_line_fails_instead_of_hanging
    (item 7)
  • the install test now checks that it leaves no note (item 5)

Red on the old code

New tests run against origin/main's code (main's bin/heavy and lib/, with this PR's test files): red are

  • test_without_pidfds_nothing_is_signalled_by_pid (both cases)
  • test_a_note_that_cannot_reach_heavy_in_run_user_goes_to_the_state_folder
  • test_marks_folder_the_same_for_heavy_and_docker_label_and_only_this_users
  • test_the_command_gets_heavy_marks_only_from_its_own_heavy
  • test_the_note_goes_where_heavy_reads_it
  • test_a_process_that_left_heavys_scope_under_a_shell_is_told_to_name_its_owner

Some fixes were already on main or are test fixes, so their tests pass on main. Items 4, 5 and 7 are like that: the
wait in done() came with #727, and items 5 and 7 change the tests themselves. For those, and for each new line of
item 8, the spot checks below remove one fix line at a time. Each goes red:

Removed Red
done()'s wait for the guard test_heavy_ends_only_after_its_guard ("heavy ended while its guard still ran")
give_marks dropping an outer HEAVY_MARKS test_the_command_gets_heavy_marks_only_from_its_own_heavy
labelled looking in every folder the marks test and the end-to-end state-folder test
heavy reading the state folder the marks test and the end-to-end state-folder test
forget clearing every folder the marks test and the end-to-end state-folder test
making a missing state folder the marks test
docker-label's check against HEAVY_MARKS test_the_note_goes_where_heavy_reads_it
--owner-pid in the install test (run under heavy) test_installed_version_runs_the_sweep_from_its_own_copy_of_common
one wait(timeout=60) in queue.test.py test_every_wait_for_a_test_process_has_a_timeout
the kill in read_line on timeout test_read_line_fails_instead_of_hanging

General vs project

Everything here is general: fork-kit/heavy is a machine-wide tool with no project facts in it. No upstream files are
changed (fork-seam-check passes).

Closes #569
Closes #744

🤖 Generated with Claude Code

#569: the CI failure tested a merge onto a base from before #560. There, the
test's live() look ran on the fake clock, so its 30 s lock wait passed in no
real time. #560 already moved live() to the real clock. Reproduced: 3 of 50
runs failed on the old base with 8 CPU hogs, 0 of 50 on this branch. The lock
release after SIGKILL is the kernel's flock drop, and tests on main cover it.

#744:
- signal_in signals only through a pidfd; no fallback to kill(pid)
- docker-label notes go to ~/.local/state/heavy/labelled when the /run/user note
  cannot reach heavy; heavy passes the folders it reads as HEAVY_MARKS
- the refusal under a shell after leaving heavy's scope names the cause
- tests: done() waits for the guard; the install test leaves no note; every
  read and wait of a test process has a timeout, checked by an AST test
- README: cgroup.kill reaches sudo/setuid processes; who refuses to start;
  the --value exit code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@scuttletoby

Copy link
Copy Markdown
Owner Author

Review lens A (kills and safety), head 4728326: SAFE

Verdict: SAFE. No blocking or major findings. Two minors, two nits.

What I checked

  • Wrong process or group. signal_in (bin/heavy:280-300) now signals only through a pidfd. The pidfd is opened before the cgroup check. If the pid was reused, the check reads the new process and does not signal it. If the pinned process ends after the check, the signal goes to the dead pidfd and does nothing. With no os.pidfd_open, or pidfd_open failing (ENOSYS, EMFILE, ESRCH), heavy skips that pid and never calls os.kill(pid). heavy still uses os.kill in two places: its own unreaped systemd-run child (child.pid), whose pid cannot be reused, and the guard, which is not signalled. KILL goes through cgroup.kill, which takes no pid. A process that left the cgroup is not signalled and cgroup.kill does not reach it. That is the intended design and is unchanged.

  • Without pidfds. cgroup.kill (5.14+) is a clean stop: the kernel kills the whole subtree and also blocks forks that race it. Before 5.14 and without pidfds (before 5.3), nothing is signalled by hand. heavy names what is left, and the sweep looks again. This only happens when systemctl --user stop itself failed. sudo/setuid children: a pidfd TERM gets EPERM (swallowed), and cgroup.kill KILLs them. README:64-66 now says so.

  • Note folders as an attack path. A note only decides whether heavy runs docker ps --filter label=fork-kit.heavy.owner=uid=U,scope=S. Removal still needs an exact label match, re-checked with docker inspect, and the sweep never reads notes. So a forged or extra note costs at most one Docker query. It can never remove a container heavy does not own. A deleted note means heavy skips Docker and leaves the container for the sweep, and only the same user can delete one. I probed this with temp roots (RUNTIME_ROOT/STATE_ROOT overridden):

    • a symlinked ~/.local/state or symlinked labelled/: refused by lstat, and heavy falls back to the other folder
    • a planted symlink as the note: O_NOFOLLOW gives ELOOP, so the note goes to the state folder, and forget unlinks only the link
    • a group-writable state/heavy: refused
    • a wrong HEAVY_MARKS: docker-label deletes its own notes and warns

    All of these fail closed.

  • docker-label fails closed. I checked this with Docker 29.1.3: docker create --label "" fails in the CLI's flag check (invalid label '': empty name) before any daemon call. The --value caveat is documented.

  • State question.

    • Runs again: the same note is opened again (no O_TRUNC/O_EXCL, harmless).
    • Killed after the note, before the container: heavy asks Docker, finds nothing, and forgets the note.
    • Container started but no note: only possible when neither folder reaches heavy. docker-label warns and the sweep removes the container.
    • Old notes: same /run/user path, so nothing changes.
    • Missing state folder: made. Folder with bad permissions: skipped. No folders at all: heavy asks Docker after every run.
    • Upgrade, running old heavy with new docker-label: no HEAVY_MARKS, so the note goes only to /run/user, as before.
    • Nested heavy: execvpe keeps the outer HEAVY_MARKS, which is correct. HEAVY_KEEP=1 nested gets its own via give_marks.
  • Flake: heavy queue.test.py test_a_waiter_killed_with_9_frees_its_place (queue lock stayed taken) #569 claim: confirmed. Run 44654650190 attempt 1 (PR cleaner: kit list and example machine file show every rule (#491) #564) checked out 1eddddf = merge of 5a88292 into 772fcaf. That base does not contain c09ed55 (fork-kit/heavy: the queue tests' own look waits for the lock in real time (#551) #560). On main, live() takes the lock on the real clock (30 s wait). I checked every remaining use of the fake-clock self.q lock in the real-process tests. test_a_crashed_job_frees_its_reservation calls decide() only after the caller printed admitted, and the caller drops the lock before that print (return t leaves _Locked first). So no fake-clock wait races a live holder. On main the flake could only come back if a real process held the lock for more than 30 s, which is not plausible here.

  • Tests (all gated, under heavy).

    • sweep.test.py: 78 OK (1 skipped)
    • queue.test.py: 70 OK
    • install.test.py: 16 OK, and it left no note
    • heavy.test.py: the 9 unit tests OK. The 50 real-manager tests skip under heavy by design, and PR CI ran them green (Fork kit tests 1-3, as root).

Blocking

None.

Major

None.

Minor

  1. bin/heavy:378 (own_folder, make_base=True): os.makedirs follows $HOME. Scenario: heavy runs as root with a user's HOME (for example sudo -E heavy ...) and that user has no ~/.local/state. heavy then creates a root-owned ~/.local/state (and ~/.local) in the user's home. The owner check passes because it compares with uid 0. After that the user's own programs cannot write their XDG state there. Rare, but it damages someone else's home. Fix: take the home from pwd.getpwuid(os.getuid()).pw_dir, or refuse to make a base whose parent this uid does not own.
  2. bin/heavy:287-288 and stop_scope bin/heavy:330-336: without pidfds the TERM phase still waits the full grace (30 s) with nothing sent. Before this PR it sent TERM by pid. Python before 3.9 has no os.pidfd_open even on a 5.14+ kernel (for example Python 3.8 with a 5.15 HWE kernel). README:64 says only "before Linux 5.3", but the docstring also says "Python before 3.9". Suggest: skip the TERM wait when nothing could be signalled (go straight to cgroup.kill), and name Python 3.9 in the README. This path only runs when systemctl stop failed.

Nits

  • Notes in ~/.local/state/heavy/labelled/ survive reboots, unlike /run/user (tmpfs). A double kill -9 leaves 0-byte notes that are never pruned. They are harmless, but the sweep could drop notes whose scope no longer exists.
  • note_in (lib/heavy_sweep.py:1195) never makes the base, but own_folder does (make_base). That is fine because heavy runs first. The docstrings say "the same rule"; one line saying docker-label never makes ~/.local/state would help.

Read-only review: nothing pushed, nothing installed.

@scuttletoby

Copy link
Copy Markdown
Owner Author

Review lens B (correctness, general vs project, tests): SAFE

Head 47283265. I read #569, #744, both #727 reviews and the whole diff. CI is green on this head.

Blocking: none.
Major: none.

What I ran (temp worktree, each run gated on t3-capacity)

  • Under heavy: queue.test.py 70 OK, sweep.test.py 78 OK (1 skipped), install.test.py 16 OK.
  • heavy.test.py with HEAVY_REAL_TESTS=1: 59 OK in 57 s. It refuses to run inside heavy by design ("run this file without heavy"), so I ran it directly. Every command it starts gets its own heavy scope.
  • The three real tests that touch the new code (the guard wait, the state-folder note, the guard's signals): 5 more runs each, all OK.

Does each fix go red when removed? (13 changes, one per copy)

Item Change made Result
3 signal_in: put back the os.kill(pid) fallback red: test_without_pidfds_nothing_is_signalled_by_pid (both cases)
4 done(): drop the while os.read(self.alive, 1) wait red: test_heavy_ends_only_after_its_guard (real systemd)
5 install test: drop --owner-pid (run under the installed heavy) red: "the test left a note behind"
7 queue.test.py:594: wait(timeout=60) back to wait() red: Hygiene finds queue.test.py:594 wait()
7 read_line: drop the p.kill() on timeout red: test_read_line_fails_instead_of_hanging
8 give_marks: keep an outer HEAVY_MARKS red: test_the_command_gets_heavy_marks_only_from_its_own_heavy
8 labelled: read the first folder only red: the marks-folder test
8 forget: clear the first folder only red: the marks-folder test
8 marks_dirs: leave the state folder out red: the marks-folder test
8 state_marks_dir: make_base=False red: the marks-folder test
8 note_label: no check against HEAVY_MARKS red: test_the_note_goes_where_heavy_reads_it
2 owner_value: old refusal text red: test_a_process_that_left_heavys_scope_under_a_shell_is_told_to_name_its_owner
7 (gap) add p.stdout.readlines() and p.communicate('x') to queue.test.py stays green (minor 1)

Items 1 and 6 are README-only. I checked their text against the code (below).

Is each item fixed at the root?

  1. cgroup.kill also kills sudo/setuid children. The README now says so and gives the reason. True to kill_cgroup.

  2. A refused docker-label. I checked it with Docker 29.1.3: docker run --label "" fails flag parsing ("invalid label '': empty name") before it contacts the daemon, so no container starts. --label "fork-kit.heavy.owner=" is accepted, which is what the README's --value warning is about. The refusal prints nothing on stdout (tested), and the new message names --owner-pid. The README is true.

  3. Pid reuse. signal_in now returns at once without pidfd_open, and skips a pid whose pidfd_open fails. os.kill in bin/heavy now only reaches heavy's own unreaped child or its probe, never a pid read from cgroup.procs. No reuse window is left. The cost: on Linux < 5.3 or Python < 3.9 no TERM is sent by hand, and the KILL needs cgroup.kill. The README says so.

  4. done()'s wait is now pinned by a test. Removing the wait goes red (above).

  5. The install note. Fixed. The test now checks both folders.

  6. README. The command refuses to start, not the guard. Now correct.

  7. Timeouts. I grepped all four files: every wait, communicate, subprocess.run and stdout read has a timeout or goes through read_line. The Hygiene test catches a missing one with no false alarms today. Gaps are in minor 1.

  8. A note that never reaches heavy. heavy reads both folders, passes HEAVY_MARKS (device:inode), and docker-label writes only into a folder heavy reads. Otherwise it removes its stray note and warns. Every case fails safe: at worst a leak to the sweep, never a wider removal. Removal is still by exact label (remove_containers). On the state question:

    • Runs again: the same note is written again.
    • Old heavy: no HEAVY_MARKS, so the note goes to /run/user only, as before.
    • Empty state: heavy makes the missing state folder.
    • Bad folder permissions: that folder is skipped.
    • Neither folder: heavy asks Docker after every run.

    All of these are tested. HOME="" resolves to /, so /.local/state cannot be made and the folder is skipped (checked).

README vs code

  • --owner-pid, the --value exit code (label_main returns 1 with empty stdout), HEAVY_MARKS as device:inode, and the fallback folder ~/.local/state/heavy/labelled/ all match bin/heavy and lib/heavy_sweep.py. One wording nit is in minor 3.

#569: closing with no code change is right

General vs project

No personal names, paths, hosts, VM ids or project names in the diff (grepped). Everything is machine-wide heavy behaviour.

Flakiness under load

Nothing new looks flaky. The new guard test's p.wait(timeout=2) expects a timeout while the guard is stopped, so it cannot pass early. One race is possible (minor 2).

Minor

  1. fork-kit/heavy/tests/heavy.test.py:1070-1074: the Hygiene check has gaps.
    • communicate(x) with a positional argument passes as if it had a timeout, but for communicate the first positional argument is input.
    • stdout.readlines(), any read of stderr, for line in p.stdout, from subprocess import run, and addCleanup(subprocess.run, ...) are not checked.
    • I added p.stdout.readlines(); p.communicate('x') and the test stayed green.
    • None of these forms is in the files today, so nothing hangs now. Adding them would make "new ones cannot creep in" true. Suggested changes:
      • for communicate, require the timeout= keyword or a second positional argument;
      • add readlines and stderr;
      • flag For loops over *.stdout.
  2. heavy.test.py:360 (new) and :429 (old): [guard] = self.guards() right after the up line.
    • The guard renames itself to scope-guard (prctl, bin/heavy:556) after its double fork, and heavy does not wait for that before it starts the command.
    • On a starved CPU the up line can arrive first. Then guards() returns [] and the unpack errors.
    • It passed every time here (6 runs). wait_for(lambda: len(self.guards()) == 1, what='the guard') would close it.
  3. README.md:350: "the sweep only reports such a container" is true only while the container runs. lib/heavy_sweep.py:828 skips a stopped container with an empty or bad owner label without a word. Suggested: "the sweep only reports it while it runs".
  4. lib/heavy_sweep.py:1214: "Without HEAVY_MARKS (an older heavy ...) heavy asks Docker after every run anyway" is not true of main's heavy (heavy: guard tests and hardening from the #687 reviews #727). That version asks only when its /run/user note exists. The behaviour is unchanged from main, so only the docstring is off.
  5. Notes in ~/.local/state survive reboot. Unlike /run/user, nothing ever prunes them. In the both-killed case they pile up as 0-byte files (harmless, as the PR body says). The leftover sweep could delete notes whose scope no longer exists.
  6. bin/heavy:404, nit: with HOME unset and a uid with no passwd entry, expanduser('~') returns '~'. make_base=True would then make a relative ./~/.local/state in the command's working folder. An os.path.isabs(base) check would close it. It is very unlikely under a systemd user manager.
  7. Nit: the real heavy.test.py runs use the tester's real HOME, so they make ~/.local/state/heavy/labelled there. Only the end-to-end test uses a temp HOME. That is harmless, because the installed new heavy makes the folder anyway.

🤖 Generated with Claude Code

@scuttletoby
scuttletoby merged commit 60d0a72 into main Nov 21, 2026
30 checks passed
scuttletoby added a commit that referenced this pull request Nov 21, 2026
- The fallback note folder (~/.local/state/heavy) is used only in a home the
  effective user owns ($HOME, else the passwd home). As root with a user's
  HOME (sudo -E) it never makes a root-owned folder there. With no usable home
  it refuses instead of writing into the working dir.
- stop_scope waits the grace time only after a step that sent a signal.
- The leftover sweep removes old empty docker-label notes of scopes that are
  gone (not listed when it began, minAgeSeconds old). A live run's note stays.
- Tests: the hygiene check finds every untimed read form; the real tests wait
  for the guard's rename and use a temp HOME. README/docstring wording fixed.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
scuttletoby added a commit that referenced this pull request Nov 21, 2026
#569: the CI failure tested a merge onto a base from before #560. There, the
test's live() look ran on the fake clock, so its 30 s lock wait passed in no
real time. #560 already moved live() to the real clock. Reproduced: 3 of 50
runs failed on the old base with 8 CPU hogs, 0 of 50 on this branch. The lock
release after SIGKILL is the kernel's flock drop, and tests on main cover it.

#744:
- signal_in signals only through a pidfd; no fallback to kill(pid)
- docker-label notes go to ~/.local/state/heavy/labelled when the /run/user note
  cannot reach heavy; heavy passes the folders it reads as HEAVY_MARKS
- the refusal under a shell after leaving heavy's scope names the cause
- tests: done() waits for the guard; the install test leaves no note; every
  read and wait of a test process has a timeout, checked by an AST test
- README: cgroup.kill reaches sudo/setuid processes; who refuses to start;
  the --value exit code

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
scuttletoby added a commit that referenced this pull request Nov 21, 2026
- The fallback note folder (~/.local/state/heavy) is used only in a home the
  effective user owns ($HOME, else the passwd home). As root with a user's
  HOME (sudo -E) it never makes a root-owned folder there. With no usable home
  it refuses instead of writing into the working dir.
- stop_scope waits the grace time only after a step that sent a signal.
- The leftover sweep removes old empty docker-label notes of scopes that are
  gone (not listed when it began, minAgeSeconds old). A live run's note stays.
- Tests: the hygiene check finds every untimed read form; the real tests wait
  for the guard's rename and use a temp HOME. README/docstring wording fixed.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
scuttletoby added a commit that referenced this pull request Nov 21, 2026
#569: the CI failure tested a merge onto a base from before #560. There, the
test's live() look ran on the fake clock, so its 30 s lock wait passed in no
real time. #560 already moved live() to the real clock. Reproduced: 3 of 50
runs failed on the old base with 8 CPU hogs, 0 of 50 on this branch. The lock
release after SIGKILL is the kernel's flock drop, and tests on main cover it.

#744:
- signal_in signals only through a pidfd; no fallback to kill(pid)
- docker-label notes go to ~/.local/state/heavy/labelled when the /run/user note
  cannot reach heavy; heavy passes the folders it reads as HEAVY_MARKS
- the refusal under a shell after leaving heavy's scope names the cause
- tests: done() waits for the guard; the install test leaves no note; every
  read and wait of a test process has a timeout, checked by an AST test
- README: cgroup.kill reaches sudo/setuid processes; who refuses to start;
  the --value exit code

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
scuttletoby added a commit that referenced this pull request Nov 21, 2026
- The fallback note folder (~/.local/state/heavy) is used only in a home the
  effective user owns ($HOME, else the passwd home). As root with a user's
  HOME (sudo -E) it never makes a root-owned folder there. With no usable home
  it refuses instead of writing into the working dir.
- stop_scope waits the grace time only after a step that sent a signal.
- The leftover sweep removes old empty docker-label notes of scopes that are
  gone (not listed when it began, minAgeSeconds old). A live run's note stays.
- Tests: the hygiene check finds every untimed read form; the real tests wait
  for the guard's rename and use a temp HOME. README/docstring wording fixed.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
scuttletoby added a commit that referenced this pull request Nov 21, 2026
#569: the CI failure tested a merge onto a base from before #560. There, the
test's live() look ran on the fake clock, so its 30 s lock wait passed in no
real time. #560 already moved live() to the real clock. Reproduced: 3 of 50
runs failed on the old base with 8 CPU hogs, 0 of 50 on this branch. The lock
release after SIGKILL is the kernel's flock drop, and tests on main cover it.

#744:
- signal_in signals only through a pidfd; no fallback to kill(pid)
- docker-label notes go to ~/.local/state/heavy/labelled when the /run/user note
  cannot reach heavy; heavy passes the folders it reads as HEAVY_MARKS
- the refusal under a shell after leaving heavy's scope names the cause
- tests: done() waits for the guard; the install test leaves no note; every
  read and wait of a test process has a timeout, checked by an AST test
- README: cgroup.kill reaches sudo/setuid processes; who refuses to start;
  the --value exit code

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
scuttletoby added a commit that referenced this pull request Nov 21, 2026
- The fallback note folder (~/.local/state/heavy) is used only in a home the
  effective user owns ($HOME, else the passwd home). As root with a user's
  HOME (sudo -E) it never makes a root-owned folder there. With no usable home
  it refuses instead of writing into the working dir.
- stop_scope waits the grace time only after a step that sent a signal.
- The leftover sweep removes old empty docker-label notes of scopes that are
  gone (not listed when it began, minAgeSeconds old). A live run's note stays.
- Tests: the hygiene check finds every untimed read form; the real tests wait
  for the guard's rename and use a temp HOME. README/docstring wording fixed.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant