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): only the pane's owner sets the screen colours its CLI is told

rubenluetke10-beepa2a8c3581083
diff --git a/jarvis/agentic_ide/session.py b/jarvis/agentic_ide/session.py
index 4dddf5a55a..7f77017360 100644
--- a/jarvis/agentic_ide/session.py
+++ b/jarvis/agentic_ide/session.py
@@ -3951,7 +3951,13 @@ class Registry:
hosted = self._hosted_for(manager).get(term.history_id)
if hosted is not None:
await self._adopt_one(manager, term, hosted)
- if appearance in THEME_COLOURS:
+ # Only a viewer that takes the pane over — or one starting its agent —
+ # may change what the CLI is told about the screen. A background viewer
+ # (an office monitor, a forgotten browser tab in light mode) used to
+ # overwrite it, and Claude Code on theme "auto" then fixed its whole
+ # palette for light: user messages on a white bar inside a dark pane.
+ running = bool(term.pty_id and manager.has(term.pty_id))
+ if appearance in THEME_COLOURS and (claim_owner or not running):
term.queries.appearance = appearance
if term.pty_id and hasattr(manager, "set_appearance"):
# A hosted agent's emulator queries are answered in the host,
diff --git a/tests/unit/agentic_ide/test_terminal_queries.py b/tests/unit/agentic_ide/test_terminal_queries.py
index fdc432a81d..db1a1442cc 100644
--- a/tests/unit/agentic_ide/test_terminal_queries.py
+++ b/tests/unit/agentic_ide/test_terminal_queries.py
@@ -66,6 +66,38 @@ async def test_the_reply_describes_the_pane_the_viewer_is_looking_at(
assert fake_pty.typed == [LIGHT_BACKGROUND_REPLY]
+async def test_a_background_viewer_does_not_repaint_the_agents_screen_colours(
+ registry: Registry, fake_pty: FakePtyManager, tmp_path: Path
+) -> None:
+ """A passive viewer on another ground must not flip a running pane.
+
+ Claude Code on theme "auto" chooses its palette from this answer. A light
+ office monitor or stray browser tab joining a dark pane turned every user
+ message in it into a white bar.
+ """
+ await registry.start(str(tmp_path), [{"agent": "claude"}])
+ term = await registry.attach("T1", 80, 24, _noop_output, _noop_exit, appearance="dark")
+ await registry.attach(
+ "T1", 80, 24, _noop_output, _noop_exit, appearance="light", claim_owner=False
+ )
+
+ await fake_pty.emit(term.pty_id, "\x1b]11;?\x07")
+
+ assert fake_pty.typed == [DARK_BACKGROUND_REPLY]
+
+
+async def test_the_viewer_taking_over_the_pane_sets_its_screen_colours(
+ registry: Registry, fake_pty: FakePtyManager, tmp_path: Path
+) -> None:
+ await registry.start(str(tmp_path), [{"agent": "claude"}])
+ term = await registry.attach("T1", 80, 24, _noop_output, _noop_exit, appearance="dark")
+ await registry.attach("T1", 80, 24, _noop_output, _noop_exit, appearance="light")
+
+ await fake_pty.emit(term.pty_id, "\x1b]11;?\x07")
+
+ assert fake_pty.typed == [LIGHT_BACKGROUND_REPLY]
+
+
async def test_a_replayed_screen_does_not_answer_its_own_old_queries(
registry: Registry, fake_pty: FakePtyManager, tmp_path: Path
) -> None: