| author | |
| committer | |
| log | ba9c9ae81dce4e554b4dd52abfd28d0c01b5c651 |
| tree | 93131276b1c441a3551818c08b7aaee5f96d9e5e |
| parent | 076e9048dc57ab09b3692def050e12d690a1b027 |
| signature | Signed by PGP key B5690EEEBB952194 |
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", | ... | @@ -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"); | 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 | const makeHarness = Effect.fn("test.make_boot_service_harness")(function* ( | 50 | const makeHarness = Effect.fn("test.make_boot_service_harness")(function* ( |
| 39 | platform: NodeJS.Platform = "linux", | 51 | platform: NodeJS.Platform = "linux", |
| 40 | usePinnedLauncher = false, | 52 | usePinnedLauncher = false, |
apps/server/src/cloud/bootService.ts+5| ... | @@ -67,6 +67,11 @@ export function renderBootServiceUnit(plan: BootServicePlan): string { | ... | @@ -67,6 +67,11 @@ export function renderBootServiceUnit(plan: BootServicePlan): string { |
| 67 | // Let the launcher mark an explicit stop before it signals the server. | 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. | 68 | // systemd still SIGKILLs the whole cgroup if graceful shutdown times out. |
| 69 | "KillMode=mixed", | 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 | "Restart=always", | 75 | "Restart=always", |
| 71 | "RestartSec=5", | 76 | "RestartSec=5", |
| 72 | `StandardOutput=append:${escapeSystemdSpecifiers(plan.logPath)}`, | 77 | `StandardOutput=append:${escapeSystemdSpecifiers(plan.logPath)}`, |