Skip to content

graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs

Python

Scope close-dialog dismissal to the confirmation

Cursor Agent6e26d007be49
diff --git a/apps/native/electron/close-confirm-harness.cjs b/apps/native/electron/close-confirm-harness.cjs
index 7b125f7a..bc947148 100644
--- a/apps/native/electron/close-confirm-harness.cjs
+++ b/apps/native/electron/close-confirm-harness.cjs
@@ -33,7 +33,9 @@ async function confirmCloseDialog({ js, click, until }) {
})()`);
assert.equal(tagged, true, 'Confirmation owns a confirm button');
await click('[data-close-confirm="true"]');
- await until(() => js(`!document.querySelector('[role="dialog"]')`), 'close confirmation dismissed');
+ // Only the confirmation: narrow viewports keep the navigation panel mounted
+ // with role="dialog" while tabs close, so waiting on every dialog stalls.
+ await until(() => js(`!document.querySelector(${JSON.stringify(DIALOG)})`), 'close confirmation dismissed');
}
// Benchmark variant: that suite has no pointer helper and already clicks in-page.
diff --git a/apps/native/electron/close-confirm-harness.test.cjs b/apps/native/electron/close-confirm-harness.test.cjs
index 6e34918c..41f382f0 100644
--- a/apps/native/electron/close-confirm-harness.test.cjs
+++ b/apps/native/electron/close-confirm-harness.test.cjs
@@ -25,12 +25,19 @@ function dialog(label, buttons) {
function setup(label = 'Close tab', buttons = null) {
const state = {
dialog: dialog(label, buttons ?? [button('', { 'aria-label': 'Close' }), button('Cancel'), button(label)]),
+ // Narrow viewports keep the navigation panel mounted with role="dialog"
+ // while tabs close; dismissal must not wait on it.
+ nav: { label: 'Navigation' },
};
state.document = {
querySelector(selector) {
- if (selector === CLOSE_DIALOG || selector === '[role="dialog"]') {
+ if (selector === CLOSE_DIALOG) {
return state.dialog && state.dialog.label.startsWith('Close ') ? state.dialog : null;
}
+ if (selector === '[role="dialog"]') {
+ if (state.dialog && state.dialog.label.startsWith('Close ')) return state.dialog;
+ return state.nav;
+ }
if (selector === '[data-close-confirm="true"]') {
return state.dialog?.buttons.find(item => item.getAttribute('data-close-confirm') === 'true') ?? null;
}
diff --git a/apps/native/electron/performance-benchmark.cjs b/apps/native/electron/performance-benchmark.cjs
index 3791379c..e2186e81 100644
--- a/apps/native/electron/performance-benchmark.cjs
+++ b/apps/native/electron/performance-benchmark.cjs
@@ -10,7 +10,7 @@ const os = require('node:os');
const net = require('node:net');
const assert = require('node:assert/strict');
const { installGalleryFixture } = require('./gallery-fixture.cjs');
-const { confirmCloseDialogIfOpen } = require('./close-confirm-harness.cjs');
+const { CLOSE_DIALOG, confirmCloseDialogIfOpen } = require('./close-confirm-harness.cjs');
const { installPerformanceWorkload, frameRecorder, summarizeFrames } = require('./performance-workload.cjs');
const { treeSample } = require('./process-metrics.cjs');
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms));
@@ -162,7 +162,8 @@ app.whenReady().then(async () => {
wc.send('desktop-action', 'close'); await sleep(150);
if (await confirmCloseDialogIfOpen(js)) {
sawCloseDialog = true;
- await wait(`!document.querySelector('[role="dialog"]')`);
+ // Only the confirmation, never a co-mounted dialog (narrow navigation).
+ await wait(`!document.querySelector(${JSON.stringify(CLOSE_DIALOG)})`);
}
}
assert.ok(sawCloseDialog, 'Closing worker-backed tabs must ask for confirmation');