feat(agent): process fd/RSS ceilings gate connection admission (W2.5) - #49
Merged
Merged
Conversation
rldyourmnd
force-pushed
the
w25-process-resource-budgets
branch
2 times, most recently
from
September 27, 2026 08:51
e508ba5 to
1a16db2
Compare
AgentLimits gains with_process_budget(max_fds, max_rss_mb); when either ceiling is set the agent samples the kernel view (/proc/self/fd + VmRSS on Linux, /dev/fd + proc_pidinfo on macOS, re-statting at most every 200ms) and refuses new connections while usage sits at or above the ceiling — before a connection slot or stream task is consumed. Refusals reuse ConnectionBudgetExhausted; unobservable platforms keep serving. Settings expose limits.max_fds/max_rss_mb (positive, flag-overridable via --max-fds/--max-rss-mb) and the metrics snapshot reports rds_agent_process_fds/rds_agent_process_rss_bytes where observed. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
scenario.rs already generates ping payloads via rand::random elsewhere; the literal `1` tripped the CodeQL rust/hard-coded-cryptographic-value rule (critical alert on main). Same treatment. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
rldyourmnd
force-pushed
the
w25-process-resource-budgets
branch
from
September 27, 2026 09:41
c9574cd to
4954164
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
AgentLimits::with_process_budget(max_fds, max_rss_mb)installs aprocess-level resource gate: while the kernel reports the agent at or
above the configured fd/RSS ceiling, new connections are refused at
admission — the pending
Incomingis dropped (runner) or theestablished conn is closed (
serve) — before a slot or task is spent./proc/self/fd+VmRSSon Linux and/dev/fd+proc_pidinfoon macOS, cached 200ms so procfs scans stay off theaccept hot path. Platforms that cannot observe a quantity keep serving
rather than gate on a guess.
limits.max_fds/limits.max_rss_mb(positive NonZero,JSON +
--max-fds/--max-rss-mbflags, merged with file precedence).ConnectionBudgetExhausted; metricssnapshot reports
rds_agent_process_fds/rds_agent_process_rss_byteswhere the kernel reports them.
Test plan
syskernel sanity +ResourceGateunit tests (none/impossible/generous ceilings)
serverefuses anestablished conn; above-usage ceiling admits and pings normally
cargo fmt --check, clippy default + x11 lanes, workspace tests —all green locally
Still open under W2.5: per-service fairness inside the stream budget,
disk/media cancellation breadth, storm-grade RSS/FD stress proof.
Generated with Devin