Skip to content

Stop the no-CPU test slice so guarded-runner runs stop leaking systemd units - #229

Merged
seathatflowsinourveins merged 1 commit into
mainfrom
claude/nocpu-slice-cleanup-20260924
Sep 25, 2026
Merged

seathatflowsinourveins merged 1 commit into
mainfrom
claude/nocpu-slice-cleanup-20260924

Conversation

@seathatflowsinourveins

Copy link
Copy Markdown
Collaborator

tests.test_adoption_guarded_runners.BoundedRunCpuQuotaTests.test_scope_with_a_dropped_or_altered_cpu_quota_is_refused_with_78 left one empty systemd user slice on the host every time it ran. Its dropped-CPUQuota stand-in launcher placed the scope in ecosystem-check-nocpu-$$.slice (the launcher's PID) and nothing stopped it. systemd keeps an emptied transient slice loaded, so the units piled up: a read-only host audit on the WSL2 host found 63 empty ecosystem-check-nocpu-*.slice units (Tasks 0, Memory 0B) spanning 21 hours.

Change. The slice name is fixed per test process (NOCPU_SLICE = ecosystem-check-nocpu-<test pid>.slice). The test registers a cleanup stop, then stops the slice itself and asserts its ActiveState is inactive. The slice is still one that no CPUQuota unit touches, so the refusal it exercises (cpu.max is not enforced) is unchanged. manifests/evidence.json re-registers the file's hash.

Checks (WSL2 Ubuntu 24.04, systemd 255, cgroup v2 with cpu delegated, Python 3.13, on 636751a):

  • Leak reproduced and fixed: 62 leaked slices before. One run of the original test method: 63. The fixed BoundedRunCpuQuotaTests class (7 tests OK): still 63. The user journal shows Created slice ecosystem-check-nocpu-1273346.slice with no removal for the original, and Created then Removed slice ecosystem-check-nocpu-1273365.slice for the fix.
  • python3 -m unittest tests.test_adoption_guarded_runners: 33 tests, OK (skipped=1).
  • scripts/validate.py passed (5338 hashed files, 145 receipts), scripts/evidence_manifest.py --check passed, scripts/verdict_review_gate.py --base origin/main reports no verdict rows changed, and the gitleaks 8.30.1 pre-commit hook found no leaks. The full python3 -m unittest suite and the other validate.yml steps were not run locally; CI runs them.
  • Independent read-only review (Claude evidence-reviewer): no defects. It noted one residual edge, not a defect: if a run is killed before cleanup and the OS later reuses the same PID for another test run, that run would reuse the stale slice (which still carries no CPUQuota). Cross-family Codex review was skipped because of a usage limit through 2026-09-30.

The 63 leaked slices on the audited host were stopped separately, and only those with 0 tasks.

🤖 Generated with Claude Code

The dropped-CPUQuota stand-in launcher placed its scope in
ecosystem-check-nocpu-$$.slice and nothing stopped it. systemd keeps an
emptied transient slice loaded, so each run of
test_scope_with_a_dropped_or_altered_cpu_quota_is_refused_with_78 left one
empty slice on the host (63 had accumulated on the WSL2 host).

The slice name is now fixed per test process, the test registers a cleanup
stop, and it asserts the slice is inactive after stopping it. The slice is
still fresh (no CPUQuota unit touches it), so the dropped-quota refusal is
unchanged. manifests/evidence.json carries the file's new hash.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@seathatflowsinourveins
seathatflowsinourveins merged commit aa0812b into main Sep 25, 2026
22 checks passed
@seathatflowsinourveins
seathatflowsinourveins deleted the claude/nocpu-slice-cleanup-20260924 branch September 25, 2026 05:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant