Report cgroup limits in computer_info and huskinfo - #131
Conversation
|
@Audgui-Byte is attempting to deploy a commit to the hotragn's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
You took the follow-up and went further than it asked. The two Vercel checks are ours again — see #130, which documents exactly that so the next person is not misled — and I have approved the workflow run, so the real matrix has gone green. I verified this against real cgroups rather than reading it, because the whole point of #119 is that the old code looked plausible and reported the host. In a container limited the way husk limits one: That is the bug, closed. The fractional CPU survives as And the two implementations agree. I ran On an unconstrained host (WSL2, no cgroup limits) the probe returns The v1 unlimited sentinel is the detail I would have missed. One thing I would change, not blockingSeveral assertions match the source text of the shell one-liner: expect(PROBE_COMPUTER_INFO).toContain('quota / period < host');
expect(PROBE_COMPUTER_INFO).toContain('printf "%.6g\n", quota / period');Those break when someone reformats the awk without changing what it does, and they pass if the logic is wrong but the substring survives. The integration cases underneath them already prove the behaviour against synthetic cgroup trees, and those are the ones with teeth — twelve layouts including the combined
Gating the integration block on Note for the maintainer, not for youYour run needed manual approval again. GitHub gates workflow runs per-PR for outside contributors until the setting is changed, so this will keep happening and is not something you can avoid from your side — I will raise it separately. |
|
Thanks for the real-container verification and for merging this. Your point about the source-text assertions is fair: they freeze the awk spelling without proving its behavior. I have removed the two new implementation-string tests locally while retaining the 12 behavioral cases and their expected values. The focused suite passes (6 passed, 12 Linux-only skips on Windows), and the separate shell-fixture runner passes all 24 runs. That cleanup is local only; it is not part of the merged commits. The lesson I am taking into future contributions is to test the result a caller depends on, and to give duplicated rules a behavioral check against explicit expected values. Thanks for making the review concrete. |
What does this change?
For the case in #119 (10 host CPUs, a 2-CPU / 2-GiB container), both the shared fallback probe and sandbox
huskinfonow reportcpus 2andmemory 2048MB.Read finite cgroup v2 limits, with v1 CPU and memory fallbacks, and use the smaller of host capacity and the limit. Preserve fractional CPU quotas and zero-byte memory limits. Unlimited, missing and malformed limits fall back to host information, or
?when neither source is available. Memory no longer requiresfree. Failed resource-file reads do not stop the sandbox script.Why?
Host
/procvalues can overstate what the container can use. Agent and MCP already share the core probe; the separate sandbox script needs the same behavior. A Linux-only shell fixture matrix exercises both paths to detect drift.Fixes #119. Scope is the standard cgroup namespace root. This does not resolve arbitrary
/proc/self/cgroupmemberships, stricter ancestor limits or additional cpuset constraints beyond the host count fromnproc.How to test
npm run build:packages npm run typecheck npm test npm run driftWindows / Node 24.19.0: all 11 package builds and workspace typechecks passed; tests: 1,677 passed, 34 skipped, 0 failed. The host
NO_COLORvariable was removed only from the child test environment to allow the existingFORCE_COLORtest to run. Drift checks passed.The 34 skips include the 12 new Linux-only cases. Separately executed the actual shell probes with redirected artificial cgroup/proc files under Git sh: 12 conditions × 2 paths passed, including v1 separate/combined CPU mounts, fractional and above-host limits, unlimited, zero, malformed and missing inputs. An independent fixture runner also passed 24 executions and reproduced the original 10 / unknown output. These are shell-fixture checks, not live Docker tests; Docker and WSL are unavailable on this host.
Checklist