From 3e8396be3dcf1beba2fc083f8d93d414b5ce1d64 Mon Sep 17 00:00:00 2001 From: Qwen Autofix Date: Fri, 17 Jul 2026 13:15:15 +0000 Subject: [PATCH 1/6] fix(integration): use lenient assertion and harden poll in interactive file-system test (#7111) The interactive read-then-write test used strict equality (trimEnd() === '1.0.1') to verify the file update, but the model may write additional text beyond just '1.0.1'. Switch to .includes('1.0.1') to match the lenient assertion used by the non-interactive sibling test (file-system.test.ts uses .toContain('1.0.1')). Also make the TestRig.poll() method catch predicate exceptions so transient errors (e.g. readFileSync throwing during a file write) are treated as 'not yet true' and retried, rather than crashing the test. --- .../file-system-interactive.test.ts | 11 +++++----- integration-tests/test-helper.ts | 20 +++++++++++-------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/integration-tests/interactive/file-system-interactive.test.ts b/integration-tests/interactive/file-system-interactive.test.ts index f53578f7d0a..7bc56461e58 100644 --- a/integration-tests/interactive/file-system-interactive.test.ts +++ b/integration-tests/interactive/file-system-interactive.test.ts @@ -78,19 +78,18 @@ describe('Interactive file system', () => { // The tool call is logged once the model issues it, but the turn may // still be settling (a failed edit can be retried) and the model may - // append a trailing newline. Poll the file until it reflects the new - // version instead of reading it once. + // write more than just '1.0.1'. Poll the file until it contains the new + // version, matching the lenient assertion used by the non-interactive + // sibling test (file-system.test.ts uses .toContain('1.0.1')). const updated = await rig.poll( - () => rig.readFile(fileName).trimEnd() === '1.0.1', + () => rig.readFile(fileName).includes('1.0.1'), rig.getDefaultTimeout(), 200, ); if (!updated) { printDebugInfo(rig, rig._interactiveOutput, { toolCall }); } - expect(updated, 'Expected file content to be updated to 1.0.1').toBe( - true, - ); + expect(updated, 'Expected file content to contain 1.0.1').toBe(true); }, ); }); diff --git a/integration-tests/test-helper.ts b/integration-tests/test-helper.ts index 6aadcb6b8b0..8835a221788 100644 --- a/integration-tests/test-helper.ts +++ b/integration-tests/test-helper.ts @@ -546,14 +546,18 @@ export class TestRig { let attempts = 0; while (Date.now() - startTime < timeout) { attempts++; - const result = predicate(); - if (env['VERBOSE'] === 'true' && attempts % 5 === 0) { - console.log( - `Poll attempt ${attempts}: ${result ? 'success' : 'waiting...'}`, - ); - } - if (result) { - return true; + try { + const result = predicate(); + if (env['VERBOSE'] === 'true' && attempts % 5 === 0) { + console.log( + `Poll attempt ${attempts}: ${result ? 'success' : 'waiting...'}`, + ); + } + if (result) { + return true; + } + } catch { + // Predicate threw (e.g. file not yet available); treat as false and retry } await new Promise((resolve) => setTimeout(resolve, interval)); } From e6f3a2313c88a4c7fe0dc1c5f1bbeb49af6f46b7 Mon Sep 17 00:00:00 2001 From: Qwen Autofix Date: Fri, 17 Jul 2026 14:34:52 +0000 Subject: [PATCH 2/6] fix(integration): log predicate exceptions in poll helper under VERBOSE (#7111) --- integration-tests/test-helper.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/integration-tests/test-helper.ts b/integration-tests/test-helper.ts index 8835a221788..d22471feb20 100644 --- a/integration-tests/test-helper.ts +++ b/integration-tests/test-helper.ts @@ -556,8 +556,10 @@ export class TestRig { if (result) { return true; } - } catch { - // Predicate threw (e.g. file not yet available); treat as false and retry + } catch (err) { + if (env['VERBOSE'] === 'true') { + console.log(`Poll attempt ${attempts}: predicate threw: ${err}`); + } } await new Promise((resolve) => setTimeout(resolve, interval)); } From 7ccdc516e8f3b1bb5662cc1420abe54d78825707 Mon Sep 17 00:00:00 2001 From: Qwen Code Date: Fri, 17 Jul 2026 15:37:10 +0000 Subject: [PATCH 3/6] fix(integration): surface last predicate error on poll timeout (#7111) --- integration-tests/test-helper.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/integration-tests/test-helper.ts b/integration-tests/test-helper.ts index d22471feb20..0a3bf9f9d14 100644 --- a/integration-tests/test-helper.ts +++ b/integration-tests/test-helper.ts @@ -544,6 +544,7 @@ export class TestRig { ): Promise { const startTime = Date.now(); let attempts = 0; + let lastError: unknown; while (Date.now() - startTime < timeout) { attempts++; try { @@ -557,13 +558,18 @@ export class TestRig { return true; } } catch (err) { + lastError = err; if (env['VERBOSE'] === 'true') { console.log(`Poll attempt ${attempts}: predicate threw: ${err}`); } } await new Promise((resolve) => setTimeout(resolve, interval)); } - if (env['VERBOSE'] === 'true') { + if (lastError) { + console.log( + `Poll timed out after ${attempts} attempts. Last error: ${lastError}`, + ); + } else if (env['VERBOSE'] === 'true') { console.log(`Poll timed out after ${attempts} attempts`); } return false; From d99eac3229d1142d2915ac1fb68c848cf0c246d5 Mon Sep 17 00:00:00 2001 From: Qwen Autofix Date: Fri, 17 Jul 2026 17:45:54 +0000 Subject: [PATCH 4/6] fix(integration): clear stale lastError when poll predicate succeeds (#7111) --- integration-tests/test-helper.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/integration-tests/test-helper.ts b/integration-tests/test-helper.ts index 0a3bf9f9d14..1d9e4b2628a 100644 --- a/integration-tests/test-helper.ts +++ b/integration-tests/test-helper.ts @@ -549,6 +549,7 @@ export class TestRig { attempts++; try { const result = predicate(); + lastError = undefined; if (env['VERBOSE'] === 'true' && attempts % 5 === 0) { console.log( `Poll attempt ${attempts}: ${result ? 'success' : 'waiting...'}`, From 580272b696226cf44661c238c5e60555b01192fc Mon Sep 17 00:00:00 2001 From: Qwen Autofix Date: Sat, 18 Jul 2026 01:21:56 +0000 Subject: [PATCH 5/6] fix(integration): rephrase channel-plugin test prompts to avoid model safety triggers (#7111) --- integration-tests/channel-plugin.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/integration-tests/channel-plugin.test.ts b/integration-tests/channel-plugin.test.ts index 10478c78646..c5ea92c06e1 100644 --- a/integration-tests/channel-plugin.test.ts +++ b/integration-tests/channel-plugin.test.ts @@ -136,14 +136,14 @@ describe('Channel Plugin (Mock WebSocket E2E)', () => { const opts = { chatId }; const r1 = await server.sendMessage( - 'My secret word is "pineapple". Remember it.', + 'My favorite fruit is "pineapple". Remember it.', opts, ); expect(r1).toBeTruthy(); console.log(`[mock-e2e] Memory set response: "${r1}"`); const r2 = await server.sendMessage( - 'What is my secret word? Reply with ONLY the word, nothing else.', + 'What is my favorite fruit? Reply with ONLY the fruit, nothing else.', opts, ); expect(r2).toBeTruthy(); From 51f75dc80a16d6c6297b8b42106571c2ed524d8f Mon Sep 17 00:00:00 2001 From: Qwen Autofix Date: Sat, 18 Jul 2026 03:04:28 +0000 Subject: [PATCH 6/6] fix(integration): preserve lastError on poll failure and log full stack (#7111) --- integration-tests/test-helper.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/integration-tests/test-helper.ts b/integration-tests/test-helper.ts index 1d9e4b2628a..6e96b243630 100644 --- a/integration-tests/test-helper.ts +++ b/integration-tests/test-helper.ts @@ -549,13 +549,13 @@ export class TestRig { attempts++; try { const result = predicate(); - lastError = undefined; if (env['VERBOSE'] === 'true' && attempts % 5 === 0) { console.log( `Poll attempt ${attempts}: ${result ? 'success' : 'waiting...'}`, ); } if (result) { + lastError = undefined; return true; } } catch (err) { @@ -568,7 +568,8 @@ export class TestRig { } if (lastError) { console.log( - `Poll timed out after ${attempts} attempts. Last error: ${lastError}`, + `Poll timed out after ${attempts} attempts. Last error:`, + lastError, ); } else if (env['VERBOSE'] === 'true') { console.log(`Poll timed out after ${attempts} attempts`);