Skip to content

Commit dde6cf6

Browse files
Stop the subagent-option E2E from waiting on a model response
The factory awaited its subagent to completion, so the test hung wherever no cached model response exists and timed out at 30s on CI. Only the runtime's acceptance of the option payload is under test, and a refused request rejects before a subagent starts. The factory now races the call against a short timer and returns as soon as the request is accepted. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 5ece6b29-8b10-47aa-ab17-b64c47f5fdcd
1 parent abe3e19 commit dde6cf6

2 files changed

Lines changed: 24 additions & 6 deletions

File tree

nodejs/test/e2e/factory.e2e.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,10 @@ it.skipIf(isInProcessTransport)(
108108
status: "completed",
109109
result: { didThrow: false },
110110
});
111-
}
111+
},
112+
// The factory abandons its subagent once the runtime has accepted the
113+
// request, so the run settles only after the runtime drains that work.
114+
60_000
112115
);
113116

114117
it.skipIf(isInProcessTransport)(

nodejs/test/e2e/fixtures/factory-extension.mjs

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,30 @@ const forwardsSubagentOptions = defineFactory({
3838
phases: [],
3939
},
4040
run: async ({ agent }) => {
41+
// Only the runtime's acceptance of the payload is under test. A refused
42+
// request rejects quickly, because the runtime parses the options before
43+
// it starts a subagent. A subagent that is merely slow to reach a model
44+
// proves the payload was accepted, so waiting for it adds nothing and
45+
// hangs wherever no model is reachable.
46+
const call = agent("Confirm that this request is accepted.", {
47+
agent: "reviewer",
48+
reasoningEffort: "high",
49+
contextTier: "long_context",
50+
});
51+
// A rejection that lands after the race still needs a handler.
52+
call.catch(() => {});
53+
let settleTimer;
54+
const stillPending = new Promise((resolve) => {
55+
settleTimer = setTimeout(() => resolve(undefined), 3000);
56+
settleTimer.unref?.();
57+
});
4158
try {
42-
await agent("Confirm that this request is accepted.", {
43-
agent: "reviewer",
44-
reasoningEffort: "high",
45-
contextTier: "long_context",
46-
});
59+
await Promise.race([call, stillPending]);
4760
return { didThrow: false };
4861
} catch {
4962
return { didThrow: true };
63+
} finally {
64+
clearTimeout(settleTimer);
5065
}
5166
},
5267
});

0 commit comments

Comments
 (0)