Skip to content

Commit d907078

Browse files
Stabilize Node CopilotRequestHandler e2e: align idle timeout with vitest budget
session.sendAndWait defaults its session.idle wait to 60s, but these e2e tests declare a 90s vitest budget. The lower internal default became the binding constraint, so under heavy parallel CI load the full runtime spawn + WebSocket handshake + inference occasionally crossed 60s (but stayed under 90s) and failed with "Timeout after 60000ms waiting for session.idle" instead of using the budget the tests intended. Pass an explicit 80s idle timeout to each sendAndWait (headroom left for the finally-block disconnect within the 90s budget) so the effective budget matches the declared one. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent bd9379c commit d907078

3 files changed

Lines changed: 18 additions & 5 deletions

File tree

nodejs/test/e2e/copilot_request_cancel_error.e2e.test.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,11 @@ describe("CopilotRequestHandler surfaces inference errors", async () => {
143143
const session = await client.createSession({ onPermissionRequest: approveAll });
144144
try {
145145
// The callback throws on inference; the turn surfaces an error (or
146-
// completes without an assistant message) rather than hanging.
147-
await session.sendAndWait({ prompt: "Say OK." }).catch(() => undefined);
146+
// completes without an assistant message) rather than hanging. Use
147+
// an explicit idle timeout aligned with the 90s vitest budget so a
148+
// slow runtime spawn under load doesn't fire the lower (60s) default
149+
// before the inference callback is even reached.
150+
await session.sendAndWait({ prompt: "Say OK." }, 80_000).catch(() => undefined);
148151
} finally {
149152
await session.disconnect();
150153
}

nodejs/test/e2e/copilot_request_handler.e2e.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,11 @@ describe("CopilotRequestHandler — single subclass handles HTTP + WebSocket", a
355355
const session = await client.createSession({ onPermissionRequest: approveAll });
356356
let resultJson = "";
357357
try {
358-
const result = await session.sendAndWait({ prompt: "Say OK." });
358+
// Use an explicit idle timeout aligned with this test's 90s vitest
359+
// budget; the sendAndWait default (60s) is lower than the declared
360+
// budget, so under heavy parallel CI load it could fire before the
361+
// end-to-end runtime spawn + WS handshake + inference completed.
362+
const result = await session.sendAndWait({ prompt: "Say OK." }, 80_000);
359363
resultJson = JSON.stringify(result);
360364
} finally {
361365
await session.disconnect();

nodejs/test/e2e/copilot_request_session_id.e2e.test.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,10 @@ describe("CopilotRequestHandler threads the runtime session id (CAPI + BYOK)", a
258258
capiSessionId = session.sessionId;
259259
let resultJson = "";
260260
try {
261-
const result = await session.sendAndWait({ prompt: "Say OK." });
261+
// Explicit idle timeout matching this test's 90s vitest budget; the
262+
// sendAndWait default (60s) is lower than the declared budget and
263+
// can fire prematurely under heavy parallel CI load.
264+
const result = await session.sendAndWait({ prompt: "Say OK." }, 80_000);
262265
resultJson = JSON.stringify(result);
263266
} finally {
264267
await session.disconnect();
@@ -298,7 +301,10 @@ describe("CopilotRequestHandler threads the runtime session id (CAPI + BYOK)", a
298301
const byokSessionId = session.sessionId;
299302
let resultJson = "";
300303
try {
301-
const result = await session.sendAndWait({ prompt: "Say OK." });
304+
// Explicit idle timeout matching this test's 90s vitest budget; the
305+
// sendAndWait default (60s) is lower than the declared budget and
306+
// can fire prematurely under heavy parallel CI load.
307+
const result = await session.sendAndWait({ prompt: "Say OK." }, 80_000);
302308
resultJson = JSON.stringify(result);
303309
} finally {
304310
await session.disconnect();

0 commit comments

Comments
 (0)