Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
fix(ide): keep neighbouring WebGL panes legible when a pane clears the glyph atlas
rubenluetke10-beepf554e545d5c0
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsxindex 01dbc1fa52..a144aba1f8 100644--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx@@ -97,7 +97,7 @@ import { describeExit, explainExit } from "./paneExit";import { PaneActivityPill } from "./PaneActivityPill";import { PaneRecap } from "./PaneRecap";import { attachToTerminal } from "@/lib/agenticIdeApi";-import { attachTerminalRenderer } from "./terminalRenderer";+import { attachTerminalRenderer, clearTerminalTextureAtlas } from "./terminalRenderer";import type { RecapReason, RecapSource } from "@/lib/agenticIdeApi";import { attachTerminalBridge } from "@/lib/editActions";import { robustCopy, robustPaste } from "@/lib/clipboard";@@ -1505,7 +1505,7 @@ export function AgenticTerminal({// A new size is a new glyph advance, and so a new floored fraction for// the canvas renderer to give back — same order as the fontSize effect.alignTerminalCells(term);- term.clearTextureAtlas?.();+ clearTerminalTextureAtlas(term);}// Measured WITHOUT being applied yet: what the tile can show is a// PROPOSAL, and the floors above have the last word on it.@@ -1862,7 +1862,7 @@ export function AgenticTerminal({// `document.fonts.ready` and re-fitting cannot fix either.const disposeFontSync = syncTerminalFont(term, () => {if (disposed) return;- term.clearTextureAtlas?.();+ clearTerminalTextureAtlas(term);sendResize();});@@ -2138,7 +2138,7 @@ export function AgenticTerminal({const term = termRef.current;if (!term) return;term.options.theme = themeFor(appearance);- term.clearTextureAtlas?.();+ clearTerminalTextureAtlas(term);}, [appearance, terminalEpoch]);useEffect(() => {@@ -2152,7 +2152,7 @@ export function AgenticTerminal({// the canvas renderer to floor away. Re-align before the fit below, or the// pane spends this size with its glyphs overhanging their cells.alignTerminalCells(term);- term.clearTextureAtlas?.();+ clearTerminalTextureAtlas(term);// Changing the font size changes the COLUMN COUNT. Fitting locally without// telling the terminal process leaves the agent formatting for the old// width — it keeps wrapping at 100 columns in a pane that now holds 80, anddiff --git a/jarvis/ui/web/frontend/src/components/agentic/terminalRenderer.test.ts b/jarvis/ui/web/frontend/src/components/agentic/terminalRenderer.test.tsindex a4f08d6efb..dac5d465da 100644--- a/jarvis/ui/web/frontend/src/components/agentic/terminalRenderer.test.ts+++ b/jarvis/ui/web/frontend/src/components/agentic/terminalRenderer.test.ts@@ -4,6 +4,7 @@ import type { ITerminalAddon, Terminal } from "@xterm/xterm";import {MAX_WEBGL_PANES,attachTerminalRenderer,+ clearTerminalTextureAtlas,resetWebglPaneCount,type RendererDeps,type WebglLike,@@ -114,3 +115,43 @@ describe("attachTerminalRenderer", () => {expect(next).toEqual(["webgl", "webgl", "canvas"]);});});++describe("clearTerminalTextureAtlas", () => {+ function clearingTerminal() {+ const t = fakeTerminal();+ let clears = 0;+ Object.assign(t.term, {+ clearTextureAtlas: () => {+ clears += 1;+ },+ });+ return { ...t, clears: () => clears };+ }++ it("makes every other WebGL pane forget the shared atlas it points into", () => {+ const a = clearingTerminal();+ const b = clearingTerminal();+ attachTerminalRenderer(a.term, undefined, deps());+ attachTerminalRenderer(b.term, undefined, deps());+ clearTerminalTextureAtlas(a.term);+ expect(a.clears()).toBe(1);+ expect(b.clears()).toBe(1);+ });++ it("leaves canvas and released panes alone", () => {+ const a = clearingTerminal();+ const b = clearingTerminal();+ const c = clearingTerminal();+ const d = deps();+ attachTerminalRenderer(a.term, undefined, d);+ const rb = attachTerminalRenderer(b.term, undefined, d);+ const refusing = { ...d, createWebgl: () => { throw new Error("no context"); } };+ attachTerminalRenderer(c.term, undefined, refusing);+ rb.dispose();+ clearTerminalTextureAtlas(a.term);+ expect(b.clears()).toBe(0);+ expect(c.clears()).toBe(0);+ clearTerminalTextureAtlas(c.term);+ expect(a.clears()).toBe(1);+ });+});diff --git a/jarvis/ui/web/frontend/src/components/agentic/terminalRenderer.ts b/jarvis/ui/web/frontend/src/components/agentic/terminalRenderer.tsindex 9ed16085dc..8708ec84ca 100644--- a/jarvis/ui/web/frontend/src/components/agentic/terminalRenderer.ts+++ b/jarvis/ui/web/frontend/src/components/agentic/terminalRenderer.ts@@ -27,6 +27,15 @@* Lost is terminal for that pane's WebGL: it does not try again, because a* GPU that just dropped a context is exactly the one that would drop it* again (AP-32: survive the loss, release what was held).+ *+ * One more trap, and it is the reason every glyph-cache clear in a pane goes+ * through {@link clearTerminalTextureAtlas}: the WebGL addon SHARES its glyph+ * atlas between every terminal with the same font and theme. A clear on one+ * pane empties that shared atlas but only forgets the glyph positions of the+ * pane that asked; every other WebGL pane keeps drawing its unchanged rows+ * from coordinates that now point at other glyphs. Seen 2026-09-28: splitting+ * a new pane (whose mount restates theme and size, each with a clear) turned+ * the idle rows of three neighbouring panes into glyph soup.*/import { CanvasAddon } from "@xterm/addon-canvas";@@ -62,9 +71,27 @@ const realDeps: RendererDeps = {let webglPanes = 0;+/** Terminals currently drawing with WebGL — the ones sharing a glyph atlas. */+const webglTerminals = new Set<Terminal>();+/** Test hook: forget every pane counted so far. */export function resetWebglPaneCount(): void {webglPanes = 0;+ webglTerminals.clear();+}++/**+ * Drop `term`'s cached glyphs — and, when it draws with WebGL, make every other+ * WebGL pane forget its glyph positions too, since the atlas they point into+ * was just emptied under them (see the module comment). Each pane re-rasterizes+ * on its next frame; this only runs on a theme, font or size change.+ */+export function clearTerminalTextureAtlas(term: Terminal): void {+ term.clearTextureAtlas?.();+ if (!webglTerminals.has(term)) return;+ for (const other of webglTerminals) {+ if (other !== term) other.clearTextureAtlas?.();+ }}export interface AttachedRenderer {@@ -94,6 +121,7 @@ export function attachTerminalRenderer(if (!counted) return;counted = false;webglPanes = Math.max(0, webglPanes - 1);+ webglTerminals.delete(term);};const loadCanvas = (): TerminalRendererKind => {@@ -113,6 +141,7 @@ export function attachTerminalRenderer(webgl = deps.createWebgl();term.loadAddon(webgl);webglPanes += 1;+ webglTerminals.add(term);counted = true;kind = "webgl";} catch {