claude agent, operated by paul@keymail.devoperated by paul@keymail.devsession 9cb481b6 · claude-code/2.1.321 · DOCS-T1
On hosted CI (kernel 7.0, aarch64, many test packages side by side) the pause tests in internal/runner/pause fail with ErrBusy in about 0.5 s, then usually pass on their one retry. a1cca3aa made ErrBusy say why, and the run named it:
6947 (equipo-namespac, depth 2) is ours but its pid namespace is unreadable
9775 (3, depth 3) is ours but its pid namespace is unreadable
These are other tests' sandboxes: same uid, a pid namespace at or below the paused sandbox's depth, and /proc/<pid>/ns/pid unreadable to us. held.unreadable cannot tell such a process from a member, so it refuses the pause. That is the conservative choice, but a production runner may hit it too: another step's sandbox (Engineering, Review, checks, a render) running as the runner user while Design's work snapshot pauses. The render would then end busy for as long as the other sandbox runs.
The tests are not quarantined: they passed on retry in this run. Possible directions (not built here): tell members apart by something readable (for example containment's own record of the sandbox's processes, or the status file's NSpid under the sandbox root's pid), or retry the pause a few times before refusing. Up to Paul or the next build; this branch only adds the diagnostic.
claude agent, operated by paul@keymail.devoperated by paul@keymail.devsession 9cb481b6 · claude-code/2.1.321 · DOCS-T1
Fixed in 1069b2f5: an unreadable process of ours, as deep as the sandbox, is now placed by its parent (its /proc stat is always readable) instead of refusing the pause. Witnesses: TestHoldIgnoresAnUnreadableSandbox and TestHoldStopsUnreadableMembers, through a seam that makes chosen namespaces unreadable; mutations of the rule fail them. Hosted CI passed on 1069b2f5.
Still seen once there, passing on retry at load 14: TestHoldStopsEveryWriter and TestHoldReturnsWorkError hit the full 10 s bound ("not all stopped within the bound"). Before the fix those runs refused within milliseconds on the unreadable sibling, so this is the next limit they now reach under load. One candidate: a member that never reads stopped (a vfork parent waits in D while its child is stopped before exec). Not chased here.
claude agent, operated by paul@keymail.devoperated by paul@keymail.devsession 9cb481b6 · claude-code/2.1.321 · DOCS-T1
Withdrawn. Astra reviewed 1069b2f5 and said NOT READY; the coordinating session ruled to take the placement out. eb454aa8 restores the refusal: an unreadable process of ours, as deep as the sandbox, refuses the pause with ErrBusy naming it. The tests now assert that refusal (TestHoldRefusesAnUnreadableSandbox, TestHoldRefusesUnreadableMembers). The success-path tests retry only while the refusal names another test's process (holdAmid).
Astra's findings, as the design for doing it properly later:
Important: a stale parent can classify a live member as outside. The walk read the child's parent pid P and then classified P without pinning P's identity or checking the child's parent again. If P exits, is reaped and its pid is reused outside, placed(P) answers "outside" with no error (only errVanished retried). The pass then skips the child without unsettling, and a non-dumpable writer keeps running. The pidfd and start-time checks never cover a negative classification.
Important: the copy's re-check cannot rescue that. It compares metadata (device, inode, size, mtime, ctime), not content. worksnap_linux.go already admits a same-size write within one timestamp tick goes unseen, and writes through an already writable shared mapping change bytes without moving those fields (Astra reproduced the latter on a memfd). An escaped writer can write during the copy without detection, so "the copy's re-check still refuses any change" was too strong.
Minor: the two witnesses tested discrimination, not the race. Neither forced a parent replacement between reads, nor exercised same-size or mapped writes.
What is sound: ordinary reparenting, subreapers and a step's downward setns do not create an outside ancestor, and non-dumpability alone does not either. Pid namespace membership cannot move upward (pid_namespaces(7)). The flaw is trusting separately sampled identities.
Design for later:
Validated ancestry. For each hop, open a pidfd on the parent and pin its start time. Classify it. Then re-read the child's ppid and confirm the parent's pidfd has not exited and its start time is unchanged. Accept "outside" only when every hop validates; otherwise refuse (ErrBusy).
A deterministic race regression test: through a seam, replace the parent between the ppid read and its classification (exit, reap, reuse the pid outside) and require a refusal, never "outside".
Content checks, or a design that does not rely on the metadata re-check, if the pause is ever to hold against writers it did not stop.