Skip to content

Cap each guarded job's CPU where the user manager delegates cpu - #158

Merged
seathatflowsinourveins merged 2 commits into
mainfrom
claude/bounded-run-cpu-quota-20260924
Sep 24, 2026
Merged

seathatflowsinourveins merged 2 commits into
mainfrom
claude/bounded-run-cpu-quota-20260924

Conversation

@seathatflowsinourveins

Copy link
Copy Markdown
Collaborator

Summary

  • adoption/tools/ecosystem-bounded-run adds CPUQuota to the scope when the user manager delegates the cpu controller, which is systemd's default from v252.
    • The default is (online CPUs − 2) × 100%. ECOSYSTEM_JOB_CPU_QUOTA overrides it.
    • Inside the scope, the job's own cpu.max must equal the request, or the runner exits 78 before the command runs. This is the same pattern as the existing memory.max and pids.max checks.
  • Without cpu delegation (systemd < 252, e.g. Ubuntu 22.04):
    • The default quota is skipped with one stderr note, and the memory, task and runtime limits still apply.
    • An explicit quota is refused with 78, because it cannot be enforced.
    • A controllers file that cannot be read means a wrong manager path, and is refused with 78.
  • gitleaks-guarded unsets ECOSYSTEM_JOB_CPU_QUOTA, so every scan gets the runner default.
  • Provenance: the runner is byte-identical to the authoring host's copy, and gitleaks-guarded still differs from its source only on lines 5-6.
  • Closes the "CPU limit in ecosystem-bounded-run" needed-now item in docs/next-host-stages.md, apart from the interactive-contention comparison that page names.
    • The per-job default leaves two CPUs free, so it does not throttle the measured 8.4-core Gitleaks scan.
    • macOS installs neither script, so it has no CPU cap. This is recorded as a limitation in adoption/tools/README.md.
  • Scope:
    • Install content only. It touches no TRUST_PATHS file and no verdict rows (verdict-review-gate dry run: no verdict rows changed (base 8eacd8b60f1d)).
    • It rides in v2026.09.23.2.
    • Coordinated with the catalog finalization board, Grand catalog finalization (2026-09-23): live board #140.

Tests: tests/test_adoption_guarded_runners.py, BoundedRunCpuQuotaTests

These are local integration checks. The kernel-level quota tests are gated on a host whose user manager delegates cpu.

  • The default and an explicit 50% reach the job's own cpu.max.
  • Stand-in launchers are refused with 78:
    • one that drops CPUQuota, run in a fresh slice so the missing-cpu.max branch is deterministic;
    • one that alters it to 37%, which hits the mismatch branch.
  • No-delegation path: the default is skipped with the note, and an explicit quota is refused with 78.
  • An unreadable controllers file is refused with 78.
  • 0%, max, 150, 1000000% and -5% are each refused with 78.
  • Mutation-checked on the authoring host. Each of these runner edits fails at least one test:
    • removing the in-scope check;
    • tolerating a missing cpu.max;
    • not refusing an explicit quota without delegation;
    • dropping the CPUQuota property;
    • using a CPUs − 1 default;
    • opening the quota regex;
    • reading an unreadable controllers file as "no cpu".

Verification (authoring host, WSL2, systemd 255, 24 CPUs)

  • python3 -m unittest: 3593 tests OK (363 skipped), run in a bounded scope.
  • tests.test_adoption_guarded_runners: 31 OK, on the containment branch.
  • Each of these exits 0:
    • scripts/validate.py
    • scripts/host_receipts.py validate
    • scripts/release_due.py --strict-if-repinned origin/main, with due: []
    • scripts/landscape.py
    • validate_catalogs, validate_foundation and validate_convergence --all-recorded
    • build_verdicts, component_matrix, new_host_grand_list, gap_crosswalk, gap_wave_ledger and build_ecosystem, each with --check
    • audit_reports --check
  • zizmor --offline --persona regular --strict-collection .github/workflows: exit 0.
  • Guarded gitleaks git --log-opts=origin/main..HEAD: no leaks.
  • Host-side evidence (the private ecosystem record): 24/24 real-cgroup stability checks, and two independent Opus/max review rounds with all findings addressed. The last round's lows (fail closed on an unreadable controllers file, the deterministic dropped-quota check) are included here.

Not established

  • There has been no run on a real systemd < 252 host. The no-delegation path is exercised through an instrumented controllers file.
  • The Delegate=cpu memory pids drop-in remedy in the README has not been run.
  • The aggregate effect of several concurrent bounded jobs on interactive CPU pressure is the named, unrun comparison.

🤖 Generated with Claude Code

ecosystem-bounded-run now adds CPUQuota to the scope when the user
manager delegates the cpu controller, which is systemd's default from
v252. The default is (online CPUs - 2) x 100%, and
ECOSYSTEM_JOB_CPU_QUOTA overrides it. Inside the scope, the job's own
cpu.max must equal the request, or the runner exits 78 before the
command runs, the same way it already checks memory.max and pids.max.

Without cpu delegation, for example on Ubuntu 22.04, the default quota
is skipped with a note while the memory, task and runtime limits still
apply. An explicit quota is refused with 78, because it could not be
enforced.

gitleaks-guarded unsets ECOSYSTEM_JOB_CPU_QUOTA, so every scan gets the
runner default. The runner is byte-identical to the authoring host's
copy, and gitleaks-guarded still differs from its source only on lines
5-6.

New tests: the default and an explicit quota reach cpu.max; launchers
that drop or alter CPUQuota are refused with 78; the no-delegation path
skips the default and refuses an explicit quota; invalid quotas are
refused. Each was checked by mutation. The README records the systemd
252 precondition, what the per-job default does not throttle (the
measured 8.4-core scan), and that macOS installs neither script, so it
has no CPU cap.

Closes the "CPU limit in ecosystem-bounded-run" needed-now item in
docs/next-host-stages.md, apart from the interactive-contention
comparison that page names.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-24T03:48:33.624824Z a7f2be1 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

…y timeout

These are the three runner mutants that survived review of #158. Each
now fails a test:
- a controllers list of "cpuset memory pids" must count as no cpu
  delegation;
- instrumented CPU counts of 1, 2 and 3 must give the one-CPU floor,
  and 4 must give 200%;
- a stalled `systemctl --user show` must be refused with 78 inside the
  5 s timeout.

The README completes the mutation list, and notes that hosted runners
have no user manager, so the executed containment evidence comes from a
host with one.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@seathatflowsinourveins
seathatflowsinourveins merged commit 7c211ad into main Sep 24, 2026
22 checks passed
@seathatflowsinourveins
seathatflowsinourveins deleted the claude/bounded-run-cpu-quota-20260924 branch September 24, 2026 04:11
seathatflowsinourveins added a commit that referenced this pull request Sep 24, 2026
* Point new machines at the attested release v2026.09.24.1

v2026.09.24.1 (tag object ec94e8a -> 81385fe) carries the working
plugin-install commands (#161), the guarded-job CPU cap (#158) and the
release-bound no-git archive check with release_due content-drift
reporting (#163). release_due --strict reports current.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* Set the manifest's updated_at to the re-pin date (Codex review)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: seathatflowsinourveins <234074349+seathatflowsinourveins@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 (1M context) <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

Development

Successfully merging this pull request may close these issues.

1 participant