test(e2e): latch fast chat canaries (#4548)

This commit is contained in:
Steven Enamakel
2026-07-05 00:04:03 -07:00
committed by GitHub
parent 28b4f41f8c
commit 69bb6d9f42
2 changed files with 9 additions and 3 deletions
@@ -136,6 +136,7 @@ describe('Chat tool-call lifecycle', () => {
// Poll for a tool timeline entry while the LLM processes the tool_calls turn.
let sawToolTimeline = false;
let sawFinalAnswer = false;
const deadline = Date.now() + 45_000;
while (Date.now() < deadline) {
const snap = await snapshotRuntime(threadId);
@@ -149,6 +150,7 @@ describe('Chat tool-call lifecycle', () => {
// Also check if the final answer arrived (tool timeline may have already cleared
// if the whole turn was faster than our polling interval).
if (await textExists(CANARY_FINAL)) {
sawFinalAnswer = true;
console.log(`${LOG_PREFIX} T1.1: final answer arrived before first timeline poll`);
break;
}
@@ -157,7 +159,7 @@ describe('Chat tool-call lifecycle', () => {
// The timeline entry is the primary signal, but if the full turn completed
// before our first poll we still accept the final-answer path.
const finalArrived = await textExists(CANARY_FINAL);
const finalArrived = sawFinalAnswer || (await textExists(CANARY_FINAL));
expect(sawToolTimeline || finalArrived).toBe(true);
console.log(
`${LOG_PREFIX} T1.1: passed (sawTimeline=${sawToolTimeline}, finalArrived=${finalArrived})`
@@ -120,6 +120,7 @@ describe('User journey — full research task', () => {
this.timeout(60_000);
console.log(`${LOG_PREFIX} J1.2: watching for tool timeline entry`);
let sawToolTimeline = false;
let sawFinalAnswer = false;
const deadline = Date.now() + 45_000;
while (Date.now() < deadline) {
const snap = (await browser.execute((tid: string) => {
@@ -137,15 +138,18 @@ describe('User journey — full research task', () => {
break;
}
if (await textExists(CANARY_FINAL)) {
sawFinalAnswer = true;
console.log(`${LOG_PREFIX} J1.2: canary arrived (turn may have completed before poll)`);
break;
}
await browser.pause(200);
}
const canaryVisible = await textExists(CANARY_FINAL);
const canaryVisible = sawFinalAnswer || (await textExists(CANARY_FINAL));
expect(sawToolTimeline || canaryVisible).toBe(true);
console.log(`${LOG_PREFIX} J1.2: passed`);
console.log(
`${LOG_PREFIX} J1.2: passed (sawTimeline=${sawToolTimeline}, canaryVisible=${canaryVisible})`
);
});
it('J1.3 — final answer with canary text renders', async function () {