Compare commits

...
Author SHA1 Message Date
paseo-bot[bot] 47573fde57 fix(server): release workspace refreshes after forge CLI timeouts
A forge command can ignore the default termination signal and keep its workspace refresh slot occupied. Use a forceful signal at the existing deadline so the refresh can finish.
2026-11-28 23:29:10 +00:00
2 changed files with 11 additions and 5 deletions
@@ -136,12 +136,11 @@ describe.skipIf(isPlatform("win32"))("createForgeCliRunner", () => {
}
}
it("kills a hung CLI invocation after the configured timeout", async () => {
const cli = writeSlowCli();
it("kills a CLI that ignores SIGTERM at the configured timeout", async () => {
const runner = createForgeCliRunner({
binary: cli,
binary: process.execPath,
envOverlay: {},
timeoutMs: 100,
timeoutMs: 500,
isAuthFailureText: () => false,
errorClasses: {
isAlreadyClassified: () => false,
@@ -152,7 +151,12 @@ describe.skipIf(isPlatform("win32"))("createForgeCliRunner", () => {
},
});
await expect(runner.run(["arg"], { cwd: tempDir })).rejects.toThrow();
await expect(
runner.run(
["-e", "process.on('SIGTERM', () => {}); setTimeout(() => process.exit(7), 2000);"],
{ cwd: tempDir },
),
).rejects.toMatchObject({ killed: true, signal: "SIGKILL" });
});
it("classifies a timed-out invocation through normalizeError", async () => {
@@ -161,6 +161,8 @@ export function createForgeCliRunner(options: CreateForgeCliRunnerOptions): Forg
envOverlay: { ...options.envOverlay, ...runOptions.envOverlay },
maxBuffer: 10 * 1024 * 1024,
timeout: options.timeoutMs,
// execFile sends one signal at the deadline. A CLI can ignore SIGTERM.
killSignal: "SIGKILL",
});
}