Skip to content

Commit 3c38e19

Browse files
only21milclaude
andcommitted
test(server): name the shared Codex scope test for what it checks
The test now says it checks the shared app-server launch options and also asserts that the shared scope is launched with --collect. The probe comment now says which older systemd user managers keep the OOM label: 252 still stops a plain scope on an OOM kill and records it, while 251 and older do neither. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 9796521 commit 3c38e19

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

‎apps/server/src/process/agentScope.test.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,14 +168,16 @@ describe("AgentScope service", () => {
168168
),
169169
);
170170

171-
it.effect("keeps the shared Codex app-server running after a tool's OOM kill", () =>
171+
it.effect("launches the shared Codex app-server with OOMPolicy=continue", () =>
172172
withFakeSystemd(({ scope }) =>
173173
Effect.gen(function* () {
174174
const codex = yield* launchCodex(scope, "a");
175175
const agent = yield* scope.wrap({ command: "agent", args: [], name: "t", threadId: "b" });
176176
// OOMPolicy=stop would end the app-server of every Codex thread.
177177
expect(codex.args).toContain("--property=OOMPolicy=continue");
178178
expect(codex.args).not.toContain("--property=OOMPolicy=stop");
179+
// No thread reads a shared scope's result, so systemd may unload it.
180+
expect(codex.args).toContain("--collect");
179181
expect(agent.args).toContain("--property=OOMPolicy=stop");
180182
}),
181183
),
@@ -206,7 +208,7 @@ describe("AgentScope service", () => {
206208
({ scope, units }) =>
207209
Effect.gen(function* () {
208210
const codex = yield* launchCodex(scope, "a");
209-
// Older managers still stop a scope on an OOM kill and record it.
211+
// systemd 252 still stops a plain scope on an OOM kill and records it.
210212
units.set(unitOf(codex), { activeState: "failed", result: "oom-kill" });
211213
expect(yield* scope.oomKilled("a")).toBe(true);
212214
expect(codex.args.filter((arg) => arg.includes("OOMPolicy"))).toEqual([]);

‎apps/server/src/process/agentScope.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,9 @@ export const make = Effect.gen(function* () {
133133
"true",
134134
]).pipe(Effect.map((result) => result._tag === "Some" && result.value.code === 0));
135135
// Stop the whole scope when the kernel kills one of its processes, and
136-
// record the result as oom-kill. Scopes take OOMPolicy from systemd 253;
137-
// older user managers still get plain scopes, without the OOM label.
136+
// record the result as oom-kill. Scopes take OOMPolicy from systemd 253.
137+
// Older user managers get plain scopes: 252 still stops them on an OOM
138+
// kill and records it, 251 and older do neither.
138139
const oomOptions = ["--property=OOMPolicy=stop"];
139140
const scopeOptions = (yield* probe(oomOptions))
140141
? oomOptions

0 commit comments

Comments
 (0)