Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions apps/server/src/cloud/bootService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,18 @@ it("keeps systemd pinned to the stable launcher rather than a versioned server",
expect(unit).not.toContain("versions/1.2.3");
});

it("survives the kernel OOM-killing a greedy agent child", () => {
const unit = BootService.renderBootServiceUnit({
nodePath: "/usr/bin/node",
launcherPath: "/home/theo/.t3/runtime/service-launcher.mjs",
baseDir: "/home/theo/.t3",
logPath: "/home/theo/.t3/userdata/logs/boot-service.log",
unitPath: "/home/theo/.config/systemd/user/t3code.service",
});

expect(unit).toContain("OOMPolicy=continue");
});

const makeHarness = Effect.fn("test.make_boot_service_harness")(function* (
platform: NodeJS.Platform = "linux",
usePinnedLauncher = false,
Expand Down
5 changes: 5 additions & 0 deletions apps/server/src/cloud/bootService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ export function renderBootServiceUnit(plan: BootServicePlan): string {
// Let the launcher mark an explicit stop before it signals the server.
// systemd still SIGKILLs the whole cgroup if graceful shutdown times out.
"KillMode=mixed",
// Agent tool calls run as children of the server, so they share this cgroup.
// With the systemd default of OOMPolicy=stop, the kernel killing one greedy
// child stops the whole unit: the server, every live agent, and the user's
// connection. Keep running and let Restart=always cover the main process.
"OOMPolicy=continue",
"Restart=always",
"RestartSec=5",
`StandardOutput=append:${escapeSystemdSpecifiers(plan.logPath)}`,
Expand Down
Loading