Skip to content

fix(skills): count the CPUs of a cgroup v2 quota for the TLC workers - #332

Merged
ThomasK33 merged 2 commits into
mainfrom
fix/check-cpu-quota
Nov 4, 2026
Merged

ThomasK33 merged 2 commits into
mainfrom
fix/check-cpu-quota

Conversation

@ThomasK33

@ThomasK33 ThomasK33 commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

Follow-up to #330.

What changed

check.sh now counts the CPUs of a cgroup v2 quota when it gives TLC workers to the runs that expect pass (.agents/skills/verify-session-lifecycle/scripts/check.sh).

  1. Before, check.sh read the CPU count from getconf _NPROCESSORS_ONLN. getconf counts every online CPU, also in a container whose cgroup v2 quota allows fewer. fix(host): stop the marker watch once the host has a new parent, give long TLC runs more workers #330 made this worse, because it divides that count among the runs that expect pass. My dev container has 96 online CPUs and a quota of 32 (/sys/fs/cgroup/cpu.max reads 3200000 100000). With CHECK_JOBS=90, the 15 runs that expect pass each got 6 TLC workers: 90 threads for 32 CPUs.
  2. Now check.sh reads /sys/fs/cgroup/cpu.max. When it reads <quota> <period>, the CPU count is the smaller of getconf and ceil(quota / period). When the file is missing (macOS, cgroup v1, a host without a quota file) or reads max, getconf stays.
  3. check.sh now prints one line before the TLC runs: CPUs: <n>. TLC workers of a run that expects pass: <m>. It shows the count in local runs and in the CI logs.
  4. coverage.json sync for the check.sh hash.

No change to the model, the facts, the CLI or the product code. CI runners have 4 vCPUs and no smaller quota, so CI gets the same workers as before.

Validation

  1. I ran the new block alone with a test file in place of cpu.max:

    cpu.max CPUs (getconf 96)
    max 100000 96
    3200000 100000 32
    150000 100000 2
    50000 100000 1
    25000000 100000 96
    abc 100000 96
    missing 96, with no error output
  2. CHECK_SHARD=2/8 CHECK_JOBS=12 check.sh --update-coverage on this machine printed CPUs: 32. TLC workers of a run that expects pass: 16. The 2 runs that expect pass ran with 16 workers (with 16 workers in their tlc.out). Before this change, they would have got 48 (96 / 2). All results were as expected (rc 0).

  3. check.sh --drift-only: Covered code matches the sync record.

  4. bash -n check.sh and shellcheck -S warning check.sh (0.11.0): clean. oxfmt --check .: clean.

  5. CI at f10d8d1: all 25 checks pass. The 8 lifecycle-model shares ran all 90 runs (coverage.json differs from the base) and took 7 to 31 min. Share 5 printed CPUs: 4. TLC workers of a run that expects pass: 2., the same workers as before this change.


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: xhigh

check.sh read the CPU count from getconf, which counts every online CPU,
also in a container whose cgroup v2 quota allows fewer. In a container
with 96 online CPUs and a quota of 32, the 15 runs that expect pass got
6 TLC workers each, 90 threads for 32 CPUs. check.sh now takes the
smaller of getconf and the quota in /sys/fs/cgroup/cpu.max, rounded up,
and keeps getconf when the file is missing or reads max. It prints the
CPU count and the workers of a run that expects pass.
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 4, 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-11-04T20:54:27.180769Z f10d8d1 Manual request
🔒 Security Review ✅ Completed 2026-11-04T20:56:06.327318Z f10d8d1 Manual request
ℹ️ 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: f10d8d1f87

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review

Security review completed. No security issues were found in this pull request.

Reviewed commit: f10d8d1f87

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@ThomasK33
ThomasK33 added this pull request to the merge queue Nov 4, 2026
Merged via the queue into main with commit d728faa Nov 4, 2026
26 checks passed
@ThomasK33
ThomasK33 deleted the fix/check-cpu-quota branch November 4, 2026 22:05
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