Skip to content

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

Python

fix(native): a window that missed the model catalog now asks again

justrach147b244aea89
diff --git a/apps/native/components/site/GraffHarness.tsx b/apps/native/components/site/GraffHarness.tsx
index c266bdb9..5b4f87b1 100644
--- a/apps/native/components/site/GraffHarness.tsx
+++ b/apps/native/components/site/GraffHarness.tsx
@@ -205,6 +205,24 @@ export default function GraffHarness() {
}
};
+ // The picker falls back to a built-in list until the agent answers with
+ // what it actually has. A window that missed that answer — its agent was
+ // not up yet, or the page outlived a restart — would show the fallback
+ // for good, so ask again whenever the window comes back to the front.
+ const catalogRef = useRef({ adopt: (_: number) => {}, activeId: 1 });
+ useEffect(() => {
+ const again = () => {
+ if (document.visibilityState === "hidden") return;
+ catalogRef.current.adopt(catalogRef.current.activeId);
+ };
+ window.addEventListener("focus", again);
+ document.addEventListener("visibilitychange", again);
+ return () => {
+ window.removeEventListener("focus", again);
+ document.removeEventListener("visibilitychange", again);
+ };
+ }, []);
+
const requireSession = async (chatId: number, reset = false, key?: string): Promise<string> => {
const live = sessionsRef.current.get(chatId);
if (!reset && live) return live;
@@ -1015,6 +1033,8 @@ export default function GraffHarness() {
return () => window.removeEventListener("keydown", onKey);
}, []);
+ catalogRef.current = { adopt: (id: number) => void adoptCatalog(id).catch(() => undefined), activeId };
+
const paneTodos = lastAssistant?.turn.todos ?? [];
// The active chat is the first column; the panes follow it. A chat that
// was closed, or became the active one, leaves the split rather than