fix(podmanx,nix): move payload cgroup delegation to a never-restarted lab-payload.service holder (ADR-0059) #238
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Cloonar/coding-lab!238
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "afk/237"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Every
lab.servicerestart after the ADR-0058 deploy EBUSY-looped on dev-new becauseDelegateSubgroup=does not protect the main-process spawn: systemd clone3s the new main PID into the unit cgroup root (exec_params_needs_control_subcgrouprequiresEXEC_IS_CONTROL, which theExecStartprocess never carries) and the EBUSY is not retried — so withKillMode=processsurvivors keeping the delegating root populated, the trap re-armed on every restart. Any layout keeping controllers onlab.service's own cgroup root across restarts is structurally dead.Per the maintainer-approved direction, the delegated payload cgroup moves out of
lab.serviceinto a static, never-restarted holder unit:lab-payload.service(new,container.enable-gated):Type=exec+sleep infinity, lab service user,Delegate=yes,DelegateSubgroup=main,KillMode=process,restartIfChanged = false. Containers land under/system.slice/lab-payload.service/payloadvia--cgroup-parentin all three spawn shapes (sessions, login panes, CLI pokes) —Result.CgroupParent()contract unchanged, value changed.lab.servicelosesDelegate/DelegateSubgroupentirely; gainsWants=/After=on the holder (Wants, not Requires: a missing holder degrades to an actionable preflight refusal).cgroup-holdercheck (retirescgroup-layout) verifies the holder cgroup is delegated/writable, with hints naminglab-payload.service;setupCgroupsadopts holder-root strays intomain/, enables+memory +pidson the holder root and confirms the controllers arrive inpayload/(cgroup-delegation, name kept).cgroup-restart-safety, name kept): assertslab.service's ownsubtree_controlstays empty (the re-armed trap — issue acceptance criterion) andpayload/still carries memory+pids (a restarted holder would otherwise silently void the caps — the #205 no-false-green lesson).lab-cgroup-hygieneretargeted: clears all delegation under/sys/fs/cgroup/system.slice/lab.serviceincluding the root's ownsubtree_control— this is also the migration path off the ADR-0058 layout on the first post-upgrade start (accepted cost: pre-0059 survivor containers lose their caps, as in ADR-0058's migration).docs/ops.mdupdated.lab.servicenever delegates (both variants), holder-unit assertions (Delegate,DelegateSubgroup=main,KillMode=process,User=lab, sleep ExecStart), eval-levelrestartIfChanged == false, holder absent undercontainer.enable = false, hygiene retarget pinned.Verification
go build ./...,go test ./...,gofmt -lall green (run locally with go1.26.0; toolchain absent from the sandbox by default). Unit tests cover the new layout against fakeDeps: green path, holder missing →cgroup-holdernaming the unit, re-armed trap on lab's own root, stray adoption into holdermain/, holder-lost-delegation at Verify time, vacuous verify.golangci-lintandnix flake checkare not available in this sandbox — CI must be the gate for lint and the nixos-module eval check.systemctl restart lab) needs a real NixOS host — dev-new deploy by the maintainer, per the issue's validation note.Closes #237
🤖 Generated with Claude Code
[autoland] verdict: pass