graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs
Python
Give the desktop shutdown fixture the same 120s budget as Electron
Rach5ce5a234f67f
diff --git a/apps/native/electron/smoke-server-lifecycle.cjs b/apps/native/electron/smoke-server-lifecycle.cjsindex b8155814..ef81ae21 100644--- a/apps/native/electron/smoke-server-lifecycle.cjs+++ b/apps/native/electron/smoke-server-lifecycle.cjs@@ -6,7 +6,11 @@ exports.run = async ({win, backend}) => {const output = process.env.GRAFF_SHUTDOWN_OUTPUT;const js = source => win.webContents.executeJavaScript(source);const until = async (condition, label) => {- const end = Date.now() + 30000;+ // Outer Electron budget is 120s; 30s here lost to CI scheduling on the+ // scripted ACP turn (listener + HTTP check + completion text).+ const budget = Number(process.env.GRAFF_TEST_TIMEOUT_MS);+ const ms = Number.isFinite(budget) && budget >= 10000 ? Math.min(budget, 120000) : 90000;+ const end = Date.now() + ms;while (Date.now() < end) { if (await condition()) return; await sleep(50); }throw Error(`Shutdown fixture timed out: ${label}`);};diff --git a/apps/native/scripts/test-server-desktop.mjs b/apps/native/scripts/test-server-desktop.mjsindex e6bb62df..318adfd8 100644--- a/apps/native/scripts/test-server-desktop.mjs+++ b/apps/native/scripts/test-server-desktop.mjs@@ -26,7 +26,7 @@ for(const pinned of [false,true]) {fs.writeFileSync(path.join(workspace,'listener.py'),"import os,json,socket\nsocket.getfqdn=lambda *_: (_ for _ in ()).throw(RuntimeError('unexpected hostname lookup'))\nfrom pathlib import Path\nfrom http.server import HTTPServer,BaseHTTPRequestHandler\nfrom socketserver import TCPServer\nclass NumericHTTPServer(HTTPServer):\n def server_bind(self):\n TCPServer.server_bind(self)\n self.server_name,self.server_port=self.server_address[:2]\nclass Handler(BaseHTTPRequestHandler):\n def do_GET(self):\n print('request served',flush=True)\n self.send_response(200);self.end_headers();self.wfile.write(b'ready')\ns=NumericHTTPServer(('127.0.0.1',0),Handler)\nPath('listener.json').write_text(json.dumps({'pid':os.getpid(),'port':s.server_port}))\ns.serve_forever()\n");fs.writeFileSync(path.join(workspace,'ready.py'),"import json,time,urllib.request\nfrom pathlib import Path\nfor _ in range(100):\n if Path('listener.json').exists():break\n time.sleep(.05)\nr=json.loads(Path('listener.json').read_text());body=urllib.request.urlopen('http://127.0.0.1:'+str(r['port']),timeout=2).read();assert body==b'ready',body;print('HTTP response verified: ready')\n");const script=path.join(temp,'script.json'),mcp=path.join(temp,'mcp.json');fs.writeFileSync(mcp,'{"mcpServers":{}}');fs.writeFileSync(script,JSON.stringify([{tool:'bash',arguments:{command:'python3 listener.py',run_in_background:true}},{tool:'bash',arguments:{command:'python3 ready.py'}},{text:'Listener ready for shutdown.'}]));- const env={...process.env,HOME:temp,LMSTUDIO_API_KEY:'local',GRAFF_CWD:workspace,GRAFF_ELECTRON_RESOURCES:resources,GRAFF_ELECTRON_SMOKE:path.join(out,'smoke.json'),GRAFF_SMOKE_SERVER_LIFECYCLE:'1',GRAFF_SHUTDOWN_OUTPUT:out,GRAFF_SHUTDOWN_PIN:pinned?'1':'0',GRAFF_SMOKE_PROFILE:path.join(temp,'profile'),GRAFF_MCP_CONFIG:mcp,GRAFF_NO_TELEMETRY:'1',GRAFF_FLEET:'off',GRAFF_NO_SMOLIFY:'1',GRAFF_NO_CODEDB_GUARD:'1'};+ const env={...process.env,HOME:temp,LMSTUDIO_API_KEY:'local',GRAFF_CWD:workspace,GRAFF_ELECTRON_RESOURCES:resources,GRAFF_ELECTRON_SMOKE:path.join(out,'smoke.json'),GRAFF_SMOKE_SERVER_LIFECYCLE:'1',GRAFF_SHUTDOWN_OUTPUT:out,GRAFF_SHUTDOWN_PIN:pinned?'1':'0',GRAFF_SMOKE_PROFILE:path.join(temp,'profile'),GRAFF_MCP_CONFIG:mcp,GRAFF_NO_TELEMETRY:'1',GRAFF_FLEET:'off',GRAFF_NO_SMOLIFY:'1',GRAFF_NO_CODEDB_GUARD:'1',GRAFF_TEST_TIMEOUT_MS:process.env.GRAFF_TEST_TIMEOUT_MS||'120000'};for(const key of Object.keys(env))if(key.endsWith('_API_KEY')&&key!=='LMSTUDIO_API_KEY')delete env[key];const fd=fs.openSync(path.join(out,'model.log'),'w'),model=spawn('python3',[path.join(repo,'scripts/eval/frontend_model.py'),'--script',script,'--requests',path.join(out,'requests.json')],{env,stdio:['ignore',fd,fd]});fs.closeSync(fd);const unrelated=net.createServer(s=>s.end());await new Promise(r=>unrelated.listen(0,'127.0.0.1',r));