You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(server): stop throttling agents when swap is full - #39976
On a Linux systemd host with configured swap fully occupied, Codex and Antigravity stalled before sending their prompts. The host showed sustained memory reclaim. The shared agent slice’s policy only checked SwapTotal, so it kept applying a finite MemoryHigh even when SwapFree was zero.
Under sustained memory pressure, all agents on the host can stop responding. To recover, the operator has to access the server through a separate route, such as SSH.
Change
Treat zero free swap like zero configured swap. On the next agent launch, use the existing unlimited MemoryHigh policy and keep the same MemoryMax. If swap becomes available again, a later launch restores the soft limit.
Scope
This covers the exhausted-swap case of the agent-slice policy behind #39287, with symptoms previously reported in #25918. It uses the existing launch-time check.
Verification
The focused regression failed on main because the finite soft limit stayed in place. With the patch, all 16 tests in agentScope.test.ts passed. The test covers exhausted swap, recovered swap, and removal of swap.
I evaluated both revisions’ policies with a synthetic 16 GiB host snapshot and SwapTotal: 524284 kB, SwapFree: 0 kB. Applying the resulting limits in isolated transient systemd scopes produced these cgroup values.
No actionable comments were generated in the recent review.
Walkthrough
The memory-limit logic now treats zero SwapTotal or zero SwapFree as no available swap. The test fixture provides configurable free swap, and the test checks MemoryHigh with zero and positive free swap.
Changes: Swap availability detection
Layer / File(s)
Summary
Detect swap availability and verify memory limits apps/server/src/process/agentScope.ts, apps/server/src/process/agentScope.test.ts
Swap detection now checks whether SwapTotal or SwapFree is 0 kB. The memory fixture emits configurable SwapFree, and the test checks MemoryHigh behavior when free swap is zero or positive.
Agents are no longer throttled by the soft memory limit when swap is fully used. The hard limit is unchanged, and the new behavior is covered by tests. No merge-blocking risk is identified.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title "fix(server): stop throttling agents when swap is full" names the main change: the agent-slice memory policy now treats exhausted free swap like zero configured swap, so MemoryHigh no longer…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Description check
The description is mostly complete and follows the template. It states the problem (exhausted swap leaves a finite MemoryHigh applied, stalling agents), the change (treat zero free swap like zero conf…
Full details: Title check
Explanation
The title "fix(server): stop throttling agents when swap is full" names the main change: the agent-slice memory policy now treats exhausted free swap like zero configured swap, so MemoryHigh no longer throttles agents. It follows conventional commit form and is specific to the changeset.
Full details: Description check
Explanation
The description is mostly complete and follows the template. It states the problem (exhausted swap leaves a finite MemoryHigh applied, stalling agents), the change (treat zero free swap like zero configured swap, use the unlimited MemoryHigh policy, keep MemoryMax), and the scope (exhausted-swap case of the agent-slice policy, linked to #39287 and #25918). Verification is concrete: the focused regression failed on main and passed with the patch (16 of 16 tests in agentScope.test.ts), and the author ran a synthetic cgroup-value comparison. Gaps: the Scope section does not state whether the referenced issues are the bug reports, and the template asks for a conventional commit title, which is not shown in the description. The template also asks for the model and harness used; the author gives 'GPT-6.2-Sol via the Codex harness in T3 Code', which satisfies that. Remaining items are minor.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Reviewing files that changed from the base of the PR and between d984b71 and 995ebfe.
Files selected for processing: 2
apps/server/src/process/agentScope.test.ts
apps/server/src/process/agentScope.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
This branch has not been deployed
No deployments
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
size:XS0-9 changed lines (additions + deletions).vouch:unvouchedAuthor is not yet trusted in the VOUCHED list.
1 participant
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.
Problem
On a Linux systemd host with configured swap fully occupied, Codex and Antigravity stalled before sending their prompts. The host showed sustained memory reclaim. The shared agent slice’s policy only checked
SwapTotal, so it kept applying a finiteMemoryHigheven whenSwapFreewas zero.Under sustained memory pressure, all agents on the host can stop responding. To recover, the operator has to access the server through a separate route, such as SSH.
Change
Treat zero free swap like zero configured swap. On the next agent launch, use the existing unlimited
MemoryHighpolicy and keep the sameMemoryMax. If swap becomes available again, a later launch restores the soft limit.Scope
This covers the exhausted-swap case of the agent-slice policy behind #39287, with symptoms previously reported in #25918. It uses the existing launch-time check.
Verification
The focused regression failed on
mainbecause the finite soft limit stayed in place. With the patch, all 16 tests inagentScope.test.tspassed. The test covers exhausted swap, recovered swap, and removal of swap.I evaluated both revisions’ policies with a synthetic 16 GiB host snapshot and
SwapTotal: 524284 kB,SwapFree: 0 kB. Applying the resulting limits in isolated transient systemd scopes produced these cgroup values.This verifies the applied limits without exhausting host swap or running a provider turn.
GPT-6.2-Sol via the Codex harness in T3 Code.