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(office): start spawn-point agents without waiting for a viewer

rubenluetke10-beep15619ebe54fe
diff --git a/jarvis/agentic_ide/session.py b/jarvis/agentic_ide/session.py
index d29786f9f1..e85e5ea8e4 100644
--- a/jarvis/agentic_ide/session.py
+++ b/jarvis/agentic_ide/session.py
@@ -2489,6 +2489,24 @@ class Registry:
self._cold_start_holds.add(task)
task.add_done_callback(self._cold_start_holds.discard)
+ def start_pending(self, wanted: str, workspace_id: str | None = None) -> Terminal:
+ """Start a pane nobody has opened yet, without waiting for a viewer.
+
+ A new pane's agent is spawned by the first viewer that attaches, so a
+ pane opened from somewhere that never shows it (the office's spawn
+ point) stayed ``pending`` and its first task was given up on (live
+ 2026-10-02: T2 started only when its workspace was opened a minute
+ later). Anything other than ``pending`` is left alone: a running pane
+ must not be restarted, and an exited or failed one is the user's call.
+ """
+ found = self.find_terminal(wanted, workspace_id)
+ if found is None:
+ raise self._unknown_terminal(wanted)
+ session, term = found
+ if term.status == "pending" and not term.pty_id:
+ self._start_in_background(session, term)
+ return term
+
def _host_went_away(self) -> bool:
"""Did the PTY host this process was attached to just drop away?"""
current = self._pty
diff --git a/jarvis/ui/web/agentic_ide_routes.py b/jarvis/ui/web/agentic_ide_routes.py
index 8ad0ca0fe9..8abc04b01c 100644
--- a/jarvis/ui/web/agentic_ide_routes.py
+++ b/jarvis/ui/web/agentic_ide_routes.py
@@ -3657,6 +3657,21 @@ def _picks_now(term: Any, read_result: Any) -> dict[str, str]:
return out
[email protected]("/terminals/{name}/start", summary="Start a terminal nobody has opened yet")
+async def terminal_start(name: str, workspace: str | None = None) -> dict:
+ """Start the pane's agent now instead of when a viewer first attaches.
+
+ For callers that open panes without showing them — the office's spawn
+ point hands each new pane a task and would otherwise wait on a pane that
+ never starts. A pane that is already running is not touched.
+ """
+ try:
+ term = get_registry().start_pending(name, workspace)
+ except SessionError as exc:
+ raise HTTPException(status_code=404, detail=str(exc)) from exc
+ return {"terminal": term.name, "status": term.status}
+
+
@router.post(
"/terminals/{name}/interrupt",
summary="Interrupt what one terminal's agent is doing (Escape)",
diff --git a/jarvis/ui/web/frontend/src/components/society/office/MissionControlPanel.tsx b/jarvis/ui/web/frontend/src/components/society/office/MissionControlPanel.tsx
index 8b068ad220..efeb77ead1 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/MissionControlPanel.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/office/MissionControlPanel.tsx
@@ -18,7 +18,7 @@ import { Minus, Paperclip, Plus, X } from "lucide-react";
import { useT } from "@/i18n";
import {
attachToTerminal, fetchIdeAgents, fetchIdeProjects, fetchIdeState, fetchWorkspacePanes, interruptTerminal,
- openIdeWorkspace, openTerminal, promptTerminal,
+ openIdeWorkspace, openTerminal, promptTerminal, startTerminal,
type AgentStatus, type DropAttachment, type IdeProject, type WorkspaceCard,
} from "@/lib/agenticIdeApi";
import { openProject } from "@/lib/chatLibraryApi";
@@ -134,6 +134,13 @@ export function StartAgent() {
return;
}
setLine(i, { tone: "busy", text: t("society.office.mission_waiting").replace("{0}", name) });
+ try {
+ // A pane starts when a viewer first attaches, and nobody views it from here.
+ await startTerminal(name, wsId);
+ } catch (err) {
+ // The wait below decides; a viewer opening the pane still starts it.
+ console.warn("Mission Control: pane start request failed", err);
+ }
if (!(await waitLive(wsId, name))) {
setLine(i, { tone: "warn", text: t("society.office.mission_not_started").replace("{0}", name) });
return;
diff --git a/jarvis/ui/web/frontend/src/lib/agenticIdeApi.ts b/jarvis/ui/web/frontend/src/lib/agenticIdeApi.ts
index 3558a35000..118c6b247b 100644
--- a/jarvis/ui/web/frontend/src/lib/agenticIdeApi.ts
+++ b/jarvis/ui/web/frontend/src/lib/agenticIdeApi.ts
@@ -855,6 +855,16 @@ export function fetchTerminalTimeline(
);
}
+/** Start a pane's agent now, without a viewer attaching. A running pane is left alone. */
+export async function startTerminal(name: string, workspaceId?: string): Promise<void> {
+ const query = workspaceId ? `?workspace=${encodeURIComponent(workspaceId)}` : "";
+ const res = await fetch(
+ `/api/agentic-ide/terminals/${encodeURIComponent(name)}/start${query}`,
+ { method: "POST" },
+ );
+ if (!res.ok) throw new Error(await detail(res));
+}
+
/**
* Press Escape in the pane — the chat stage's Stop. The CLI ends its turn and
* comes back to its prompt; nothing is closed.
diff --git a/tests/unit/agentic_ide/test_start_pending.py b/tests/unit/agentic_ide/test_start_pending.py
new file mode 100644
index 0000000000..4eae0730c6
--- /dev/null
+++ b/tests/unit/agentic_ide/test_start_pending.py
@@ -0,0 +1,68 @@
+"""Starting a pane nobody is looking at (the office's spawn point).
+
+A pane's agent is spawned by the first viewer that attaches. The spawn point
+opens panes without showing them and hands each one a task, so it waited on a
+pane that never started and gave the task up (live 2026-10-02).
+"""
+
+from __future__ import annotations
+
+import asyncio
+from pathlib import Path
+
+import pytest
+
+from jarvis.agentic_ide import session as session_mod
+from jarvis.agentic_ide.session import Registry, SessionError
+from tests.fakes.fake_pty_manager import FakePtyManager
+
+
+def fake_pty() -> FakePtyManager:
+ return FakePtyManager()
+
+
+def registry(fake_pty: FakePtyManager, monkeypatch: pytest.MonkeyPatch) -> Registry:
+ monkeypatch.setattr(session_mod, "agent_argv", lambda name: (f"/usr/bin/{name}",))
+ return Registry(pty_manager=fake_pty)
+
+
+async def _settle(registry: Registry) -> None:
+ await asyncio.gather(*list(registry._cold_start_holds))
+
+
+async def test_a_pane_nobody_opened_starts_without_a_viewer(
+ registry: Registry, fake_pty: FakePtyManager, tmp_path: Path
+) -> None:
+ session = await registry.start(str(tmp_path), [{"agent": "claude"}])
+ term = session.terminals[0]
+ assert term.status == "pending"
+
+ registry.start_pending(term.name, session.id)
+ await _settle(registry)
+
+ assert term.status == "live"
+ assert len(fake_pty.spawns) == 1
+ assert term.viewer_output is None, "the background start must not hold the viewer slot"
+
+
+async def test_a_running_pane_is_not_started_twice(
+ registry: Registry, fake_pty: FakePtyManager, tmp_path: Path
+) -> None:
+ session = await registry.start(str(tmp_path), [{"agent": "claude"}])
+ term = session.terminals[0]
+ registry.start_pending(term.name, session.id)
+ await _settle(registry)
+
+ registry.start_pending(term.name, session.id)
+ await _settle(registry)
+
+ assert len(fake_pty.spawns) == 1
+
+
+async def test_an_unknown_pane_is_refused(registry: Registry, tmp_path: Path) -> None:
+ session = await registry.start(str(tmp_path), [{"agent": "claude"}])
+
+ with pytest.raises(SessionError):
+ registry.start_pending("Nobody", session.id)