Skip to content

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

Python

fix(native): clear disconnected agent selections

yxlyx86b989adf3e2
diff --git a/apps/native/components/site/AgentsPane.tsx b/apps/native/components/site/AgentsPane.tsx
index a585ef14..8d996fa8 100644
--- a/apps/native/components/site/AgentsPane.tsx
+++ b/apps/native/components/site/AgentsPane.tsx
@@ -19,6 +19,10 @@ export default function AgentsPane({ root, onClose, request = agentRequest }: {
const content = useRef<HTMLDivElement>(null);
const input = useRef<HTMLTextAreaElement>(null);
useEffect(() => { setRecipient(null); setNotice(''); setText(''); }, [root]);
+ useEffect(() => {
+ if (!snapshot || !recipient || snapshot.agents.some(agent => agentKey(agent) === agentKey(recipient))) return;
+ setRecipient(null); setNotice(''); setText(''); setComposing(false);
+ }, [snapshot, recipient]);
useEffect(() => {
let disposed = false, timer: ReturnType<typeof setTimeout>;
const controller = new AbortController();
diff --git a/apps/native/electron/agents-visual.cjs b/apps/native/electron/agents-visual.cjs
index 5e265335..3512787c 100644
--- a/apps/native/electron/agents-visual.cjs
+++ b/apps/native/electron/agents-visual.cjs
@@ -82,7 +82,11 @@ async function runAgentVisuals({ win, origin, output }) {
assert.equal(sent.target, 'peer-b'); assert.equal(sent.startId, '12'); assert.equal(sent.kind, 'message');
await js(`document.querySelector('[data-agent-case="empty"]').click()`);
await wait(`document.body.textContent.includes('No connected Graffs')`);
+ await wait(`!document.body.textContent.includes('Recipient is unavailable')`);
assert.equal(await js(`document.querySelector('button[type="submit"]').disabled`), true);
+ await js(`document.querySelector('[data-agent-case="connected"]').click()`);
+ await wait(`document.querySelectorAll('li button').length === 2`);
+ assert.equal(await js(`document.querySelector('[aria-label="Sub-agent activity"]')`), null, 'A disconnected selection does not return when the peer reconnects');
await js(`document.querySelector('[data-agent-case="error"]').click()`);
await wait(`document.querySelector('[role="alert"]')?.textContent.includes('Observer unavailable')`);
console.log('Agents visual checks passed: themes, scope, live/completed/failed children, tool disclosure, selection races, read-only inspection, explicit send, disconnection and errors.');