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 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.
base: memory.high=10737418240 memory.max=12884901888
patch: memory.high=max memory.max=12884901888
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.
No actionable comments were generated in the recent review.
Walkthrough
The memory-limit logic now treats zero
SwapTotalor zeroSwapFreeas no available swap. The test fixture provides configurable free swap, and the test checksMemoryHighwith zero and positive free swap.Changes: Swap availability detection
apps/server/src/process/agentScope.ts,apps/server/src/process/agentScope.test.tsSwapTotalorSwapFreeis0 kB. The memory fixture emits configurableSwapFree, and the test checksMemoryHighbehavior when free swap is zero or positive.Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Suggested reviewers:
juliusmarminge,maria-rcksMerge Risk:
Minimal · up to
995ebAgents 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
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
#39287and#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)
7cc343d7-f2e8-47cb-877f-5ab451a5640fReviewing files that changed from the base of the PR and between d984b71385910bd575d4ed10ae6c0d1caf48f008 and 995ebfe96577ccab2ebc97ee155000c81ca436ee.
apps/server/src/process/agentScope.test.tsapps/server/src/process/agentScope.tsIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.