Repository navigation
Add native jail resource limit contract - #97
Conversation
…s/src/jail_tests.rs,crates/tiny Auto-committed-on: dragonfly
Native jail resource limits are now treated as hard requirements even when the caller accepts declared enforcement for filesystem, network, or subprocess policy. The bus reuses the existing ResourceLimits type instead of a duplicate struct, and the facade refuses requests with limits before spawning when the backend cannot enforce them. Auto-committed-on: dragonfly
Tiny Sweeper reviewTiny Sweeper reviewed this change across 5 lane(s) and found 0 active actionable finding(s). Detailed lane evidence and any incomplete work are listed below. State: Incomplete Review snapshot
Completeness: Incomplete FeaturesNone identified with supported citations. TestsNo supported feature-to-test mapping was produced. Test execution is not inferred.
FindingsNo active actionable findings. Could not review: crates/tinybox-jail/src/jail.rs, crates/tinybox-jail/src/lib.rs, crates/tinybox-jail/src/mod_tests.rs, tinysweeper/description, tinysweeper/tests Before merge
How this fits togetherflowchart LR
n0["NativeJailConfig<br/>changed"]:::changed
n1["deny_read_defaults_empty_and_round_trips<br/>changed"]:::changed
n2["...ker_facts_are_additive_and_default_safely<br/>changed"]:::changed
n3["Jail<br/>changed"]:::changed
n4["ResourceId"]:::impacted
n5["JailBackend"]:::impacted
n6["spawn_with"]:::impacted
n7["ExecRequest"]:::impacted
n8["SpawnRequest"]:::impacted
n9["CreateRequest"]:::impacted
n1 -->|uses| n0
n2 -->|calls| n4
n2 -->|tests| n4
n2 -->|uses| n9
n5 -->|uses| n3
n6 -->|uses| n3
n6 -->|uses| n5
n7 -->|uses| n4
n8 -->|uses| n4
n8 -->|uses| n7
n9 -->|uses| n4
classDef changed fill:#0d4429,stroke:#238636,color:#e6edf3
classDef impacted fill:#161b22,stroke:#6e7681,color:#c9d1d9
classDef flagged fill:#5a1e02,stroke:#d93f0b,color:#ffffff
classDef blocking fill:#67060c,stroke:#f85149,color:#ffffff
Agent review detailscritique
security
tests
commits
description
Evidence and run details
|
|
Warning Review limit reached
This review includes 21 billable files and costs up to $5.25. Or wait 8 minutes for your next included review. View limit details
Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
tinysweeper found nothing blocking, but could not review everything, so this is not an approval: crates/tinybox-bus/src/jail.rs, crates/tinybox-bus/src/jail_tests.rs, crates/tinybox-bus/src/lib.rs, crates/tinybox-bus/src/lib_tests.rs, crates/tinybox-bus/src/stdio_tests.rs, crates/tinybox-jail/src/jail.rs, crates/tinybox-jail/src/jail_tests.rs, crates/tinybox-jail/src/lib.rs and 15 more.
$0.0001 · 0 in / 0 out · 713 embedded · ladder/vectors-oai3
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 034ff041cc
ℹ️ 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".
Adds a test asserting the facade rejects each zero resource limit even when the backend reports full enforcement, and that no command is spawned as a result. Auto-committed-on: dragonfly
The backend preflight now calls validate on the requested resource constraints so zero limits are rejected before spawning. The facade maps zero-limit refusals to InvalidInput instead of Unsupported, and the test backend builds its constraint support without relying on the removed constructor. Auto-committed-on: dragonfly
Reformatted the test function signature and the backend spawn method so each fits on one line, matching rustfmt output. No behaviour changed. Auto-committed-on: dragonfly
There was a problem hiding this comment.
tinysweeper found nothing blocking, but could not review everything, so this is not an approval: crates/tinybox-jail/src/jail.rs, crates/tinybox-jail/src/lib.rs, crates/tinybox-jail/src/mod_tests.rs, tinysweeper/description, tinysweeper/tests.
$0.0001 · 0 in / 0 out · 763 embedded · ladder/vectors-oai3
Summary
Native jail requests can now carry the existing typed
ResourceLimitsvocabulary (CPU, memory, process count, disk) under optionalresources. The TinyBus contract is version 1.22; requests without the field remain compatible. The Jail facade and native module preflight refuse any requested hard limit unless every corresponding constraint is reportedEnforced, including when enforcement mode isDeclared.This change advertises no new resource enforcement. Current native backends do not enforce these limits, so requested limits fail before spawn. Future enforcement needs a safe launcher or owned cgroup/job lifecycle. Callers using raw
JailBackend::spawnmust callrequire_resourcesfirst; the public Jail facade does so automatically.Hosts must check contract version 1.22 before sending
resources, because older modules may ignore unknown JSON fields.Closes tinybox#27; part of tinyhumansai/openhuman#7328.
Validation
Declaredplus resourceBestEffort; confirmed failure when native preflight was removed and pass after restore.--workspace --all-features), build (--workspace --all-targets --all-features), strict Clippy (-D warnings), format, rustdoc, andscripts/test-features.shpassed.