@@ -820,19 +820,34 @@ describe("provider local service", () => {
820820 const tempDir = tempDirs . make ( "openclaw-local-service-failed-unref-" ) ;
821821 const servicePidPath = path . join ( tempDir , "service.pid" ) ;
822822 const moduleUrl = new URL ( "./provider-local-service.ts" , import . meta. url ) . href ;
823- // The assertion targets diagnostic-pipe cleanup after failed readiness.
824- // Give the nested Node child enough startup time under loaded CI.
825- const failedServiceReadyTimeoutMs = 5_000 ;
823+ const failedServiceReadyTimeoutMs = 60_000 ;
826824 const serviceScript = [
827825 `const fs=require("node:fs");` ,
828826 `fs.writeFileSync(${ JSON . stringify ( servicePidPath ) } ,String(process.pid));` ,
829827 `process.on("SIGTERM",()=>{});` ,
830828 `setInterval(()=>process.stderr.write("tick\\n"),10);` ,
831829 ] . join ( "" ) ;
830+ // Advance only the nested host's readiness clock after the service PID exists.
831+ // This preserves live-child failure cleanup without spending the deadline in wall time.
832832 const script = [
833+ `import fs from "node:fs";` ,
833834 `import { ensureProviderLocalService } from ${ JSON . stringify ( moduleUrl ) } ;` ,
834835 `if (!process.send) throw new Error("missing one-shot host IPC");` ,
835836 `process.on("disconnect", () => {});` ,
837+ `const realNow = Date.now.bind(Date);` ,
838+ `const realSetTimeout = globalThis.setTimeout.bind(globalThis);` ,
839+ `let clockOffsetMs = 0;` ,
840+ `Date.now = () => realNow() + clockOffsetMs;` ,
841+ `globalThis.setTimeout = (callback, delay, ...args) => {` ,
842+ ` if (clockOffsetMs === 0 && fs.existsSync(${ JSON . stringify ( servicePidPath ) } )) {` ,
843+ ` return realSetTimeout(() => {` ,
844+ ` clockOffsetMs = ${ failedServiceReadyTimeoutMs + 1 } ;` ,
845+ ` globalThis.setTimeout = realSetTimeout;` ,
846+ ` callback(...args);` ,
847+ ` }, 0);` ,
848+ ` }` ,
849+ ` return realSetTimeout(callback, delay, ...args);` ,
850+ `};` ,
836851 `try {` ,
837852 ` await ensureProviderLocalService({` ,
838853 ` providerId: "local-failed-unref",` ,
@@ -843,7 +858,10 @@ describe("provider local service", () => {
843858 ` readyTimeoutMs: ${ failedServiceReadyTimeoutMs } ,` ,
844859 ` },` ,
845860 ` });` ,
846- `} catch {}` ,
861+ `} catch (error) {` ,
862+ ` if (!(error instanceof Error) || !error.message.includes("did not become ready")) throw error;` ,
863+ `}` ,
864+ `if (clockOffsetMs === 0) throw new Error("test clock did not advance");` ,
847865 `process.send({ kind: ${ JSON . stringify ( ONE_SHOT_HOST_READY_KIND ) } });` ,
848866 ] . join ( "\n" ) ;
849867 const parent = spawn (
0 commit comments