Skip to content

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

Python

fix: reapply the benchmark draft until Send enables

Cursor Agent52f0f344a6d9
diff --git a/apps/native/electron/performance-benchmark.cjs b/apps/native/electron/performance-benchmark.cjs
index e2186e81..16bb373a 100644
--- a/apps/native/electron/performance-benchmark.cjs
+++ b/apps/native/electron/performance-benchmark.cjs
@@ -87,8 +87,15 @@ app.whenReady().then(async () => {
processMetrics: app.getAppMetrics().map(item => ({ type: item.type, rssMiB: item.memory.workingSetSize / 1024 })) };
};
const send = async name => {
- await js(`(()=>{window.benchmarkCase=${JSON.stringify(name)};const input=document.querySelector('textarea[aria-label="Prompt"]');Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype,'value').set.call(input,'Run the synthetic '+window.benchmarkCase+' workload');input.dispatchEvent(new Event('input',{bubbles:true}));})()`);
- await wait(`!document.querySelector('[aria-label="Send"]').disabled`);
+ const prompt = `Run the synthetic ${name} workload`;
+ // A single native value write can land before React's listener is attached.
+ // Reapply until Send enables instead of waiting out the 30s timeout.
+ for (let i = 0; i < 1200; i++) {
+ const ready = await js(`(()=>{window.benchmarkCase=${JSON.stringify(name)};const input=document.querySelector('textarea[aria-label="Prompt"]');const send=document.querySelector('[aria-label="Send"]');if(!input||!send)return false;if(!send.disabled)return true;Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype,'value').set.call(input,${JSON.stringify(prompt)});input.dispatchEvent(new Event('input',{bubbles:true}));return !send.disabled;})()`);
+ if (ready) break;
+ if (i === 1199) throw Error('Benchmark timeout: Send stayed disabled');
+ await sleep(25);
+ }
await js(`document.querySelector('[aria-label="Send"]').click()`);
await wait(`!!document.querySelector('article[aria-busy="true"]')`);
await wait(`!document.querySelector('article[aria-busy="true"]')`);