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): never quote a coding TUI's screen as a pane title

rubenluetke10-beep50306827d99a
diff --git a/jarvis/agentic_ide/recap.py b/jarvis/agentic_ide/recap.py
index 5409ece352..9bea390396 100644
--- a/jarvis/agentic_ide/recap.py
+++ b/jarvis/agentic_ide/recap.py
@@ -31,11 +31,14 @@ questions:
* :attr:`Recap.detail` — one or two plain sentences for the hover tooltip: what
it was asked to do, and what has happened since.
-Honest limits: a coding CLI's last printed line is a heuristic for "what it is
-doing", not a summary of the session, and a TUI that redraws a status bar as its
-bottom row will surface that instead of its last real step. So the wording never
-claims more than it knows — it quotes what the pane printed rather than
-asserting what the agent "is working on".
+Honest limits: a coding CLI's screen is mostly the CLI's own interface — its
+spinner, status bar and input box are redrawn on every frame, and no blacklist
+of chrome phrases wins against a TUI that randomizes its spinner verbs. So a
+coding pane's HEADLINE never quotes the screen at all: it names the session
+from the instruction it was sent, from the first request the user typed into
+it, or with a neutral "who, since when" label — while a plain shell, whose
+screen is a log rather than an interface, may still cite its newest row. What
+the pane last printed stays in the DETAIL, explicitly labelled as a quote.
"""
from __future__ import annotations
@@ -78,6 +81,15 @@ HEADLINE_TASK_CHARS = HEADLINE_CHARS
# is the prompt box, not something the agent did.
_INPUT_MARKERS = ("❯", ">", "›")
+# How far into the transcript's OPENING the user's first typed request is
+# looked for. The first submitted prompt is echoed near the top of the
+# scrollback, right after the CLI's banner.
+_TYPED_SEARCH_LINES = 40
+# The live input box (and the footer drawn under it) occupies the bottom rows
+# of the screen; whatever is there is an unfinished thought being typed, not
+# the session's purpose. Rows this close to the end never qualify.
+_TYPED_SKIP_TAIL = 6
+
# Fragments that mark a row as the TUI's own chrome — key hints, the context
# meter, the permission-mode banner. They are drawn on every frame, so without
# this the recap of every busy pane would read "? for shortcuts".
@@ -263,6 +275,57 @@ def _activity(tail: Sequence[str]) -> str:
return ""
+def _typed_request(rows: Sequence[str]) -> str:
+ """The first thing the user typed INTO this pane, read off its transcript.
+
+ A pane driven by hand has no ``last_prompt``, yet its purpose was stated in
+ its very first submitted prompt — which the CLI echoes into its scrollback
+ behind an input marker. That echo is USER text: the one part of a TUI's
+ screen that is safe to put in a header, because it is the same thing
+ ``last_prompt`` would have held had the instruction come through Jarvis.
+
+ Two impostors share the marker and are excluded: the LIVE input box, by
+ position (it sits in the bottom rows, and what is there is being typed
+ right now), and the box's placeholder suggestion ('Try "fix lint errors"'),
+ by its wording.
+ """
+ source = [str(row) for row in list(rows)[:-_TYPED_SKIP_TAIL]][:_TYPED_SEARCH_LINES]
+ for raw in source:
+ text = raw.strip()
+ marker = next((mark for mark in _INPUT_MARKERS if text.startswith(mark)), None)
+ if marker is None:
+ continue
+ content = text[len(marker) :].strip()
+ lowered = content.lower()
+ if lowered.startswith('try "'):
+ continue
+ if sum(1 for ch in content if ch.isalpha()) < 3:
+ continue
+ if any(fragment in lowered for fragment in _chrome_fragments()):
+ continue
+ if _bare_path_list(content):
+ continue
+ return condense(content, HEADLINE_CHARS)
+ return ""
+
+
+def _session_label(term: Any) -> str:
+ """This pane's honest self-description when nothing names the work.
+
+ Never a row off the screen: a full-screen coding CLI's screen is the CLI's
+ own interface, and quoting it produced headers reading "Churned for 1m 53s"
+ — the spinner, timestamped. A neutral "who, since when" label carries less,
+ but everything it says is true, and saying more is the job of the model
+ recap above this floor, not of a string heuristic.
+ """
+ name = str(getattr(term, "display_name", "") or getattr(term, "agent", "") or "Session")
+ started = getattr(term, "started_at", None)
+ if started:
+ clock = time.strftime("%H:%M", time.localtime(float(started)))
+ return condense(f"{name} — running since {clock}", HEADLINE_CHARS)
+ return condense(f"{name} — running", HEADLINE_CHARS)
+
+
def _task(term: Any, limit: int = TASK_CHARS) -> str:
"""The instruction this pane was last given, short enough to quote.
@@ -327,24 +390,28 @@ def _task_sentence(task: str, *, sent: int, working: bool = False) -> str:
return "No instruction has been sent to it from Jarvis yet."
-def summarize(term: Any, *, tail: Sequence[str] | None = None) -> Recap:
+def summarize(term: Any, *, lines: Sequence[str] | None = None) -> Recap:
"""Recap the session running in ``term``.
- ``tail`` lets a caller that has already read the transcript pass the rows in
- rather than have them read a second time — :meth:`Terminal.to_dict` counts
- the transcript anyway, and replaying a 600-row screen twice per poll per
- pane is a cost with nothing to show for it.
+ ``lines`` lets a caller that has already read the transcript pass the rows
+ in rather than have them read a second time — :meth:`Terminal.to_dict`
+ counts the transcript anyway, and replaying a 600-row screen twice per poll
+ per pane is a cost with nothing to show for it. The FULL rows, not a tail:
+ the headline may need the transcript's opening (the user's first typed
+ request is echoed there) while the detail quotes its newest readable row.
Duck-typed on purpose (``Terminal`` lives in :mod:`.session`, which imports
this module): every attribute is read defensively so a test double carrying
half a pane still produces a sentence instead of an ``AttributeError``.
"""
- if tail is None:
+ if lines is None:
transcript = getattr(term, "transcript", None)
try:
- tail = transcript.tail(TAIL_LINES) if transcript is not None else []
+ lines = transcript.lines() if transcript is not None else []
except Exception: # noqa: BLE001 - a recap must never break a state read
- tail = []
+ lines = []
+ rows = list(lines)
+ tail = rows[-TAIL_LINES:]
status = str(getattr(term, "status", "") or "pending")
task = _task(term)
@@ -358,11 +425,18 @@ def summarize(term: Any, *, tail: Sequence[str] | None = None) -> Recap:
# correctly saying it had stopped. Two descriptions of one pane, disagreeing
# inside a single payload.
doing = observed(term).activity
+ # Is this a coding CLI (full-screen TUI) or a plain shell? The distinction
+ # decides what the HEADLINE may quote: a shell's screen is a log of what
+ # ran, safe to cite; a TUI's screen is the TUI's own interface, and citing
+ # it is how headers came to read "Churned for 1m 53s" — the spinner.
+ coding_tui = _typed_into(term)
+ # The user's first typed request, for a pane nobody briefed through Jarvis.
+ typed = "" if task else _typed_request(rows)
# One sentence about the instruction, computed once: every branch below
# opens with it, and a plain terminal answers it differently.
asked = (
_task_sentence(task, sent=sent, working=status == "live" and bool(activity or idle))
- if _typed_into(term)
+ if coding_tui
else "This is a plain terminal — you type into it yourself."
)
@@ -389,9 +463,18 @@ def summarize(term: Any, *, tail: Sequence[str] | None = None) -> Recap:
if status == "exited":
code = getattr(term, "exit_code", None)
ended = "Finished and exited" if code in (0, None) else f"Exited with code {code}"
- closing = f"{ended}. Last output: {activity}" if activity else f"{ended}."
+ # The job still names the session — an exited pane is found in a list
+ # by what it WAS FOR, and the badge beside the title says it stopped.
+ if task:
+ headline = _task(term, HEADLINE_TASK_CHARS)
+ elif typed:
+ headline = typed
+ elif activity and not coding_tui:
+ headline = condense(f"{ended}. Last output: {activity}", HEADLINE_CHARS)
+ else:
+ headline = condense(ended, HEADLINE_CHARS)
return Recap(
- headline=condense(closing, HEADLINE_CHARS),
+ headline=headline,
detail=_sentences(
asked,
f"{ended}" + (f", last printing: {activity}." if activity else "."),
@@ -402,11 +485,15 @@ def summarize(term: Any, *, tail: Sequence[str] | None = None) -> Recap:
# this used to open with the newest readable row, on the theory that the
# freshest signal is the most useful one. It is not. The last row of a
# full-screen coding CLI is a fragment of a sentence it is halfway through
- # printing — a pane that had just written a design document reported
- # "without interrupting Claude's current work", which is a true quote and a
- # complete non-answer. What the pane was ASKED to do is at least always
- # about the job. The row it printed follows in the tooltip, and the real
- # answer to "what has it achieved" comes from .recap_engine.
+ # printing — or, worse, the CLI's own spinner: panes shipped with headers
+ # reading "Churned for 1m 53s" and "2 MCP servers need attention", true
+ # quotes of the screen and complete non-answers. So for a coding TUI the
+ # headline now NEVER quotes the screen. What names the session, in order:
+ # the instruction Jarvis sent, the first request the user typed into the
+ # pane themselves, and failing both a neutral "who, since when" label. A
+ # plain shell keeps citing its newest row — its screen is a log, not an
+ # interface. The row a TUI printed still follows in the tooltip, and the
+ # real answer to "what has it achieved" comes from .recap_engine.
#
# The job goes in BARE — no "Working on:" prefix and no quotes. The header
# is a few centimetres wide and clips the end of whatever is in it, so ten
@@ -414,8 +501,12 @@ def summarize(term: Any, *, tail: Sequence[str] | None = None) -> Recap:
# the long form below still says which of the two it is.
if task:
headline = _task(term, HEADLINE_TASK_CHARS)
- elif activity:
+ elif typed:
+ headline = typed
+ elif activity and not coding_tui:
headline = activity
+ elif activity or idle:
+ headline = _session_label(term)
else:
headline = "Running — no work visible yet"
diff --git a/jarvis/agentic_ide/recap_engine.py b/jarvis/agentic_ide/recap_engine.py
index 3529206094..e55268bb01 100644
--- a/jarvis/agentic_ide/recap_engine.py
+++ b/jarvis/agentic_ide/recap_engine.py
@@ -483,8 +483,7 @@ def recap_for(term: Any, *, lines: Sequence[str] | None = None) -> SmartRecap:
reason=WHY_SUMMARIZED,
writer=entry.writer,
)
- tail = None if lines is None else list(lines)[-recap.TAIL_LINES :]
- plain = recap.summarize(term, tail=tail)
+ plain = recap.summarize(term, lines=None if lines is None else list(lines))
return SmartRecap(
headline=plain.headline,
detail=plain.detail,
@@ -661,9 +660,7 @@ def _resolve_subscription(config: Any) -> Any | None:
try:
from jarvis.brain.resolver import resolve_subscription_brain
- return resolve_subscription_brain(
- config, cli_timeout_s=SUBSCRIPTION_CLI_TIMEOUT_S
- )
+ return resolve_subscription_brain(config, cli_timeout_s=SUBSCRIPTION_CLI_TIMEOUT_S)
except Exception: # noqa: BLE001 - a broken CLI probe must not cost the recap
logger.info("Agentic IDE recap: subscription fallback unavailable", exc_info=True)
return None
@@ -1022,7 +1019,7 @@ async def summarize_now(term: Any, *, lines: Sequence[str], folder: str = "") ->
def _floor(term: Any, rows: Sequence[str], why: str, *, note: str = "") -> SmartRecap:
"""The deterministic recap, labelled with why it is what came back."""
- plain = recap.summarize(term, tail=list(rows)[-recap.TAIL_LINES :])
+ plain = recap.summarize(term, lines=list(rows))
return SmartRecap(
headline=plain.headline,
detail=plain.detail,
diff --git a/tests/unit/agentic_ide/test_recap.py b/tests/unit/agentic_ide/test_recap.py
index 9e3f72e9e9..3676d1dafa 100644
--- a/tests/unit/agentic_ide/test_recap.py
+++ b/tests/unit/agentic_ide/test_recap.py
@@ -51,9 +51,52 @@ def test_the_instruction_beats_the_last_printed_row() -> None:
assert "Running pytest tests/unit/test_login.py" in recap.detail
-def test_the_headline_reports_the_last_printed_row_when_nothing_was_asked() -> None:
- """A pane nobody briefed still says something, from what it printed."""
+def test_a_coding_pane_never_titles_itself_with_a_screen_row() -> None:
+ """The screen of a coding TUI is the TUI's interface, not the work.
+
+ A briefless coding pane gets an honest "who, since when" label; what it
+ printed still rides in the detail, explicitly labelled as a quote.
+ """
+ term = _pane(status="live")
+ term.transcript.feed("Running pytest tests/unit/test_login.py\r\n")
+
+ recap = summarize(term)
+
+ assert recap.headline.startswith("Claude Code — running")
+ assert "Running pytest tests/unit/test_login.py" in recap.detail
+
+
+def test_the_screenshot_spinner_rows_never_become_the_headline() -> None:
+ """The bug as photographed: a sidebar full of "Churned for 1m 53s".
+
+ Claude Code randomizes its spinner verbs, so no chrome blacklist wins this
+ arms race — the fix is that a coding pane's headline never quotes the
+ screen at all.
+ """
term = _pane(status="live")
+ term.transcript.feed("✳ Churned for 1m 53s\r\n")
+ term.transcript.feed("2 MCP servers need attention\r\n")
+
+ headline = summarize(term).headline
+
+ assert "Churned" not in headline
+ assert "MCP" not in headline
+ assert headline.startswith("Claude Code — running")
+
+
+def test_the_neutral_label_says_since_when() -> None:
+ term = _pane(status="live", started_at=time.time())
+ term.transcript.feed("✳ Bootstrapping… (1s)\r\n")
+
+ headline = summarize(term).headline
+
+ assert headline.startswith("Claude Code — running since ")
+ assert "Bootstrapping" not in headline
+
+
+def test_a_shell_pane_still_quotes_its_newest_row() -> None:
+ """A plain terminal's screen IS a log — citing it is honest and useful."""
+ term = _pane(status="live", agent="shell", display_name="Terminal")
term.transcript.feed("Running pytest tests/unit/test_login.py\r\n")
assert summarize(term).headline == "Running pytest tests/unit/test_login.py"
@@ -61,7 +104,7 @@ def test_the_headline_reports_the_last_printed_row_when_nothing_was_asked() -> N
def test_a_bare_path_list_never_becomes_the_headline() -> None:
"""Search output names implementation debris, not the pane's user goal."""
- term = _pane(status="live")
+ term = _pane(status="live", agent="shell", display_name="Terminal")
term.transcript.feed("Mapped the event bus to the speech pipeline\r\n")
term.transcript.feed('"/core/bus.py", "jarvis/memory"\r\n')
@@ -77,8 +120,13 @@ def test_a_live_pane_that_printed_nothing_falls_back_to_its_instruction() -> Non
def test_tui_chrome_never_becomes_the_headline() -> None:
- """A status bar is drawn on every frame — it is not what the agent did."""
- term = _pane(status="live")
+ """A status bar is drawn on every frame — it is not what the agent did.
+
+ Pinned on a SHELL pane, because a shell is now the one kind of pane whose
+ headline may cite the screen at all; the chrome filter is what keeps that
+ citation on the work.
+ """
+ term = _pane(status="live", agent="shell", display_name="Terminal")
term.transcript.feed("Writing jarvis/core/config_writer.py\r\n")
term.transcript.feed("? for shortcuts\r\n")
term.transcript.feed("Context left until auto-compact: 34%\r\n")
@@ -86,12 +134,12 @@ def test_tui_chrome_never_becomes_the_headline() -> None:
assert summarize(term).headline == "Writing jarvis/core/config_writer.py"
-def test_the_claude_code_footer_never_becomes_the_headline() -> None:
+def test_the_claude_code_footer_never_reaches_the_detail_quote() -> None:
"""The folder/branch/model footer is redrawn on every frame — pure chrome.
- Observed live: a busy pane whose newest rows were all footer captioned
- itself "Personal Jarvis 🌿 main Opus 5 (1M context)" — three facts the pane
- header already shows elsewhere, and zero about the work.
+ A coding pane's headline no longer quotes the screen at all, so the filter
+ now earns its keep in the DETAIL: the "last printing" quote must cite the
+ work, not the footer under it.
"""
term = _pane(status="live")
term.transcript.feed("Traced the stale process to yesterday\r\n")
@@ -99,11 +147,15 @@ def test_the_claude_code_footer_never_becomes_the_headline() -> None:
term.transcript.feed("Personal Jarvis 🌿 main Opus 5 (1M context)\r\n")
term.transcript.feed("auto mode on · 1 shell\r\n")
- assert summarize(term).headline == "Traced the stale process to yesterday"
+ detail = summarize(term).detail
+
+ assert "Traced the stale process to yesterday" in detail
+ assert "auto mode on" not in detail
+ assert "Opus 5" not in detail
def test_a_hand_driven_busy_pane_does_not_claim_it_was_never_instructed() -> None:
- """"No instruction yet" on a pane that worked for hours reads as broken."""
+ """ "No instruction yet" on a pane that worked for hours reads as broken."""
term = _pane(status="live", last_output_at=time.time())
term.transcript.feed("Ran 42 tests, all green\r\n")
@@ -120,17 +172,50 @@ def test_a_live_pane_with_no_output_still_says_nothing_was_sent() -> None:
assert "No instruction has been sent" in summarize(term).detail
-def test_the_input_line_never_becomes_the_headline() -> None:
- """The prompt box is what the USER is typing, not what the agent is doing."""
+def test_the_live_input_box_never_becomes_the_headline() -> None:
+ """The prompt box is what the USER is typing RIGHT NOW — an unfinished
+ thought. It sits in the bottom rows, and those never qualify."""
term = _pane(status="live")
term.transcript.feed("Ran 42 tests, all green\r\n")
term.transcript.feed("> and now update the docs\r\n")
+ assert "update the docs" not in summarize(term).headline
+
+
+def test_the_input_line_never_becomes_a_shell_headline() -> None:
+ """Same box, shell pane: the row behind the marker is skipped, the work
+ above it is what gets cited."""
+ term = _pane(status="live", agent="shell", display_name="Terminal")
+ term.transcript.feed("Ran 42 tests, all green\r\n")
+ term.transcript.feed("> and now update the docs\r\n")
+
assert summarize(term).headline == "Ran 42 tests, all green"
-def test_bullet_glyphs_are_stripped_from_the_headline() -> None:
+def test_the_first_typed_request_titles_a_hand_driven_pane() -> None:
+ """A pane driven by hand has no last_prompt, but its purpose was stated in
+ its first submitted prompt — which the CLI echoes into the scrollback. That
+ echo is USER text, the one part of a TUI screen safe to put in a header."""
+ term = _pane(status="live")
+ term.transcript.feed("> make the workspace setup one clear screen\r\n")
+ for step in range(8):
+ term.transcript.feed(f"Working on step {step} of the setup rework\r\n")
+
+ assert summarize(term).headline == "make the workspace setup one clear screen"
+
+
+def test_the_input_boxes_placeholder_suggestion_is_not_a_request() -> None:
+ """'Try "fix lint errors"' is the CLI talking, not the user."""
term = _pane(status="live")
+ term.transcript.feed('> Try "fix lint errors"\r\n')
+ for step in range(8):
+ term.transcript.feed(f"Startup step {step} of the banner sequence\r\n")
+
+ assert summarize(term).headline.startswith("Claude Code — running")
+
+
+def test_bullet_glyphs_are_stripped_from_the_headline() -> None:
+ term = _pane(status="live", agent="shell", display_name="Terminal")
term.transcript.feed("⏺ Read jarvis/agentic_ide/session.py\r\n")
assert summarize(term).headline == "Read jarvis/agentic_ide/session.py"
@@ -169,7 +254,7 @@ def test_the_detail_says_when_the_pane_last_spoke() -> None:
def test_the_headline_is_capped_for_transport() -> None:
"""A pane that prints a wall of JSON must not push it through every poll."""
- term = _pane(status="live")
+ term = _pane(status="live", agent="shell", display_name="Terminal")
# A wide pane, so the row is not already clipped by the terminal's width.
term.transcript.resize(400, 30)
term.transcript.feed("word " * 200 + "\r\n")