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(agentic-ide): the chat view stays the chat view — a terminal detour belongs to one pane

rubenluetke10-beep566529b0042b
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx
index 2a3de3ca89..1ca3e7077d 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.test.tsx
@@ -2453,22 +2453,28 @@ describe("chat view", () => {
rerender({ jumpTo: { pane: "Aria", nonce: 1 } });
expect(screen.getByTestId("pane-chat-Aria")).toBeTruthy();
expect(screen.queryByTestId("pane-chat-Mika")).toBeNull();
- // The reading sticks: once the terminal is what is on stage, the next
- // pane asked for shows its terminal, not its chat.
+ // The terminal detour belongs to the pane it was taken for. Aria's
+ // terminal is on screen...
fireEvent.click(screen.getByTestId("pane-chat-show-terminal"));
expect(cellClass("Aria")).not.toContain("hidden");
expect(cellClass("Mika")).toContain("hidden");
+ // ...and the next pane asked for is read as a chat again, rather than
+ // inheriting a detour taken for someone else's question.
rerender({ jumpTo: { pane: "Mika", nonce: 2 } });
- expect(screen.queryByTestId("pane-chat-Mika")).toBeNull();
- expect(cellClass("Mika")).not.toContain("hidden");
+ expect(screen.getByTestId("pane-chat-Mika")).toBeTruthy();
+ expect(cellClass("Mika")).toContain("hidden");
+ expect(cellClass("Aria")).toContain("hidden");
+ // And coming back to Aria lands in her chat too: the detour is over, not
+ // parked for later.
+ rerender({ jumpTo: { pane: "Aria", nonce: 3 } });
+ expect(screen.getByTestId("pane-chat-Aria")).toBeTruthy();
expect(cellClass("Aria")).toContain("hidden");
});
- it("activates an externally added pane on its first chat-stage render", () => {
+ it("stages an externally added pane, and gives it the full stage on show-terminal", () => {
const { rerender } = renderGrid(FOUR);
toChat();
- // The terminal is what is on stage here: behind the chat every pane is
- // hidden alike, and this contract is about the pane that is SHOWN.
+ // A detour taken for the pane being read now, before the new one arrives.
fireEvent.click(screen.getByTestId("pane-chat-show-terminal"));
paneActiveHistory.clear();
@@ -2482,9 +2488,17 @@ describe("chat view", () => {
]),
});
- // Connecting once while inactive gives the PTY the narrow hidden-grid
- // geometry. The pane must own the full stage before its first effect runs.
- expect(paneActiveHistory.get("Fresh")?.[0]).toBe(true);
+ // The pane that just opened takes the stage, read as a chat — it does not
+ // inherit a terminal detour taken for the pane before it.
+ expect(screen.getByTestId("pane-chat-Fresh")).toBeTruthy();
+ expect(cellClass("Mika")).toContain("hidden");
+
+ // Its terminal is one click away, and it owns the WHOLE stage from the
+ // render it becomes visible in: a pane shown while inactive would hand the
+ // PTY the narrow hidden-grid geometry.
+ fireEvent.click(screen.getByTestId("pane-chat-show-terminal"));
+ expect(cellClass("Fresh")).not.toContain("hidden");
+ expect(paneActiveHistory.get("Fresh")?.at(-1)).toBe(true);
expect(screen.getByTestId("pane-Fresh").getAttribute("data-active")).toBe(
"yes",
);
diff --git a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx
index 844f7350ee..5f68dc2005 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/AgenticGrid.tsx
@@ -763,16 +763,24 @@ export function AgenticGrid({
*/
const [chatPane, setChatPane] = useState<string | null>(null);
/*
- * How the staged pane is drawn: as the chat (its transcript through the
- * agent chat's timeline — ./PaneChat) or as the terminal itself. Chat is the
- * default, because that is what the stage is FOR; the terminal is one click
- * away for the things only it can do — a permission prompt, a question the
- * CLI asks in its own TUI. The choice sticks across stage changes: a rail
- * click shows the next pane the way the person was reading the last one,
- * and each reading has the other one click away (the stage's "Show
- * terminal", the pane header's "Read as a chat"). No silent resets.
+ * Which ONE pane is being read as its terminal instead of as its chat.
+ *
+ * The stage draws a pane as the chat — its transcript through the agent
+ * chat's timeline (./PaneChat) — because that is what the stage is FOR. The
+ * terminal is one click away for the things only it can do: a permission
+ * prompt, a question the CLI asks inside its own TUI.
+ *
+ * That detour belongs to the PANE it was taken for, not to the stage. It
+ * used to be a stage-wide mode that stuck, on the theory that the next pane
+ * should be shown the way the person was reading the last one. In practice
+ * one click on "Show terminal", for one question, turned every session
+ * opened afterwards into a raw terminal — the chat view rendering terminals
+ * (reported 2026-08-27), with the way back a small unlabelled button in a
+ * pane header. So the stage goes back to the chat the moment it shows a
+ * different pane, and the terminal stays one click away for the pane that
+ * needs it.
*/
- const [stageMode, setStageMode] = useState<"chat" | "terminal">("chat");
+ const [terminalPane, setTerminalPane] = useState<string | null>(null);
// 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.
// Kept beside the stage selection because a newly arrived pane must be
@@ -1330,8 +1338,19 @@ export function AgenticGrid({
[chatView, chatSelected, session.terminals],
);
// The chat is on: the staged pane's cell is hidden like every other pane's,
- // and its conversation is drawn over the canvas instead.
- const chatStage = stagedTerm !== null && stageMode === "chat";
+ // and its conversation is drawn over the canvas instead. Derived rather than
+ // stored, so a stage that moves to another pane is already showing the chat
+ // on the very first render — no terminal frame flashes past on the way.
+ const chatStage = stagedTerm !== null && terminalPane !== stagedTerm.name;
+ /*
+ * The detour is over once the stage has moved on. Only tidying up after the
+ * line above, which has already put the chat back on screen: without it the
+ * pane would still be marked, and coming BACK to it later would land in the
+ * terminal again — the same surprise, one step further away.
+ */
+ useEffect(() => {
+ if (terminalPane !== null && terminalPane !== stagedTerm?.name) setTerminalPane(null);
+ }, [terminalPane, stagedTerm]);
/*
* On the chat stage, the pane being READ is the pane being TYPED and
@@ -1357,7 +1376,7 @@ export function AgenticGrid({
(term: TerminalState) => {
setChatPane(term.name);
if (takesPrompts(term)) setTarget(term.name);
- setStageMode("chat");
+ setTerminalPane(null);
setViewMode("chat");
},
[setViewMode],
@@ -1827,6 +1846,10 @@ export function AgenticGrid({
// rename leaves alone — sizes need no rekeying at all.
setTarget((current) => (current === from ? to : current));
setMaximized((current) => (current === from ? to : current));
+ // Without this the stage would drop back to the chat mid-rename: the
+ // detour is filed under the call-sign, and the pane just changed it.
+ setTerminalPane((current) => (current === from ? to : current));
+ setChatPane((current) => (current === from ? to : current));
setPendingClose((current) => (current === from ? to : current));
setSelectedTerminals((current) => {
if (!current.has(from)) return current;
@@ -2523,7 +2546,7 @@ export function AgenticGrid({
activitySince={activityOf(stagedTerm).since}
worked={activityOf(stagedTerm).worked}
status={stagedTerm.status}
- onShowTerminal={() => setStageMode("terminal")}
+ onShowTerminal={() => setTerminalPane(stagedTerm.name)}
/>
)}
{/*