Skip to content

Cap gate command resources#138

Merged
chasebryan merged 1 commit into
mainfrom
agent/cap-gate-resources
Jul 16, 2026
Merged

Cap gate command resources#138
chasebryan merged 1 commit into
mainfrom
agent/cap-gate-resources

Conversation

@chasebryan

Copy link
Copy Markdown
Owner

Summary

  • impose inherited hard limits on every copied gate command
  • cap CPU time at 600 seconds per process, file growth at 512 MiB per file, open descriptors at 1,024, and real-user processes at 256
  • prohibit core-file output and preserve any lower inherited host ceiling
  • verify the effective ceilings in the protected helper test and document non-aggregate residuals

Verification

  • scripts/ci/check-repository
    • policy 0.2.88
    • 288 Python tests
    • Rust debug and release suites: 162 + 74 + 32 + 9 tests each
    • two relocated optimized builds matched byte-for-byte
    • 7 documentation tests
    • final policy and source-identity checks passed

Residual risk

  • these are inherited rlimits, not cgroup-wide budgets: CPU and file size apply per process and per file
  • the process ceiling counts other processes with the same real user ID, and aggregate memory, process-tree CPU, and total temporary storage remain host boundaries

Rollback

Revert this commit to remove the helper resource ceilings and related policy, tests, and documentation.

@chasebryan
chasebryan marked this pull request as ready for review July 16, 2026 01:56
@chasebryan
chasebryan merged commit 5a9cac0 into main Jul 16, 2026
7 checks passed
@chasebryan
chasebryan deleted the agent/cap-gate-resources branch July 16, 2026 01:56

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ba8ee1cd33

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

Comment thread tools/fs_sandbox.c
Comment on lines +69 to +73
if (limit.rlim_max == RLIM_INFINITY || limit.rlim_max > maximum) {
limit.rlim_cur = maximum;
limit.rlim_max = maximum;
} else {
limit.rlim_cur = limit.rlim_max;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve lower inherited soft limits

When the caller has already lowered a soft rlimit below these new caps while leaving the hard limit higher (for example a CI wrapper using a lower soft CPU or file-size limit), this code overwrites rlim_cur with maximum or the inherited hard value. That makes every sandboxed command start with more budget than the invoking environment's current limit, so the claimed preservation of lower inherited ceilings is bypassed in those runs; clamp the new hard/soft values against the inherited soft limit as well if lower caller limits should remain effective.

Useful? React with 👍 / 👎.

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