authorgravatar for me@t3.ggTheo Browne <me@t3.gg> 2026-08-09 01:13:26-04:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-08-08 22:13:26-07:00
logba9c9ae81dce4e554b4dd52abfd28d0c01b5c651
tree93131276b1c441a3551818c08b7aaee5f96d9e5e
parent076e9048dc57ab09b3692def050e12d690a1b027
signature Signed by PGP key B5690EEEBB952194

fix(server): one greedy agent process no longer takes down the whole server (#5788)

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>

2 files changed, 17 insertions(+), 0 deletions(-)

apps/server/src/cloud/bootService.test.ts+12
......@@ -35,6 +35,18 @@ it("keeps systemd pinned to the stable launcher rather than a versioned server",
3535 expect(unit).not.toContain("versions/1.2.3");
3636});
3737
38it("survives the kernel OOM-killing a greedy agent child", () => {
39 const unit = BootService.renderBootServiceUnit({
40 nodePath: "/usr/bin/node",
41 launcherPath: "/home/theo/.t3/runtime/service-launcher.mjs",
42 baseDir: "/home/theo/.t3",
43 logPath: "/home/theo/.t3/userdata/logs/boot-service.log",
44 unitPath: "/home/theo/.config/systemd/user/t3code.service",
45 });
46
47 expect(unit).toContain("OOMPolicy=continue");
48});
49
3850const makeHarness = Effect.fn("test.make_boot_service_harness")(function* (
3951 platform: NodeJS.Platform = "linux",
4052 usePinnedLauncher = false,
apps/server/src/cloud/bootService.ts+5
......@@ -67,6 +67,11 @@ export function renderBootServiceUnit(plan: BootServicePlan): string {
6767 // Let the launcher mark an explicit stop before it signals the server.
6868 // systemd still SIGKILLs the whole cgroup if graceful shutdown times out.
6969 "KillMode=mixed",
70 // Agent tool calls run as children of the server, so they share this cgroup.
71 // With the systemd default of OOMPolicy=stop, the kernel killing one greedy
72 // child stops the whole unit: the server, every live agent, and the user's
73 // connection. Keep running and let Restart=always cover the main process.
74 "OOMPolicy=continue",
7075 "Restart=always",
7176 "RestartSec=5",
7277 `StandardOutput=append:${escapeSystemdSpecifiers(plan.logPath)}`,