mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-29 03:35:39 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
47573fde57 |
@@ -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",
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -653,39 +653,6 @@ describe("createTerminal", () => {
|
||||
expect(session.getExitInfo()).toEqual(exitInfo);
|
||||
});
|
||||
|
||||
it.runIf(isPlatform("win32"))(
|
||||
"starts a ConPTY program when the event loop stalls past five seconds after spawn",
|
||||
async () => {
|
||||
// node-pty reports the ConPTY output worker ready by a worker message, and failed the
|
||||
// spawn with exit code -1 when that message came after 5 s. A loaded runner delays it
|
||||
// that long; blocking the event loop for 6 s makes the delay certain. Spawning and
|
||||
// blocking inside a check-phase callback makes the next loop iteration start with the
|
||||
// timers phase, so the old 5 s timer always runs before the worker message is delivered.
|
||||
const child = await new Promise<pty.IPty>((resolve) => {
|
||||
setImmediate(() => {
|
||||
const spawned = pty.spawn(process.execPath, ["-e", "process.stdout.write('STARTED')"], {
|
||||
cols: 80,
|
||||
rows: 24,
|
||||
cwd: realpathSync(tmpdir()),
|
||||
});
|
||||
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, 6000);
|
||||
resolve(spawned);
|
||||
});
|
||||
});
|
||||
let output = "";
|
||||
child.onData((data) => {
|
||||
output += data;
|
||||
});
|
||||
const exited = new Promise<number>((resolve) => {
|
||||
child.onExit(({ exitCode }) => resolve(exitCode));
|
||||
});
|
||||
|
||||
expect(await exited).toBe(0);
|
||||
expect(output).toContain("STARTED");
|
||||
},
|
||||
30_000,
|
||||
);
|
||||
|
||||
it("retains the final lines after output far exceeds the recent-output char cap", async () => {
|
||||
// Emit many small chunks whose total length is well past the 16000-char
|
||||
// recent-output cap, so the chunk-trimming path runs repeatedly. The final
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
diff --git a/node_modules/node-pty/lib/windowsPtyAgent.js b/node_modules/node-pty/lib/windowsPtyAgent.js
|
||||
index 90ffd8f..d9567b1 100644
|
||||
--- a/node_modules/node-pty/lib/windowsPtyAgent.js
|
||||
+++ b/node_modules/node-pty/lib/windowsPtyAgent.js
|
||||
@@ -21,7 +21,10 @@ var conptyNative;
|
||||
* has started.
|
||||
*/
|
||||
var FLUSH_DATA_INTERVAL = 1000;
|
||||
-var CONNECTION_TIMEOUT = 5000;
|
||||
+// Paseo: the output worker is a worker thread that reports ready by message. A busy event loop
|
||||
+// or a loaded machine can delay that message past 5 s, and the spawn then fails with exit
|
||||
+// code -1 before the program starts. Wait 30 s instead; a worker that fails still errors at once.
|
||||
+var CONNECTION_TIMEOUT = 30000;
|
||||
var defaultWindowsPtyAgentOptions = {
|
||||
connectionTimeout: CONNECTION_TIMEOUT,
|
||||
conoutConnectionFactory: function (conoutPipeName, useConptyDll) { return new windowsConoutConnection_1.ConoutConnection(conoutPipeName, useConptyDll); }
|
||||
@@ -123,14 +123,6 @@ const patchedPackages = [
|
||||
patchPrefix: "@opencode-ai+sdk+",
|
||||
cwd: "packages/server",
|
||||
},
|
||||
// Windows: wait 30 s instead of 5 s for the ConPTY output worker to report ready. A loaded
|
||||
// machine delays that message past 5 s, and the program then exits with code -1 before it
|
||||
// starts. Upstream keeps 5 s through 1.2.0-beta.18; keep while the server uses node-pty.
|
||||
{
|
||||
nodeModulesPath: "packages/server/node_modules/node-pty",
|
||||
patchPrefix: "node-pty+",
|
||||
cwd: "packages/server",
|
||||
},
|
||||
];
|
||||
|
||||
const installedPackages = patchedPackages.filter(({ nodeModulesPath }) =>
|
||||
|
||||
Reference in New Issue
Block a user