Skip to content

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

Python

Keep tab controls reachable and remove fixture hostname dependency

justrachec2c6d00e3c7
diff --git a/apps/native/components/site/SessionTabs.tsx b/apps/native/components/site/SessionTabs.tsx
index e257eb3e..8b0b76d1 100644
--- a/apps/native/components/site/SessionTabs.tsx
+++ b/apps/native/components/site/SessionTabs.tsx
@@ -17,7 +17,7 @@ export default function SessionTabs({ chats, activeId, busyIds, unreadIds, agent
const root = useRef<HTMLDivElement>(null);
useEffect(() => { root.current?.querySelector(`[data-tab-id="${activeId}"]`)?.scrollIntoView({ block: "nearest", inline: "nearest" }); }, [activeId]);
return <div ref={root} data-session-navigation={vertical ? "sidebar" : "tabs"}
- aria-label="Open chats" className={vertical ? "flex min-w-0 flex-col gap-1 px-3" : "flex min-w-0 items-center gap-1"}>
+ aria-label="Open chats" className={vertical ? "flex min-w-0 flex-col gap-1 px-3" : "flex shrink-0 items-center gap-1"}>
{chats.map((c) => (
<div
data-tab-id={c.id}
diff --git a/apps/native/electron/narrow-navigation-frontend.cjs b/apps/native/electron/narrow-navigation-frontend.cjs
index bcf9ef64..9b58092f 100644
--- a/apps/native/electron/narrow-navigation-frontend.cjs
+++ b/apps/native/electron/narrow-navigation-frontend.cjs
@@ -51,6 +51,9 @@ async function runNarrowNavigation({win, output, click, until, report}) {
await click('[aria-label="Open navigation"]');
await until(() => js(`!!document.querySelector('[data-navigation-panel]:popover-open')`), 'navigation remains reachable after tab strip scrolls');
await click('[aria-label="Close navigation"]');
+ await until(() => js(`!!document.querySelector('[data-session-navigation="tabs"]')?.checkVisibility()`), 'overflow tabs visible after navigation closes');
+ await js(`new Promise(resolve=>requestAnimationFrame(()=>requestAnimationFrame(resolve)))`);
+ fs.writeFileSync(path.join(output,'narrow-overflow-tabs.png'),(await wc.capturePage()).toPNG());
for (let i=0;i<8;i++) await click('[data-tab-id]:has(button[aria-pressed="true"]) [aria-label="Close tab"]');
// Resizing must not leave a popover or another copy of the sidebar behind.
win.setContentSize(1320, 868);
diff --git a/apps/native/scripts/test-server-desktop.mjs b/apps/native/scripts/test-server-desktop.mjs
index 49608818..e6bb62df 100644
--- a/apps/native/scripts/test-server-desktop.mjs
+++ b/apps/native/scripts/test-server-desktop.mjs
@@ -23,7 +23,7 @@ for(const pinned of [false,true]) {
fs.writeFileSync(backendFile,`import {writeFileSync as recordBackendPid} from 'node:fs';recordBackendPid(${JSON.stringify(path.join(out,'backend-pid.txt'))},String(process.pid));\n`+fs.readFileSync(backendFile,'utf8'));
fs.symlinkSync(native,path.join(resources,'native'));fs.symlinkSync(process.execPath,path.join(resources,'bun'));
fs.writeFileSync(path.join(resources,'graff'),'#!/usr/bin/env python3\nimport os,sys\nbinary='+JSON.stringify(binary)+'\nargs=sys.argv[1:]\nif args and args[0]=="acp":args += ["--model","lmstudio","--old","--yolo"]\nos.execv(binary,[binary]+args)\n',{mode:0o755});
- fs.writeFileSync(path.join(workspace,'listener.py'),"import os,json\nfrom pathlib import Path\nfrom http.server import HTTPServer,BaseHTTPRequestHandler\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=HTTPServer(('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,'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'};
@@ -34,6 +34,8 @@ for(const pinned of [false,true]) {
const end=Date.now()+10000;while(!fs.readFileSync(path.join(out,'model.log'),'utf8').includes('scripted model on')){assert(model.exitCode===null&&Date.now()<end,'fixture unavailable');await sleep(50)}
process.env.GRAFF_TEST_TIMEOUT_MS='120000';
assert.equal(await runDesktopProcess(require('electron'),[path.join(ui,'electron/server-lifecycle-entry.cjs')],env),0,'Electron fixture failed');
+ const replies=JSON.parse(fs.readFileSync(path.join(out,'requests.json'),'utf8')).flatMap(request=>request.messages||[]);
+ assert(replies.some(message=>message.role==='tool'&&message.content==='HTTP response verified: ready\n'),'agent did not observe a successful HTTP check');
const before=JSON.parse(fs.readFileSync(path.join(out,'before-quit.json'),'utf8'));
assert.deepEqual(JSON.parse(fs.readFileSync(path.join(out,'quit-observed.json'),'utf8')),{backendGone:true,workerGone:true});
assert(await connects(before.listener.port),'listener lost during quit');