diff --git a/src/local/entrypoint.ts b/src/local/entrypoint.ts index 5075af08..7d693eb7 100644 --- a/src/local/entrypoint.ts +++ b/src/local/entrypoint.ts @@ -979,9 +979,15 @@ async function workflowSdkLoaderNodeOption(cwd: string): Promise{', - 'child.stdout?.off("pause",drainBrokerStdout);', - 'child.stdout?.on("data",()=>{});', - 'child.stdout?.resume();', - '};', - 'child.stdout.on("pause",drainBrokerStdout);', + 'if((argv[0]==="init"||argv[0]==="pty")&&/(?:^|[/\\\\])agent-relay-broker(?:\\.exe)?$/u.test(executable)&&child.stdout){', + // Attach the data listener immediately so the stream enters flowing mode + // and libuv keeps draining the kernel pipe. The previous `on("pause", ...)` + // hook never fired — Node `Readable` only emits `'pause'` when something + // explicitly calls `.pause()`, which nothing does in this code path, so the + // stream stayed in paused mode and the broker eventually blocked in + // `write()` when the OS pipe buffer filled. + 'child.stdout.on("data",()=>{});', + 'child.stdout.resume();', '}', 'return child;', '};',