The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 24, 17:45 UTC
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>
Theo Browne committed
Aug 9, 2026 at 01:13 UTC
ba9c9ae81dce4e554b4dd52abfd28d0c01b5c651
2 files changed
+17
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",
35
expect(unit).not.toContain("versions/1.2.3");
36
});
37
38
+it("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
+
50
const makeHarness = Effect.fn("test.make_boot_service_harness")(function* (
51
platform: NodeJS.Platform = "linux",
52
usePinnedLauncher = false,
apps/server/src/cloud/bootService.ts
+5
@@ -67,6 +67,11 @@ export function renderBootServiceUnit(plan: BootServicePlan): string {
67
// Let the launcher mark an explicit stop before it signals the server.
68
// systemd still SIGKILLs the whole cgroup if graceful shutdown times out.
69
"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",
75
"Restart=always",
76
"RestartSec=5",
77
`StandardOutput=append:${escapeSystemdSpecifiers(plan.logPath)}`,