Skip to content

feat(core): bound Linux command process trees with cgroup v2 - #405

Merged
lg2m merged 2 commits into
feat/auto-filesystem-rootfrom
feat/auto-resource-boundary
Oct 22, 2026
Merged

lg2m merged 2 commits into
feat/auto-filesystem-rootfrom
feat/auto-resource-boundary

Conversation

@lg2m

@lg2m lg2m commented Oct 21, 2026

Copy link
Copy Markdown
Collaborator

Scoped Linux commands can now receive aggregate memory, native-task and CPU-bandwidth limits through portable NativeResourceLimits. The trusted helper joins a configured cgroup before starting the payload; scripts and descendants inherit the limits. Swap is disabled, OOM kills the group, real-time scheduling is refused, and completed or cancelled commands remove their group. Empty groups left by dead owners are reclaimed without touching live owners or another PID namespace.

Limits are mandatory in the persisted request identity: omission is rejected and a retry cannot widen authority. Linux requires an explicitly delegated, identity-checked cgroup root and a private filesystem root without writable cgroup controls. Unsupported launchers/platforms refuse the request. No new dependency or per-command service/VM.

Verified: 65 focused core tests and 38 worker/process tests; explicit native delegation fixture passes thread exhaustion, kernel-recorded memory OOM, CPU controller values, cancellation, stale-group reclamation and cleanup. Disabling cgroup attachment makes that fixture fail. Formatting, lint and Clippy pass. The existing sleep allowlist only moves two line numbers; no sleeps added. Full platform checks run in CI per the requested workflow.

Native fixture: run cargo nextest run -p qq --test command_worker_client --run-ignored only -E 'test(resources::delegated_resource_scope)' inside a disposable service with Delegate=cpu memory pids, DelegateSubgroup=supervisor, its controllers enabled, and QQ_TEST_CGROUP_ROOT pointing to that service's delegated root. Ordinary CI without delegation exercises refusal, not positive resource qualification.

Fourth layer after #404. Auto still selects host authority. Shared task/server budgets, disk capacity, hardlink isolation, credential brokering, authorized egress and macOS/Windows containment remain before Auto enablement. No comparative performance claim.

@lg2m lg2m added the ci:full label Oct 21, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 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-10-21T23:33:08.059846Z 38c7880 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 usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@lg2m
lg2m added this pull request to stack #403 October 21, 2026 22:29
@lg2m

lg2m commented Oct 21, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: 38c7880c43

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

@lg2m
lg2m merged commit a0326e2 into main Oct 22, 2026
8 checks passed
@lg2m
lg2m deleted the feat/auto-resource-boundary branch October 22, 2026 01:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant