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(agentic-ide): keep every pane at the chosen terminal text size
rubenluetke10-beepb7abaaf23414
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.test.tsxindex 65d7b4d264..aa0b28ac4c 100644--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.test.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.test.tsx@@ -20,6 +20,16 @@ const terminalHarness = vi.hoisted(() => ({write: vi.fn(),deferWrite: false,writeCallbacks: [] as (() => void)[],+ /**+ * Every terminal this pane has built, oldest first.+ *+ * A pane replaces its terminal without remounting — the grid re-measuring,+ * a restart, a rename — and what the REPLACEMENT is built with is exactly+ * where a pane lost the reader's text size. So the double keeps the options+ * it was constructed with rather than starting from an empty object, and the+ * list makes the newest instance reachable from a test.+ */+ instances: [] as { options: Record<string, unknown> }[],}));vi.mock("@xterm/xterm", () => ({@@ -30,8 +40,14 @@ vi.mock("@xterm/xterm", () => ({get rows() {return terminalHarness.size.rows;}- options: Record<string, unknown> = {};+ options: Record<string, unknown>;unicode = { activeVersion: "" };++ constructor(options: Record<string, unknown> = {}) {+ this.options = { ...options };+ terminalHarness.instances.push(this);+ }+// The pane silences xterm's own answers to the agent's protocol queries// (see ./terminalQueries). The double only has to accept the handlers.parser = {@@ -991,3 +1007,105 @@ describe("renaming a pane", () => {expect(screen.queryByTestId("pane-rename-input-T1")).toBeNull();});});++/*+ * The toolbar's text size is an ACCESSIBILITY control: somebody who cannot+ * comfortably read 13px sets 20 once and expects every pane to be readable,+ * not the one they happen to be typing in.+ *+ * What broke that was invisible in every earlier test, because the terminal+ * double ignored the options it was constructed with: the pane froze the size+ * and theme it first rendered with and handed them to every terminal it built+ * afterwards. A pane replaces its terminal without remounting — the grid+ * re-measures and `geometryReady` flips, a pane is restarted or renamed — and+ * since the size effect fires on CHANGES, nothing came along afterwards to+ * correct the resurrected value. The panes rebuilt since the last change sat+ * at the startup size for good, next to the ones that were not.+ */+describe("terminal text size across a rebuild", () => {+ beforeEach(() => {+ terminalHarness.instances.length = 0;+ globalThis.ResizeObserver = ResizeObserverHarness;+ });++ afterEach(() => {+ vi.restoreAllMocks();+ });++ const newest = () => terminalHarness.instances[terminalHarness.instances.length - 1];++ it("builds a replacement terminal at the size the user is looking at", () => {+ const view = render(+ <AgenticTerminal name="Dana" displayName="Claude Code" appearance="dark" fontSize={13} />,+ );+ expect(newest().options.fontSize).toBe(13);++ // The reader turns the text up while the pane is live.+ view.rerender(+ <AgenticTerminal name="Dana" displayName="Claude Code" appearance="dark" fontSize={20} />,+ );+ expect(newest().options.fontSize).toBe(20);++ // ...and the grid is re-measured, which rebuilds the terminal underneath a+ // pane that never unmounted. This is the pane the user was NOT typing in.+ view.rerender(+ <AgenticTerminal+ name="Dana"+ displayName="Claude Code"+ appearance="dark"+ fontSize={20}+ geometryReady={false}+ />,+ );+ view.rerender(+ <AgenticTerminal+ name="Dana"+ displayName="Claude Code"+ appearance="dark"+ fontSize={20}+ geometryReady+ />,+ );++ expect(terminalHarness.instances.length).toBeGreaterThan(1);+ expect(newest().options.fontSize).toBe(20);+ });++ it("restates the size to a terminal restarted after the change", () => {+ const view = render(+ <AgenticTerminal+ name="Dana"+ displayName="Claude Code"+ appearance="dark"+ fontSize={13}+ restartToken={0}+ />,+ );+ // Copied now: the live restyle below writes the new theme onto THIS+ // instance too, so reading it afterwards would compare light against light.+ const openedWith = { ...(newest().options.theme as Record<string, unknown>) };+ view.rerender(+ <AgenticTerminal+ name="Dana"+ displayName="Claude Code"+ appearance="light"+ fontSize={18}+ restartToken={0}+ />,+ );+ view.rerender(+ <AgenticTerminal+ name="Dana"+ displayName="Claude Code"+ appearance="light"+ fontSize={18}+ restartToken={1}+ />,+ );++ // The theme travels with the size: both were frozen by the same ref, so a+ // restarted pane came back in the palette it opened with.+ expect(newest().options.fontSize).toBe(18);+ expect(newest().options.theme).not.toEqual(openedWith);+ });+});diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsxindex 99c03fb5f0..f0301ff052 100644--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx@@ -1158,19 +1158,30 @@ export function AgenticTerminal({};}, [active]);- // Live restyle — no reconnect, so the running agent is untouched. The canvas- // renderer caches rendered glyphs per colour in a texture atlas, so a theme- // change has to invalidate it or the old palette keeps being painted.+ /*+ * Live restyle — no reconnect, so the running agent is untouched. The canvas+ * renderer caches rendered glyphs per colour in a texture atlas, so a theme+ * change has to invalidate it or the old palette keeps being painted.+ *+ * `terminalEpoch` is in here, and in the size effect below, for a reason the+ * appearance prop alone cannot cover: these effects fire on CHANGES, and the+ * terminal underneath them can be replaced without one. Every rebuild bumps+ * the epoch, so the pane restates the current theme and size to the new+ * terminal instead of trusting that it was born with them.+ */useEffect(() => {const term = termRef.current;if (!term) return;term.options.theme = themeFor(appearance);term.clearTextureAtlas?.();- }, [appearance]);+ }, [appearance, terminalEpoch]);useEffect(() => {const term = termRef.current;if (!term) return;+ // A no-op on a terminal already built at this size (xterm's setter drops a+ // write of the identical value), which is what makes restating it on every+ // rebuild free.term.options.fontSize = fontSize;// A new size is a new glyph advance, and so a new fraction of a pixel for// the canvas renderer to floor away. Re-align before the fit below, or the@@ -1183,7 +1194,7 @@ export function AgenticTerminal({// every line breaks in the wrong place. The two must move together, so this// goes through the same resize path the observer uses.resizeRef.current?.();- }, [fontSize]);+ }, [fontSize, terminalEpoch]);/** Refit when the pane is maximized, and again when it is restored.