Skip to content

Commit 3f6aac3

Browse files
committed
update
1 parent e756e47 commit 3f6aac3

File tree

2 files changed

+24
-13
lines changed

2 files changed

+24
-13
lines changed

.github/workflows/chat-perf.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ on:
3232
required: false
3333
type: number
3434
default: 0.2
35+
skip_leak_check:
36+
description: 'Skip the memory leak check step'
37+
required: false
38+
type: boolean
39+
default: true
3540

3641
permissions:
3742
contents: read
@@ -132,6 +137,7 @@ jobs:
132137

133138
- name: Run memory leak check
134139
id: leak
140+
if: inputs.skip_leak_check != true
135141
run: |
136142
LEAK_ARGS="--verbose"
137143
if [[ -n "$TEST_COMMIT" ]]; then
@@ -154,7 +160,7 @@ jobs:
154160
echo "⚠️ No summary file generated. Check perf-output.log artifact." >> "$GITHUB_STEP_SUMMARY"
155161
fi
156162
157-
if [[ -f .chat-simulation-data/chat-simulation-leak-results.json ]]; then
163+
if [[ "${{ inputs.skip_leak_check }}" != "true" && -f .chat-simulation-data/chat-simulation-leak-results.json ]]; then
158164
echo "" >> "$GITHUB_STEP_SUMMARY"
159165
echo "## Memory Leak Check" >> "$GITHUB_STEP_SUMMARY"
160166
echo "" >> "$GITHUB_STEP_SUMMARY"
@@ -192,12 +198,12 @@ jobs:
192198
retention-days: 30
193199

194200
- name: Fail on regression
195-
if: steps.perf.outcome == 'failure' || steps.leak.outcome == 'failure'
201+
if: steps.perf.outcome == 'failure' || (inputs.skip_leak_check != true && steps.leak.outcome == 'failure')
196202
run: |
197203
if [[ "${{ steps.perf.outcome }}" == "failure" ]]; then
198204
echo "::error::Chat performance regression detected. See job summary for details."
199205
fi
200-
if [[ "${{ steps.leak.outcome }}" == "failure" ]]; then
206+
if [[ "${{ inputs.skip_leak_check }}" != "true" && "${{ steps.leak.outcome }}" == "failure" ]]; then
201207
echo "::error::Chat memory leak detected. See leak-output.log for details."
202208
fi
203209
exit 1

scripts/chat-simulation/test-chat-perf-regression.js

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ async function runOnce(electronPath, scenario, mockServer, verbose, runIndex, ru
244244
await extHostInspector.send('Profiler.enable');
245245
await extHostInspector.send('Profiler.start');
246246
extHostHeapBefore = await extHostInspector.send('Runtime.getHeapUsage');
247-
if (verbose) {
247+
if (verbose && extHostHeapBefore) {
248248
console.log(` [ext-host] Heap before: ${Math.round(extHostHeapBefore.usedSize / 1024 / 1024)}MB`);
249249
}
250250
} catch (err) {
@@ -417,27 +417,32 @@ async function runOnce(electronPath, scenario, mockServer, verbose, runIndex, ru
417417
await window.locator(actualInputSelector).pressSequentially(userTurn.message, { delay: 0 });
418418
}
419419

420-
// Note current response count before submitting
421-
const responseCountBefore = await window.evaluate((sel) => {
422-
return document.querySelectorAll(sel).length;
423-
}, responseSelector);
424-
425420
// Submit follow-up
426421
const utCompBefore = mockServer.completionCount();
427422
await window.keyboard.press('Enter');
428423

429424
// Wait for mock server to serve the response for this turn
430425
try { await mockServer.waitForCompletion(utCompBefore + 1, 60_000); } catch { }
431426

432-
// Wait for a new response element to appear and settle
427+
// Wait for the new response to finish rendering.
428+
// The chat list is virtualized — old response elements are
429+
// recycled out of the DOM as new ones appear, so we cannot
430+
// rely on counting DOM elements. Instead, scroll to the
431+
// bottom and wait for no response to be in loading state.
433432
await dismissDialog();
433+
await window.evaluate((chatViewSel) => {
434+
const input = document.querySelector(chatViewSel + ' .interactive-input-part');
435+
if (input) { input.scrollIntoView({ block: 'end' }); }
436+
}, CHAT_VIEW);
437+
await new Promise(r => setTimeout(r, 200));
438+
434439
await window.waitForFunction(
435-
({ sel, prevCount }) => {
440+
(sel) => {
436441
const responses = document.querySelectorAll(sel);
437-
if (responses.length <= prevCount) { return false; }
442+
if (responses.length === 0) { return false; }
438443
return !responses[responses.length - 1].classList.contains('chat-response-loading');
439444
},
440-
{ sel: responseSelector, prevCount: responseCountBefore },
445+
responseSelector,
441446
{ timeout: 30_000 },
442447
);
443448
responseCompleteTime = Date.now();

0 commit comments

Comments
 (0)