fix: enable sync io tracing in gateway watch

This commit is contained in:
Peter Steinberger
2026-05-04 22:44:19 +01:00
parent e84d4b27f4
commit 35e48a049b
3 changed files with 37 additions and 0 deletions

View File

@@ -143,6 +143,7 @@ describe("watch-node script", () => {
OPENCLAW_WATCH_MODE: "1",
OPENCLAW_WATCH_SESSION: "1700000000000-4242",
OPENCLAW_NO_RESPAWN: "1",
OPENCLAW_TRACE_SYNC_IO: "1",
OPENCLAW_WATCH_COMMAND: "gateway --force",
}),
}),
@@ -155,6 +156,35 @@ describe("watch-node script", () => {
});
});
it("preserves explicit sync I/O trace overrides for gateway watch", async () => {
const { child, spawn, createWatcher, fakeProcess } = createWatchHarness();
await withTempDir({ prefix: "openclaw-watch-node-" }, async (cwd) => {
const runPromise = runWatch({
args: ["gateway", "--force"],
cwd,
createWatcher,
env: { OPENCLAW_TRACE_SYNC_IO: "0" },
lockDisabled: true,
process: fakeProcess,
spawn,
});
expect(spawn).toHaveBeenCalledWith(
"/usr/local/bin/node",
["scripts/run-node.mjs", "gateway", "--force"],
expect.objectContaining({
env: expect.objectContaining({
OPENCLAW_TRACE_SYNC_IO: "0",
}),
}),
);
fakeProcess.emit("SIGINT");
await runPromise;
expect(child.kill).toHaveBeenCalledWith("SIGTERM");
});
});
it("starts the runner before loading chokidar", async () => {
const child = Object.assign(new EventEmitter(), {
kill: vi.fn(() => {}),