Walkthrough
This change adds Linux systemd memory and OOM protection controls, protection status reporting, and a
service protectcommand. It also adds AgentScope launcher scripts for preview-browser launches and passes replacement executable paths to shared and persistent browser launches.Changes: Linux service protection
Layer / File(s) Summary Protection policy and systemd defaults
apps/server/src/cloud/serviceProtection.ts,apps/server/src/cloud/bootService.ts,apps/server/src/cloud/bootService.test.ts,apps/server/src/cloud/serviceProtection.test.tsDefines protection plans and remote-access unit detection. The boot service unit sets OOMScoreAdjust=100. Tests check the unit directive and remote-unit selection.Apply, inspect, and remove protection
apps/server/src/cloud/serviceProtection.ts,apps/server/src/cloud/serviceProtection.test.tsAdds operations for system and user drop-ins, protection-state inspection, and apply or undo behavior. Tests cover generated files, OOM scores, operation ordering, command failures, and cgroup detection. Service command, status, and guidance
apps/server/src/cli/service.ts,apps/server/src/cli/service.test.ts,docs/user/background-service.mdAdds protection details to installed-service status and adds service protectwith confirmation, apply, and undo paths. Documents Linux usage and restart behavior.AgentScope browser launcher
Layer / File(s) Summary Generate and validate launcher scripts
packages/shared/src/AgentScope.ts,packages/shared/src/AgentScope.test.tsAdds a shell-script generator that quotes the command and arguments and forwards caller arguments. Tests execute the generated script and check its arguments. Launch preview browsers through AgentScope
apps/server/src/preview/ServerBrowser.ts,apps/server/src/preview/ServerBrowserContexts.ts,apps/server/src/preview/ServerBrowserContexts.test.tsCreates executable launcher scripts for wrapped browser commands and passes replacement executable paths to shared and persistent browser launches. Tests check release timing, startup failures, and profile-directory failure behavior. Priority: External image Normal
Estimated code review effort: 4 (Complex) | ~45 minutes
Change: Feature · Severity of issue fixed: Medium
Sequence Diagram(s)
mermaid1 sequenceDiagram 2 participant ServiceCLI 3 participant ServiceProtection 4 participant Systemd 5 ServiceCLI->>ServiceProtection: apply protection with the generated plan 6 ServiceProtection->>Systemd: write manager defaults 7 ServiceProtection->>Systemd: run privileged script for system drop-ins 8 ServiceProtection->>Systemd: write user drop-ins and reload user manager mermaid1 sequenceDiagram 2 participant ServerBrowser 3 participant AgentScope 4 participant ServerBrowserContexts 5 participant Chromium 6 ServerBrowser->>AgentScope: wrap the browser command 7 ServerBrowser->>ServerBrowserContexts: provide launcher path and release callback 8 ServerBrowserContexts->>Chromium: launch with replacement executable path 9 ServerBrowserContexts->>ServerBrowser: release launcher after launch Possibly related issues
- pingdotgg/t3code#26004: The changes add memory protection across service cgroup ancestors and report protection state, matching the issue’s report that the service lacks
MemoryLow.
Possibly related PRs
- pingdotgg/t3code#25185: Both PRs change Linux systemd OOM behavior for the T3 service.
- pingdotgg/t3code#27176: Both PRs change memory policy in the server and agent cgroup hierarchy.
- pingdotgg/t3code#26595: The preview-browser executable provided by that PR is passed through this PR’s launcher flow.
Suggested reviewers:
maria-rcks,t3dotgg- pingdotgg/t3code#26004: The changes add memory protection across service cgroup ancestors and report protection state, matching the issue’s report that the service lacks
Merge Risk: External image Minimal · up to 333ee
No merge-blocking issue was established in the service protection or browser-launch changes.
Pre-merge checks: Passed 3 · Inconclusive 1
Failed Failed checks: 1 inconclusive
Check name Status Explanation Resolution Description check Inconclusive The description follows the repository template. It has Problem, Change, Scope and approval, Verification, and an agent attribution line. The Problem section explains that the server's MemoryLow prote… Add a Scope and approval section. Link the triaged issue or maintainer-approved discussion, including the approval comment. If no prior approval exists, explain why this change qualifies under the template's configuration or focused-fix exe… Passed Passed checks: 3 passed
Check name Status Explanation Title check Passed The title "feat(server): t3 service protectkeeps the server alive when agents fill memory" is a conventional commit title that names the main change. The changeset adds thet3 service protectcom…Linked Issues check Passed Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request. Full details: Title check
Explanation
The title "feat(server):
t3 service protectkeeps the server alive when agents fill memory" is a conventional commit title that names the main change. The changeset adds thet3 service protectcommand, which applies systemd memory and OOM protection so the server survives agent memory pressure. The title is specific and related to the primary change. It does not cover the unit OOMScoreAdjust change, the preview browser launcher, or the status output, which is acceptable for a title.
Full details: Description check
Explanation
The description follows the repository template. It has Problem, Change, Scope and approval, Verification, and an agent attribution line. The Problem section explains that the server's MemoryLow protection depends on every parent cgroup granting protection, and that agents run at OOM score +800. The Change section describes the protect command steps, undo behavior, status output, and the unit and preview browser changes. The Scope and approval section is missing. It does not link a triaged bug issue or maintainer-approved discussion, and it does not explain a focused-fix or configuration exemption. The Verification section lists focused tests and states that check:changed passed, and it lists what was not checked on a live host. The main gap is the missing approval link or exemption explanation. The description also says it is stacked on another PR, which is useful context. The model line is present at the end.
Resolution
Add a Scope and approval section. Link the triaged issue or maintainer-approved discussion, including the approval comment. If no prior approval exists, explain why this change qualifies under the template's configuration or focused-fix exemption. The change adds a new command and new behavior, so the template's broader approval requirement likely applies. Also confirm the stacked base PR and its approval status.
Finishing Touches
📝 Generate docstrings
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
- Commit to this branch
- 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.