Skip to content

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.

fix(ide): never leave a terminal pane stuck behind its rebuild curtain

rubenluetke10-beep9b8ea5e764a6
diff --git a/AGENTS.md b/AGENTS.md
index 20fd9069a4..37a1f69d87 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -18,7 +18,9 @@ These cost real bugs. Nothing catches them but you.
- **Restore trap.** A fix works in tests and changes nothing after restart:
live Python imports from elsewhere. New worktree → `pwsh scripts/preflight.ps1`,
- then `python -c "import jarvis; print(jarvis.__file__)"`. (AP-8)
+ then `python -c "import jarvis; print(jarvis.__file__)"`. (AP-8) Never
+ `pip install -e` from a linked worktree: that pin is the user's desktop app,
+ and their next restart boots your branch with an empty `data/`. (BUG-219)
- **The working tree is SHARED** with other agent sessions. Stage only YOUR
paths — `git add -p` or an explicit pathspec, and `git commit --only -- <paths>`.
`git add -A` sweeps someone else's half-finished work into your commit.
diff --git a/CLAUDE.md b/CLAUDE.md
index 20fd9069a4..37a1f69d87 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -18,7 +18,9 @@ These cost real bugs. Nothing catches them but you.
- **Restore trap.** A fix works in tests and changes nothing after restart:
live Python imports from elsewhere. New worktree → `pwsh scripts/preflight.ps1`,
- then `python -c "import jarvis; print(jarvis.__file__)"`. (AP-8)
+ then `python -c "import jarvis; print(jarvis.__file__)"`. (AP-8) Never
+ `pip install -e` from a linked worktree: that pin is the user's desktop app,
+ and their next restart boots your branch with an empty `data/`. (BUG-219)
- **The working tree is SHARED** with other agent sessions. Stage only YOUR
paths — `git add -p` or an explicit pathspec, and `git commit --only -- <paths>`.
`git add -A` sweeps someone else's half-finished work into your commit.
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.test.tsx
index d106b1cc39..a5800df8d3 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.test.tsx
@@ -189,6 +189,7 @@ vi.mock("@/lib/agenticIdeApi", () => ({ attachToTerminal: vi.fn() }));
import {
AgenticTerminal,
+ CURTAIN_MAX_MS,
DRAG_REFIT_MS,
REBUILD_QUIET_MS,
RESIZE_PARSE_WAIT_MS,
@@ -565,6 +566,53 @@ describe("AgenticTerminal layout", () => {
expect(region?.className).not.toContain("invisible");
});
+ it("lifts a replay curtain even when the reveal frame never arrives", () => {
+ // A WebView that believes its window is hidden stops delivering animation
+ // frames, and the reveal is chained behind one. Before the watchdog that
+ // left the pane an empty black rectangle under a green "live" dot until
+ // something unrelated rebuilt it (reported 2026-09-28).
+ vi.useFakeTimers();
+ render(
+ <AgenticTerminal
+ name="Dana"
+ displayName="Claude Code"
+ appearance="dark"
+ fontSize={13}
+ active
+ />,
+ );
+ const host = screen.getByTestId("agentic-terminal-host-Dana");
+ act(() => {
+ vi.advanceTimersByTime(PAST_REBUILD);
+ });
+ expect(host.style.visibility).toBe("");
+
+ const starved = vi
+ .spyOn(window, "requestAnimationFrame")
+ .mockImplementation(() => 1);
+ try {
+ terminalHarness.deferWrite = true;
+ act(() => {
+ terminalHarness.handlers.current?.onReplay?.("the screen" as never);
+ });
+ act(() => {
+ terminalHarness.writeCallbacks.shift()?.();
+ vi.advanceTimersByTime(PAST_REBUILD);
+ });
+ // The honest path is stuck on its frame…
+ expect(host.style.visibility).toBe("hidden");
+
+ act(() => {
+ vi.advanceTimersByTime(CURTAIN_MAX_MS);
+ });
+ // …and the backstop shows the pane anyway.
+ expect(host.style.visibility).toBe("");
+ expect(host.parentElement?.className).not.toContain("invisible");
+ } finally {
+ starved.mockRestore();
+ }
+ });
+
it("stays hidden while the post-replay repaint is still arriving", () => {
// The replay is only half the rebuild: the server answers a truncated or
// re-based one by nudging the agent into painting its whole screen again
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx
index 5b7c71bd1d..528236ec16 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticTerminal.tsx
@@ -216,6 +216,24 @@ export const REBUILD_QUIET_MS = 140;
*/
export const REBUILD_SETTLE_MAX_MS = 450;
+/**
+ * The longest an active pane's surface may stay behind a curtain, full stop.
+ *
+ * Every curtain in this file is lifted by a chain — a write callback, a
+ * generation check, a settle timer, then an animation frame — and every link
+ * can be dropped: a newer generation supersedes the reveal without taking the
+ * curtain down itself, and a WebView that believes its window is hidden stops
+ * delivering animation frames altogether (see `viewerMayOwn` for how long it
+ * can believe that). Either way the pane was left an empty black rectangle
+ * with a green "live" dot above it until something unrelated rebuilt it
+ * (reported 2026-09-28, one of seven panes after a bundle reload). This is
+ * the backstop that does not depend on any of those links: well past the
+ * slowest honest rebuild (a full replay parse plus {@link REBUILD_SETTLE_MAX_MS}),
+ * a pane still hidden is shown as it is. A visible scroll is a cosmetic
+ * flaw; a terminal that never comes back is not.
+ */
+export const CURTAIN_MAX_MS = 2_000;
+
/**
* The longest a geometry change waits for the pane's parser to reach a gap.
*
@@ -653,6 +671,35 @@ export function AgenticTerminal({
// "B is still rebuilding", so an old callback could otherwise reveal B.
const replayGenerationRef = useRef(0);
const replayRevealFrameRef = useRef<number | undefined>(undefined);
+ const curtainWatchdogRef = useRef<number | undefined>(undefined);
+ /**
+ * Promise that the curtain just raised comes down — see {@link CURTAIN_MAX_MS}.
+ *
+ * Re-armed by every raise, so it measures the newest curtain, and touching
+ * refs and a state setter only, so the closure the connect effect keeps from
+ * its first render stays correct. An inactive pane is hidden on purpose and
+ * is left alone; taking the stage raises (and arms) a fresh curtain.
+ */
+ const armCurtainWatchdog = () => {
+ if (curtainWatchdogRef.current !== undefined) {
+ window.clearTimeout(curtainWatchdogRef.current);
+ }
+ curtainWatchdogRef.current = window.setTimeout(() => {
+ curtainWatchdogRef.current = undefined;
+ if (!activeRef.current) return;
+ replayCurtainRef.current = false;
+ containerRef.current?.style.removeProperty("visibility");
+ setTailReady(true);
+ }, CURTAIN_MAX_MS);
+ };
+ useEffect(
+ () => () => {
+ if (curtainWatchdogRef.current !== undefined) {
+ window.clearTimeout(curtainWatchdogRef.current);
+ }
+ },
+ [],
+ );
/**
* Hold a finished rebuild back until the pane has stopped being redrawn.
*
@@ -1309,6 +1356,7 @@ export function AgenticTerminal({
container.style.visibility = "hidden";
replayCurtainRef.current = true;
setTailReady(false);
+ armCurtainWatchdog();
}
term.reset();
// A normal-buffer CLI's replay is its whole scrollback — up to the
@@ -2000,6 +2048,7 @@ export function AgenticTerminal({
}
containerRef.current?.style.setProperty("visibility", "hidden");
setTailReady(false);
+ armCurtainWatchdog();
let cancelled = false;
let frame: number | undefined;
const returningViewport = preservedViewportRef.current;