Skip to content
TypeScript

fix(opencode): a tool killed for memory no longer stops every OpenCode thread (#19367)

Theo Browneed2ca82d807e
diff --git a/apps/server/src/process/agentScope.test.ts b/apps/server/src/process/agentScope.test.ts
index 6f9c161e95a..6de42077787 100644
--- a/apps/server/src/process/agentScope.test.ts
+++ b/apps/server/src/process/agentScope.test.ts
@@ -238,6 +238,21 @@ describe("AgentScope service", () => {
),
);
+ it.effect("requests OOM continuation only for shared scopes when systemd supports it", () =>
+ withFakeSystemd(({ scope }) =>
+ Effect.gen(function* () {
+ const server = yield* scope.wrap({ command: "agent", args: [], name: "s", shared: true });
+ const agent = yield* scope.wrap({ command: "agent", args: [], name: "t", threadId: "a" });
+ expect(server.args.filter((arg) => arg.startsWith("--property=OOMPolicy="))).toEqual([
+ "--property=OOMPolicy=continue",
+ ]);
+ expect(agent.args.filter((arg) => arg.startsWith("--property=OOMPolicy="))).toEqual([
+ "--property=OOMPolicy=stop",
+ ]);
+ }),
+ ),
+ );
+
it.effect("leaves a quiet slice alone", () =>
withFakeSystemd(({ scope, calls }) =>
Effect.gen(function* () {
diff --git a/packages/provider-opencode/src/server/OpenCodeRuntime.ts b/packages/provider-opencode/src/server/OpenCodeRuntime.ts
index bd17cb81bcb..8cac4a2c5e0 100644
--- a/packages/provider-opencode/src/server/OpenCodeRuntime.ts
+++ b/packages/provider-opencode/src/server/OpenCodeRuntime.ts
@@ -701,6 +701,7 @@ const makeOpenCodeRuntime = Effect.gen(function* () {
args,
name: "opencode",
env: input.environment,
+ shared: true,
});
const spawnCommand = yield* resolveCommand(launch.command, launch.args, input.environment);
const serverPassword = resolveOpenCodeServerPassword({