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): make a pane opened by voice visible while it starts
Ruben Lütke5edd25d12bd1
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsxindex cb195fcc25..9f25e07886 100644--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx@@ -1796,3 +1796,62 @@ describe("the workspace header row", () => {expect(screen.getByTestId("agentic-toolbar").textContent).toContain("project");});});++/**+ * Panes arrive from outside this grid — spoken across the room, or from the+ * CLI — so nothing draws the user's eye to the change, and a workspace taller+ * than its viewport puts the new pane below the fold entirely. Reported+ * 2026-07-28 as terminals that "just don't load": they had loaded, off-screen+ * and unannounced.+ */+describe("panes that appear from outside the grid", () => {+ it("scrolls the newest pane into view and marks what just arrived", () => {+ const scrollIntoView = vi.fn();+ Object.defineProperty(HTMLElement.prototype, "scrollIntoView", {+ configurable: true,+ value: scrollIntoView,+ });++ const grid = (session: SessionState) => (+ <AgenticGrid+ session={session}+ focusMode={false}+ onToggleFocus={vi.fn()}+ onClose={vi.fn()}+ onSessionChanged={vi.fn()}+ />+ );++ const view = render(+ grid(+ sessionWith([+ ["T1", 0],+ ["T2", 1],+ ]),+ ),+ );++ // Nothing was announced on mount: a restored workspace's panes are not news.+ expect(scrollIntoView).not.toHaveBeenCalled();++ view.rerender(+ grid(+ sessionWith([+ ["T1", 0],+ ["T2", 1],+ ["T3", 2],+ ["T4", 3],+ ]),+ ),+ );++ expect(scrollIntoView).toHaveBeenCalledTimes(1);+ // The panes that arrived wear a ring; the ones that were already there+ // must not, or "what is new" says nothing at all.+ expect(screen.getByTestId("pane-cell-T4").className).toContain("ring-2");+ expect(screen.getByTestId("pane-cell-T3").className).toContain("ring-2");+ expect(screen.getByTestId("pane-cell-T1").className).not.toContain("ring-2");++ Reflect.deleteProperty(HTMLElement.prototype, "scrollIntoView");+ });+});diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsxindex a19554e908..077b42178b 100644--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx@@ -906,6 +906,46 @@ export function AgenticGrid({[registerCell],);+ /*+ * A pane that appears has to be SEEN appearing.+ *+ * Panes arrive from outside this grid — "open two more Claude Code terminals"+ * spoken across the room, or the CLI — and the user is not the one who+ * pressed anything, so nothing draws their eye to the change. Worse, a+ * workspace taller than its viewport puts the new pane BELOW the fold, where+ * the honest answer to "did that work?" is a screen that looks untouched.+ * Reported 2026-07-28 as terminals that "just don't load": they had loaded,+ * off-screen and unannounced.+ *+ * Two things, both brief: the newest pane is scrolled to, and every pane that+ * just arrived wears a ring for a moment. The ring is on the CELL rather than+ * inside the terminal so it cannot be mistaken for the focus border, and it+ * expires on its own — a permanent marker would become furniture.+ */+ const [justOpened, setJustOpened] = useState<Set<string>>(() => new Set());+ // Null until the first render has been seen: on mount every pane is "new",+ // and announcing a restored workspace's eight panes would be a light show.+ const knownPanes = useRef<Set<string> | null>(null);+ useEffect(() => {+ const names = session.terminals.map((term) => term.name);+ const known = knownPanes.current;+ knownPanes.current = new Set(names);+ if (known === null) return;+ const fresh = names.filter((name) => !known.has(name));+ if (fresh.length === 0) return;+ setJustOpened(new Set(fresh));+ // The LAST one: panes are appended, so the newest is the one whose arrival+ // could have pushed the grid past its viewport. Probed rather than assumed —+ // `scrollIntoView` is absent in jsdom and in some embedded WebViews, and the+ // ring below is the half of this that matters most anyway.+ const newest = paneNodes.current.get(fresh[fresh.length - 1]);+ if (typeof newest?.scrollIntoView === "function") {+ newest.scrollIntoView({ block: "nearest", behavior: "smooth" });+ }+ const timer = window.setTimeout(() => setJustOpened(new Set()), 2600);+ return () => window.clearTimeout(timer);+ }, [session.terminals]);+/** When a pane may be picked up at all.*@@ -1402,6 +1442,12 @@ export function AgenticGrid({"absolute min-h-0 min-w-0 rounded-lg",selectedTerminals.has(term.name) &&"ring-2 ring-primary ring-offset-2 ring-offset-background",+ // Just arrived — see `justOpened`. Second to the selection ring+ // deliberately: selection is a thing the user is DOING, and it+ // must keep its own answer while panes come and go.+ justOpened.has(term.name) &&+ !selectedTerminals.has(term.name) &&+ "ring-2 ring-primary/70 ring-offset-2 ring-offset-background",maximized !== null && !isMaximized && "hidden",)}style={isMaximized ? MAXIMIZED_BOX : paneBoxStyle(box)}diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.test.tsxindex 154a25cc2a..4143763e3b 100644--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.test.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.test.tsx@@ -569,3 +569,79 @@ describe("pane refit", () => {});});});++/**+ * A pane opened by voice used to be an empty black rectangle for seconds on+ * end, and "open two more terminals" therefore looked like it had silently+ * failed (maintainer report 2026-07-28). The pane now says it is starting until+ * its agent draws something.+ */+describe("pane start-up feedback", () => {+ beforeEach(() => {+ globalThis.ResizeObserver = ResizeObserverHarness;+ terminalHarness.handlers.current = null;+ });++ afterEach(() => {+ vi.restoreAllMocks();+ });++ it("says which CLI it is starting while the pane is still blank", () => {+ render(+ <AgenticTerminal+ name="T5"+ displayName="Claude Code"+ appearance="dark"+ fontSize={13}+ />,+ );++ expect(screen.getByTestId("agentic-pane-starting-T5").textContent).toContain(+ "Starting Claude Code",+ );+ });++ it("gets out of the way as soon as the agent draws its first byte", () => {+ render(+ <AgenticTerminal+ name="T5"+ displayName="Claude Code"+ appearance="dark"+ fontSize={13}+ />,+ );++ act(() => {+ terminalHarness.handlers.current?.onOutput?.(+ "Claude Code v2.1.220" as never,+ );+ });++ expect(screen.queryByTestId("agentic-pane-starting-T5")).toBeNull();+ });++ /**+ * The overlay must never cover a pane the user could otherwise act on: an+ * exited or unreachable pane has a restart button and a reason of its own,+ * and a hopeful spinner over either would be a lie.+ */+ it("stands down when the pane reports trouble rather than progress", () => {+ render(+ <AgenticTerminal+ name="T5"+ displayName="Claude Code"+ appearance="dark"+ fontSize={13}+ />,+ );++ act(() => {+ terminalHarness.handlers.current?.onTrouble?.(+ "This terminal is no longer part of the open workspace." as never,+ false as never,+ );+ });++ expect(screen.queryByTestId("agentic-pane-starting-T5")).toBeNull();+ });+});diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsxindex 9598169a85..cf84ae9b1b 100644--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx@@ -79,6 +79,7 @@ import { robustPaste } from "@/lib/clipboard";import { installPasteBridge } from "./terminalPaste";import { createKeyEventChain } from "./terminalKeyChain";import { installNewlineBridge } from "./terminalNewline";+import { cancelPaneReflow, queuePaneReflow } from "./paneReflowQueue";import {boxOnScreen,OffscreenBuffer,@@ -291,6 +292,22 @@ export function AgenticTerminal({// Mirrored into state purely so the header can show/hide the restart button;// it transitions a handful of times per pane, never per output chunk.const [visibleStatus, setVisibleStatus] = useState<PaneStatus>("connecting");+ /*+ * Has this pane's agent drawn anything yet?+ *+ * A pane opened by voice is an EMPTY BLACK RECTANGLE for several seconds: the+ * grid renders it the moment the workspace state arrives, and the CLI inside+ * it only paints once the socket is up, a cold-start slot is free and the+ * process has booted — measured at 2.6-2.8 s on a healthy machine, longer+ * while the grid is busy relaying itself out. Nothing said so, so "open two+ * more terminals" looked like it had silently failed and the panes were+ * closed and asked for again (maintainer report 2026-07-28).+ *+ * Flipped by the first byte the agent writes, never back — a pane that has+ * painted once is a pane the user can read, whatever its socket does later.+ * Reconnects therefore stay quiet: the replayed screen is already there.+ */+ const [painted, setPainted] = useState(false);// Latest callbacks/appearance without re-running the connect effect.const onStatusRef = useRef(onStatus);const onAttachErrorRef = useRef(onAttachError);@@ -312,6 +329,10 @@ export function AgenticTerminal({const container = containerRef.current;if (!container) return;+ // A restart builds a brand-new terminal on a blank screen, so the pane owes+ // the user the same "it is coming up" answer it owed on its first mount.+ setPainted(false);+const term = new Terminal({convertEol: false,fontFamily:@@ -517,6 +538,12 @@ export function AgenticTerminal({// stream: an exit banner written straight to xterm while output is parked// would appear ABOVE the output it is supposed to follow.const writeToPane = (text: string) => {+ if (!text) return;+ // The first byte is what retires the "starting" overlay — and it is taken+ // HERE rather than at the socket, so a pane whose output is parked+ // offscreen still counts as painted. It has a screen; nobody is looking+ // at it. Cheap to call per chunk: React bails out on an unchanged value.+ setPainted(true);if (!paneVisible) recheckParked();if (paneVisible) {term.write(text);@@ -672,6 +699,11 @@ export function AgenticTerminal({// sends a PTY resize the agent redraws for. Unthrottled that is the visible// flicker while resizing.let resizeTimer: number | undefined;+ // The queued form of `sendResize`, kept as ONE stable function so the queue+ // can recognise this pane's pending reflow — both to skip a duplicate and+ // to drop it when the pane goes away. See ./paneReflowQueue for why panes+ // must not reflow in the same frame as each other.+ const reflow = () => sendResize();const scheduleResize = () => {// Nothing at all while a seam or the prompt bar is being dragged: the// pane is mid-gesture, every size it could measure is about to be@@ -681,7 +713,7 @@ export function AgenticTerminal({if (resizeTimer !== undefined) window.clearTimeout(resizeTimer);resizeTimer = window.setTimeout(() => {resizeTimer = undefined;- sendResize();+ queuePaneReflow(reflow);}, 80);};@@ -753,6 +785,9 @@ export function AgenticTerminal({return () => {disposed = true;if (resizeTimer !== undefined) window.clearTimeout(resizeTimer);+ // A queued reflow outlives the pane by up to a frame, and would then fit+ // a disposed terminal inside a detached element.+ cancelPaneReflow(reflow);window.removeEventListener("resize", scheduleResize);if (typeof document !== "undefined") {document.removeEventListener("visibilitychange", onDocumentVisible);@@ -995,6 +1030,30 @@ export function AgenticTerminal({epoch={termEpoch}appearance={appearance}/>+ {/*+ The pane says it is starting, instead of being a black rectangle.++ Only until the agent's first byte, and only while nothing has gone+ wrong: an exited or unreachable pane has its own, more specific+ answer in the header and must not be covered by a hopeful spinner.+ `pointer-events-none` throughout — the terminal underneath keeps+ every click and keystroke, so typing into a pane that is still+ booting behaves exactly as it did before.+ */}+ {!painted && visibleStatus === "connecting" && (+ <div+ data-testid={`agentic-pane-starting-${name}`}+ className="pointer-events-none absolute inset-0 flex items-center justify-center"+ >+ <div+ className="flex items-center gap-2 rounded-xl border px-4 py-2.5 text-sm text-muted-foreground"+ style={{ background: chrome.shell, borderColor: chrome.border }}+ >+ <Loader2 className="h-4 w-4 animate-spin text-primary" />+ <span>Starting {displayName}…</span>+ </div>+ </div>+ )}</div>{(dragging || attaching) && (<div className="pointer-events-none absolute inset-0 flex items-center justify-center bg-background/70 backdrop-blur-[2px]">diff --git a/jarvis/ui/web/frontend/src/components/agentic/paneReflowQueue.test.ts b/jarvis/ui/web/frontend/src/components/agentic/paneReflowQueue.test.tsnew file mode 100644index 0000000000..f676091cb5--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/agentic/paneReflowQueue.test.ts@@ -0,0 +1,103 @@+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";++import { cancelPaneReflow, queuePaneReflow } from "./paneReflowQueue";++/**+ * The queue exists so a workspace-wide relayout cannot block the thread in one+ * go — see the module docstring for the incident. These pin the two properties+ * that gives it: reflows land one FRAME apart, and a pane that goes away takes+ * its pending reflow with it.+ */+describe("pane reflow queue", () => {+ /** Frames the test drives by hand, so ordering is asserted rather than raced. */+ let frames: FrameRequestCallback[];++ beforeEach(() => {+ frames = [];+ vi.stubGlobal("requestAnimationFrame", (callback: FrameRequestCallback) => {+ frames.push(callback);+ return frames.length;+ });+ });++ afterEach(() => {+ vi.unstubAllGlobals();+ });++ /** Run every frame currently queued (a reflow may schedule the next one). */+ const runFrame = () => {+ const due = frames;+ frames = [];+ due.forEach((callback) => callback(0));+ };++ it("runs one pane per frame instead of the whole grid at once", () => {+ const order: string[] = [];+ queuePaneReflow(() => order.push("T1"));+ queuePaneReflow(() => order.push("T2"));+ queuePaneReflow(() => order.push("T3"));++ // Nothing has run yet: queueing is not doing.+ expect(order).toEqual([]);++ runFrame();+ expect(order).toEqual(["T1"]);+ runFrame();+ expect(order).toEqual(["T1", "T2"]);+ runFrame();+ expect(order).toEqual(["T1", "T2", "T3"]);+ });++ it("ignores a second request for a pane that is already waiting", () => {+ const reflow = vi.fn();+ queuePaneReflow(reflow);+ queuePaneReflow(reflow);+ queuePaneReflow(reflow);++ runFrame();+ runFrame();++ // Once, not three times: the extra requests would measure the same element+ // and arrive at the same size a frame later.+ expect(reflow).toHaveBeenCalledTimes(1);+ });++ it("lets a pane be queued again once its reflow has run", () => {+ const reflow = vi.fn();+ queuePaneReflow(reflow);+ runFrame();+ queuePaneReflow(reflow);+ runFrame();++ expect(reflow).toHaveBeenCalledTimes(2);+ });++ it("drops the pending reflow of a pane that was closed", () => {+ const closed = vi.fn();+ const kept = vi.fn();+ queuePaneReflow(closed);+ queuePaneReflow(kept);++ cancelPaneReflow(closed);+ runFrame();+ runFrame();++ // The closed pane's fit would run against a disposed terminal inside a+ // detached element; its neighbour must still be reflowed.+ expect(closed).not.toHaveBeenCalled();+ expect(kept).toHaveBeenCalledTimes(1);+ });++ it("keeps the queue moving when one pane's reflow throws", () => {+ const after = vi.fn();+ queuePaneReflow(() => {+ throw new Error("this pane could not be measured");+ });+ queuePaneReflow(after);++ expect(() => runFrame()).not.toThrow();+ runFrame();++ expect(after).toHaveBeenCalledTimes(1);+ });+});diff --git a/jarvis/ui/web/frontend/src/components/agentic/paneReflowQueue.ts b/jarvis/ui/web/frontend/src/components/agentic/paneReflowQueue.tsnew file mode 100644index 0000000000..0ce326fc43--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/agentic/paneReflowQueue.ts@@ -0,0 +1,93 @@+/**+ * One pane reflow per frame, workspace-wide.+ *+ * Adding a pane changes the width of EVERY pane: the grid re-divides its bands,+ * so six terminals are handed six new sizes in the same tick. Each of those is+ * an xterm `resize()`, which re-wraps that pane's whole scrollback, followed by+ * a PTY resize the agent answers by repainting its full-screen UI. Run together+ * they add up to one long block of the main thread — measured at 1.5 s, 2.9 s+ * and twice at 9.4 s on the maintainer's machine while two panes were opened by+ * voice (2026-07-28). The window stops answering clicks for that whole time,+ * and the panes that were just opened cannot paint either, so "open two more+ * terminals" looks like it did nothing at all.+ *+ * The total work is unchanged — it cannot be avoided, the sizes really did all+ * change. What changes is that the browser gets the frame BETWEEN two reflows+ * back: it can paint, it can deliver a keystroke, and a pane that has finished+ * its own reflow shows its new size while its neighbours are still working.+ *+ * Deliberately module-global rather than per-grid: two workspaces can be open,+ * and both draw onto the same single thread, so a queue per grid would allow+ * exactly the pile-up this exists to prevent.+ *+ * Ordering is FIFO, and a pane already waiting is never queued twice — the+ * second request would reflow to the same measured size a frame later.+ */++/** Reflows waiting for a frame, in the order they were asked for. */+const pending: Array<() => void> = [];+/** Set membership for `pending`, so a re-queue is O(1) rather than a scan. */+const queued = new Set<() => void>();+let frame: number | null = null;++/**+ * How many reflows may share one frame.+ *+ * One, and that is the point — see the module docstring. Named rather than+ * inlined so the trade-off is visible: raising it trades responsiveness for+ * finishing the whole grid sooner.+ */+const PER_FRAME = 1;++/** Run the next reflow(s), then hand the thread back until the next frame. */+function drain(): void {+ frame = null;+ for (let i = 0; i < PER_FRAME; i += 1) {+ const next = pending.shift();+ if (next === undefined) break;+ queued.delete(next);+ try {+ next();+ } catch {+ /* one pane's fit must never stop the panes behind it in the queue */+ }+ }+ if (pending.length > 0) schedule();+}++function schedule(): void {+ if (frame !== null) return;+ // rAF, not a timer: a reflow paints, so it belongs to the frame budget. In a+ // test environment (jsdom) there is no rAF — run on a macrotask instead, which+ // preserves the ordering this queue exists for without needing a real frame.+ if (typeof requestAnimationFrame === "function") {+ frame = requestAnimationFrame(drain);+ } else {+ frame = setTimeout(drain, 0) as unknown as number;+ }+}++/**+ * Ask for `reflow` to run on a frame of its own.+ *+ * Idempotent per callback: queueing a reflow that is already waiting is a no-op,+ * because it would measure the same element and arrive at the same size.+ */+export function queuePaneReflow(reflow: () => void): void {+ if (queued.has(reflow)) return;+ queued.add(reflow);+ pending.push(reflow);+ schedule();+}++/**+ * Drop a pane's pending reflow — called when it unmounts.+ *+ * Without this a closed pane's `fit()` still runs one frame later, against a+ * disposed terminal and a detached element.+ */+export function cancelPaneReflow(reflow: () => void): void {+ if (!queued.delete(reflow)) return;+ const at = pending.indexOf(reflow);+ if (at >= 0) pending.splice(at, 1);+}