GeezerVison is showing github.com — fix(server): one greedy agent process no longer takes down the whole … · patroza/t3code@ba9c9ae
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: apps/server/src/cloud/bootService.test.ts +12Lines changed: 12 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -35,6 +35,18 @@ it("keeps systemd pinned to the stable launcher rather than a versioned server", |
35 | 35 | expect(unit).not.toContain("versions/1.2.3"); |
36 | 36 | }); |
37 | 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 | + |
38 | 50 | const makeHarness = Effect.fn("test.make_boot_service_harness")(function* ( |
39 | 51 | platform: NodeJS.Platform = "linux", |
40 | 52 | usePinnedLauncher = false, |
|
Collapse file
Copy file name to clipboardExpand all lines: apps/server/src/cloud/bootService.ts +5Lines changed: 5 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -67,6 +67,11 @@ export function renderBootServiceUnit(plan: BootServicePlan): string { |
67 | 67 | // Let the launcher mark an explicit stop before it signals the server. |
68 | 68 | // systemd still SIGKILLs the whole cgroup if graceful shutdown times out. |
69 | 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", |
70 | 75 | "Restart=always", |
71 | 76 | "RestartSec=5", |
72 | 77 | `StandardOutput=append:${escapeSystemdSpecifiers(plan.logPath)}`, |
|