fix(server): avoid the uresourced CPU loop in Linux service units#20968

closed5
main
GitHub fork: codex/fix-20931-systemd-oom-preference
openedOct 17, 2026byNnateEc
View on GitHubTwo-way sync enabledPR last imported 18d ago

Generated Linux service units set ManagedOOMPreference=avoid. On affected Fedora/GNOME systems, uresourced 0.5.4 reacts to the resulting cgroup attribute writes by resetting resource weights, causing the reported user-manager CPU loop in #20931.

Remove that setting and its obsolete comment. Keep OOMPolicy=continue, CPU/IO weights, and agent scope isolation. This restores systemd’s default OOM preference; existing units receive the new template when users run t3 service install.

Credit to @nateEc for #20968. Fixes #20931.

Verification from the maintainer takeover (Linux):

  • Consolidated duplicate assertions into the existing rendered-unit policy test: 40 tests before, 39 after, all passing in bootService.test.ts.
  • Restoring main’s production renderer produces one failure and 38 passes because the managed OOM preference reappears.
  • Server typecheck, targeted lint/formatting, and diff checks passed (non-failing Effect suggestions).
  • Executed the actual renderer with a disposable plan; its output passed systemd-analyze verify --man=no. No service was installed or started.

Headless Linux verification proves the generated configuration, not a measured CPU-loop fix. A native Fedora/GNOME session with affected uresourced and memory-pressure behavior remains unverified, as does packaged Electron, macOS, Windows, iOS, and Android. Human approval of the changed service default remains required. There is no visual UI change to capture.

Maintenance follow-up (2026-10-22): merged main ff525478e2 without rewriting contributor or maintainer history. Kept main's new launcher round-trip tests and integrated OOM policy/weight assertions into the existing install/status/uninstall test. Against that main, the PR remains two files (6 insertions, 7 deletions).

Fresh macOS / Node 26.12.1 / pnpm 12.14.0 verification: restoring the removed directive makes the install regression fail for that directive; all 33 current boot-service tests pass with the fix. vp run check:changed passes format, lint, knip, server GraphQL consistency, affected-package typechecks (2 packages), and the adjacent tests. No host service was installed or started. Live Fedora/uresourced validation and human approval remain outstanding.

Maintainer takeover: Codex GPT-6.1-Sol; tests: Codex GPT-6-Astra; independent review: Claude Opus 5.5 and Codex GPT-6-Sol. Harness: T3 Code.

Maintenance follow-up model/harness: GPT-5 / Codex desktop.

Checks

21 successful · 16 skipped · 1 neutral
All checks passed
a46db79

Added 1 commit

  • fix(server): 移除触发资源服务循环的 OOM 偏好96a7ed9
Synced from GitHub

Approvability

Verdict: Needs Human Approval

Macroscope's review found this PR requires human approval — This PR changes the default OOM preference in generated Linux systemd service units, affecting runtime behavior for installed services. The change is narrowly tested but requires human review because it modifies a product default.

Notes:

  • All code in this push has already been reviewed. Approvability was decided on eligibility alone.

You can add or adjust custom eligibility rules. Learn more.

Synced from GitHub

Review in Change Stack →

No actionable comments were generated in the recent review.

External image Recent review info
External image Run configuration
External image Commits

Reviewing files that changed from the base of the PR and between 5d3ef5da57b7812190153f3fcc9a37e6c20c42f3 and a46db79798335f77ddbf10882bf028059553e59a.

External image Files selected for processing: 1
  • apps/server/src/cloud/bootService.ts
External image Files with no reviewable changes: 1
  • apps/server/src/cloud/bootService.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.

Walkthrough

The Linux systemd unit renderer no longer emits ManagedOOMPreference=avoid. The install test checks that directive is absent and verifies the launcher command, OOMPolicy, CPUWeight, and IOWeight.

Changes: Systemd unit configuration

Layer / File(s)Summary
Render and validate unit directives
apps/server/src/cloud/bootService.ts, apps/server/src/cloud/bootService.test.ts
The unit renderer removes ManagedOOMPreference=avoid and its explanatory comment. The install test checks the directive is absent and verifies the launcher command, OOMPolicy=continue, CPUWeight=1000, and IOWeight=1000.

Priority: External image Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Possibly related issues

  • pingdotgg/t3code#20931 — The issue reports a CPU loop linked to ManagedOOMPreference=avoid in the Linux service unit. This change removes that directive.

Possibly related PRs

Suggested reviewers: t3dotgg

Merge Risk: External image Minimal · up to a46db

No actionable issue is established for this change. Live Fedora validation and human approval remain outstanding.

Security architecture risk: External image Low · up to 96a7e

This narrowly changes Linux memory-pressure handling without adding privileges or changing service isolation. No introduced security finding was identified. Operational uncertainty remains because the affected Fedora configuration and behavior under memory pressure were not tested live.

Retained concerns No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The changed policy directly affects newly written Linux user-service units and their interaction with host OOM management. Actual effects depend on host policy; the patch does not add a cross-tenant, credential, or privileged execution path.

Trust Boundaries and Controls

  • observed — The existing persistent-write helper writes a temporary file with mode 0600, syncs it, and renames it into place. The directive removal does not change this filesystem control or introduce another writer.

Resilience and Maintainability Implications

  • inferred — The intended availability improvement removes the reported configuration trigger, but live avoidance of the Fedora/uresourced loop remains unverified. Retaining OOMPolicy and resource weights is counterevidence against a broader resource-policy rewrite, not proof that OOM survival is unchanged.
Pre-merge checks: Passed 3 · Failed 1

Failed Failed checks: 1 warning

Check nameStatusExplanationResolution
Description checkWarningThe description clearly explains the problem, implementation, verification, limitations, and scope. However, the required scope-and-approval evidence is incomplete because it does not include explicit…Add the required Problem, Change, Scope and approval, and Verification headings. Link the triaged issue or discussion with the explicit maintainer approval comment for this direction and scope, or explain why this focused fix qualifies for …
Passed Passed checks: 3 passed
Check nameStatusExplanation
Title checkPassedThe title clearly identifies the server fix and the affected Linux service-unit behavior. It is concise and uses the conventional commit format.
Linked Issues checkPassedIssue #20931 identifies ManagedOOMPreference=avoid as the trigger. The PR removes that setting and its obsolete comment from the Linux service template. The focused test verifies that the rendered u…
Out of Scope Changes checkPassedThe PR changes only the Linux service template and its focused rendered-unit test. The test coverage for retained service policy supports the requested change. No unrelated production behavior or unre…
Full details: Linked Issues check

Explanation

Issue #20931 identifies ManagedOOMPreference=avoid as the trigger. The PR removes that setting and its obsolete comment from the Linux service template. The focused test verifies that the rendered unit omits ManagedOOMPreference= and retains OOMPolicy=continue, CPUWeight=1000, and IOWeight=1000. The reported test and changed-check results support the implementation. Live Fedora and uresourced validation is not required to establish this coding change.

Full details: Out of Scope Changes check

Explanation

The PR changes only the Linux service template and its focused rendered-unit test. The test coverage for retained service policy supports the requested change. No unrelated production behavior or unrelated file change is shown.

Full details: Description check

Explanation

The description clearly explains the problem, implementation, verification, limitations, and scope. However, the required scope-and-approval evidence is incomplete because it does not include explicit maintainer approval or an approval comment, and it does not use the template section headings.

Resolution

Add the required Problem, Change, Scope and approval, and Verification headings. Link the triaged issue or discussion with the explicit maintainer approval comment for this direction and scope, or explain why this focused fix qualifies for an approval exemption.

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

Taking over this one as maintainer for batch desktop-app-01. I will keep the service-unit fix focused, minimize duplicate assertions, merge main, and run fresh checks and independent reviews. Live Fedora/uresourced verification and human approval will remain explicit. No merge in this pass.

Added 3 commits

  • Merge remote-tracking branch 'origin/main' into codex/fix-20931-systemd-oom-preferencec2ef893
  • test(server): consolidate service OOM policy coveragea03bbe3
  • chore(server): 同步主线并修复服务测试冲突5d3ef5d
Synced from GitHub

Maintenance follow-up at 5d3ef5da57b7812190153f3fcc9a37e6c20c42f3: merged main ff525478e236ec0df4c4920eb03ac3961ea714a2, preserving the original commits and the maintainer takeover commits.

The conflict was confined to the test file: main replaced the old standalone renderer fixture with launcher round-trip coverage. Kept that new coverage and moved the OOM-policy/resource-weight assertions into the existing real install/status/uninstall test, which reads the written unit. The production change is still just removal of ManagedOOMPreference=avoid and its obsolete comment. The diff against the integrated main remains two files, 6 insertions and 7 deletions.

Verification on macOS / Node 26.12.1 / pnpm 12.14.0 / Effect 4.0.5:

  • Negative control: restoring ManagedOOMPreference=avoid makes the installation regression fail specifically on that directive.
  • vp test run apps/server/src/cloud/bootService.test.ts: 33 passed.
  • vp run check:changed: format, lint, knip, server GraphQL consistency, affected-package typechecks (2 packages), and the adjacent test file all passed.
  • No service was installed or started on the host; the service test uses a disposable home and an injected process runner. Live Fedora/GNOME/uresourced behavior remains unverified, and human approval remains required.

Latest-commit GitHub verification also completed: build/typecheck, lint, all eight server-test shards, aggregate Check, and Macroscope correctness passed. CodeRabbit completed its review of 5d3ef5da57b7812190153f3fcc9a37e6c20c42f3 with no actionable findings. No unresolved review threads remain; human approval is still required.

Model/harness for this maintenance follow-up: GPT-5 / Codex desktop.

Added 1 commit

  • chore(server): 合并主线并保留默认内存回收偏好a46db79
Synced from GitHub

Merged main c3888da8b4 in a46db79798, preserving the maintainer's service-policy change and regression tests. Resolved the overlap with main's shortened OOM comment by keeping the directive removed. All 33 boot-service tests and check:changed scoped gates pass. No host service was installed or started; live Fedora/uresourced validation and human approval remain outstanding.