Skip to content

Commit ffc94d0

Browse files
authored
fix: stop forked commands after Gateway timeouts (#124081)
* fix: stop service child trees before timeout completion * fix: preserve service child root results during cleanup * test: isolate relay selection from linux spawn wrapping * refactor: keep service anchor payload internal * test: validate lifecycle probe pid output * fix: close service child adversarial races * fix: preserve service startup failures * fix(process): flush service output before root result * fix(process): bound cleanup on held output * chore(process): satisfy promise executor lint * fix(process): finish cleanup after lineage loss * fix(process): retain relay output before subscription * fix(ci): register service child runtime entries * fix(ci): expose relay safety invariants * fix(process): preserve service cancellation grace * test(process): prove service grace on macOS
1 parent 1f1aa88 commit ffc94d0

13 files changed

Lines changed: 1681 additions & 71 deletions

‎config/knip.config.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,8 @@ const rootEntries = [
159159
"src/state/openclaw-database-verify.worker.ts!",
160160
"src/agents/model-provider-auth.worker.ts!",
161161
"src/agents/prepared-model-catalog.worker.ts!",
162+
// Spawned through computed sibling URLs by the service-child host and relay.
163+
"src/process/supervisor/{service-child-relay,service-child-group-anchor}.ts!",
162164
// Loaded by URL from setup-inference-detection.ts; no static import edge exists.
163165
"src/system-agent/setup-inference-detection.worker.ts!",
164166
// Split runtime loaded through a path assembled in subagent-registry.ts.

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1907,7 +1907,7 @@
19071907
"test:live:media:music": "node --import tsx test/e2e/qa-lab/media/hosted-media-provider-live.ts music",
19081908
"test:live:media:video": "node --import tsx test/e2e/qa-lab/media/hosted-media-provider-live.ts video",
19091909
"test:live:models-profiles": "node --import tsx scripts/test-live.mts -- src/agents/models.profiles.live.test.ts",
1910-
"test:macos:ci": "node --import tsx scripts/test-projects.mts src/daemon/launchd.test.ts src/daemon/runtime-paths.test.ts src/daemon/runtime-binary.test.ts src/gateway/worker-environments/workspace-rsync-path.test.ts src/infra/brew.test.ts src/infra/stable-node-path.test.ts test/scripts/vitest-process-group.test.ts test/scripts/package-mac-app.test.ts test/scripts/package-mac-dist.test.ts test/scripts/create-dmg.test.ts test/scripts/codesign-mac-app.test.ts test/scripts/notarize-mac-artifact.test.ts test/scripts/mac-elevation-host.test.ts",
1910+
"test:macos:ci": "node --import tsx scripts/test-projects.mts src/daemon/launchd.test.ts src/daemon/runtime-paths.test.ts src/daemon/runtime-binary.test.ts src/gateway/worker-environments/workspace-rsync-path.test.ts src/infra/brew.test.ts src/infra/stable-node-path.test.ts src/process/supervisor/adapters/child.service-lifecycle.test.ts test/scripts/vitest-process-group.test.ts test/scripts/package-mac-app.test.ts test/scripts/package-mac-dist.test.ts test/scripts/create-dmg.test.ts test/scripts/codesign-mac-app.test.ts test/scripts/notarize-mac-artifact.test.ts test/scripts/mac-elevation-host.test.ts",
19111911
"test:max": "node --import tsx scripts/test-projects-max.mts",
19121912
"test:parallels:linux": "bash scripts/e2e/parallels-linux-smoke.sh",
19131913
"test:parallels:macos": "bash scripts/e2e/parallels-macos-smoke.sh",

‎src/process/decoded-output.ts‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import type { Readable } from "node:stream";
2+
import { createWindowsOutputDecoder } from "../infra/windows-encoding.js";
3+
4+
export function onDecodedOutput(stream: Readable, listener: (chunk: string) => void): void {
5+
const decoder = createWindowsOutputDecoder();
6+
const emit = (text: string) => {
7+
if (text) {
8+
listener(text);
9+
}
10+
};
11+
let flushed = false;
12+
const flush = () => {
13+
if (flushed) {
14+
return;
15+
}
16+
flushed = true;
17+
emit(decoder.flush());
18+
};
19+
stream.on("data", (chunk: Buffer | string) => emit(decoder.decode(chunk)));
20+
stream.once("end", flush);
21+
stream.once("close", flush);
22+
}

0 commit comments

Comments
 (0)