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): every session row is titled by what it is about

rubenluetke10-beep4edf6e37efcf
diff --git a/docs/BUGS.md b/docs/BUGS.md
index bb107b2a98..2aad109df8 100644
--- a/docs/BUGS.md
+++ b/docs/BUGS.md
@@ -12988,6 +12988,112 @@ profiles, recap/prompt composers — spent on the configured primary brain
report of the callers that remembered. Meter where the object is made, not
where it is used.
+## BUG-184: coding-agent terminals drew into the top-left corner of their pane, and maximizing one did not help — a second viewer held the size and the app could not take it back (HIGH, FIXED 2026-08-25)
+
+**Symptom (maintainer, 2026-08-25, screenshot).** Three panes of a five-pane
+workspace at text size 20: the agent's lines wrapped at ~30 columns inside a
+tile that fit ~55; one pane showed the same status line twice — once in a
+small box top-left, once full-width below it; expanding a pane painted the
+agent into the upper-left corner of the enlarged tile. Another pane in the
+same screenshot was busy opening `http://127.0.0.1:47821/?view=agentic-ide`
+in a browser tab "to measure the IDE grid".
+
+**Root cause — two halves.**
+
+1. A pane may be open in several places (the desktop app, a browser tab, a
+ window a tool opened) and a pseudo-terminal has ONE size, so the server
+ hands the size to the viewer in front (`Registry.resize` owner check) and
+ answers every other viewer's request with the owner's geometry (`size`
+ frame, `report_geometry`). The pane follows it — correct while it is only
+ watching, and exactly the corner drawing once the user turns to it. Taking
+ the pane back was gated on `document.hidden`, which the desktop shell
+ misreports for minutes at a time (2026-08-23), so a click in the app did
+ nothing; and maximizing, dragging a seam or changing the text size merely
+ ASKED (`r`), which the server refused and answered with the tab's strip.
+2. A displaced viewer only learned where the PTY had gone when it next
+ asked, and a promoted survivor never learned that its size was back: the
+ owner's repaints landed in a grid drawn for another width — the doubled
+ status line.
+
+**Fix.**
+
+* `AgenticTerminal.tsx` — `viewerMayOwn` no longer consults
+ `document.hidden`; a pointer pressed on the pane claims outright
+ (`takeOwnership`); maximize, seam release and text size go through
+ `claimResize`, which claims when the window may own and refits either way;
+ an `owned` flag keeps a claim for an unchanged size from repeating, and a
+ `size` frame clears it.
+* `session.py` — `PaneViewer.geometry`: the registry announces every PTY
+ geometry change to the other attached viewers (`_announce_geometry`) and
+ tells a promoted survivor its geometry outright.
+* `agentic_ide_routes.py` — `on_geometry` schedules the `size` frame; the
+ wire format is unchanged.
+
+**Lesson.** Ownership of a shared size follows the user's gestures, not the
+browser's account of its own visibility — and a viewer that is not told when
+the size moves under it keeps a grid nobody is drawing for.
+
+## BUG-184: the Agentic IDE's middle divider dragged the top and bottom halves together, because the same 2×2 could be built two ways (MEDIUM, FIXED 2026-08-25)
+
+**Symptom (maintainer, 2026-08-25).** "When I expand terminals sideways in the
+upper area it behaves right — I can drag them around with the mouse. When I
+spawn them at the bottom they spawn completely oddly: the lower terminal and
+the upper terminal are stuck in the same position. I can drag them, but the
+upper and the lower move together. I want it to be like at the top."
+
+**Root cause.** A split tree owns each boundary at exactly one container, and
+the same picture can be built by two different trees. Splitting right and then
+down twice leaves `row[column[a, c], column[b, d]]` — the vertical line
+between the two columns belongs to the ROOT, so it runs the full height and
+one drag resizes both bands. Reaching the same 2×2 the other way round — down
+first, then right twice — leaves `column[row[a, b], row[c, d]]`, where each
+band owns its own vertical line and the two resize independently. Same
+workspace on screen, two behaviours, decided by nothing but the order the
+panes happened to be opened in. Nothing was broken; the model simply had no
+opinion, and half the orders gave the maintainer the welded version.
+
+**Fix.** One of the two readings has to win, and side-by-side boundaries are
+the ones people size — a terminal needs width for its agent's output far more
+often than a column needs its own height. So a grid now always stands on its
+rows.
+
+* `jarvis/agentic_ide/layout_tree.py` — `rows_outermost()` transposes a row of
+ equally divided columns into a column of rows. Geometry in, the SAME
+ geometry out: it moves no boundary and resizes no pane, it only changes
+ which container owns each seam. Refused unless every column divides its
+ height at the same fractions (`_is_one_grid`), which is both what keeps the
+ picture identical and what keeps the rule off a hand-dragged workspace.
+ Applied after every structural edit (`split_pane`, `append_pane`,
+ `move_pane`, `remove_pane`) and never under a seam drag — reshaping mid-drag
+ would make the workspace jump under the pointer.
+* `jarvis/agentic_ide/session.py` — a reopened workspace is squared up on the
+ way in, so an existing layout gets its per-band seams back without the user
+ having to split again.
+* `wizard_tree()` now seats its panes in READING order (`_reseat`). A tree
+ standing on its rows is read across the top band first, so filling the shape
+ column by column would have permuted the workspace — and `Registry.refold`,
+ which re-deals the panes automatically when the window gets too narrow,
+ would then no longer be undone by widening it again.
+* `grid_hints()` reads a stack of bands as exactly as it already read a row of
+ columns, so "the top-left terminal" keeps meaning what it says.
+* `jarvis/ui/web/frontend/src/components/agentic/layout.ts` — `wizardPanes`
+ mirrors the new fill order, because the wizard's preview labels its tiles
+ with the agents' own names and would otherwise show the wrong terminal in
+ the wrong cell.
+
+**Guard.** `tests/unit/web/test_agentic_ide_layout_tree.py` —
+`::test_a_grid_reached_either_way_comes_out_the_same` (the report itself: both
+split orders now land on one tree), `::test_standing_a_grid_on_its_rows_moves_nothing`
+and the `boxes()` helper that compares the two trees as PICTURES,
+`::test_columns_cut_at_different_heights_are_left_alone`,
+`::test_the_wizard_preview_seats_panes_where_the_backend_does` (the parity
+test against `layout.test.ts`, AP-4).
+
+**Lesson.** When one model can express the same picture two ways, the user
+meets whichever one their click order produced — and reads the difference as a
+bug, correctly. Pick the reading, write down why, and make every path produce
+it.
+
## BUG-185: a dictation ended in "IDE, Agentic IDE, Agentic IDE, …, Claude, Agentic IDE, Claude, Agentic" — Whisper recited its bias prompt, and the dictionary rewrote nearby common words toward the user's terms (HIGH, FIXED 2026-08-26)
**Symptom.** A 40-second German dictation (2026-08-26 17:24 UTC, Groq
@@ -13124,78 +13230,6 @@ only what is true in it.
about the OUTCOME. Every tool that acts without being able to look owes the
model the difference in a field it cannot miss — a note in prose is a caveat
the model will politely paraphrase after the good news.
-## BUG-188: Local models says every model is "not installed" and a job cannot be changed — one sweep taken while Ollama was still booting became the cache both ends read from (HIGH, FIXED 2026-08-27)
-
-**Symptom (maintainer, 2026-08-27 10:09).** The Local models section showed
-`ornith:9b` with a trailing `(not installed)`, and under it the sentence
-"Nothing installed fits this job yet; this download is the pick." Picking a
-different model in the dropdown appeared to do nothing — "it always switches
-back to that odd one, even when you choose something else." Fifteen models
-were on the server at that moment, `ornith:9b` among them.
-
-**What was actually true.** Nothing was broken in the write path. Read live
-during the investigation, the backend was correct on every count:
-
-```
-GET …/local-models/overview?fresh=1 source: live
- inventory error: None models: 11
- chat current='ornith:9b' installed=True qualifying=[10 tags]
-PUT …/local-models/roles/chat {"model":"qwen3.5:4b"} -> ok
- jarvis.toml brain.providers.ollama.model = "qwen3.5:4b"
- scripts/config-soll.json brain.providers.ollama.model = "qwen3.5:4b"
-```
-
-The pick was written, the drift baseline followed it, and a re-read answered
-the new value. The screen was simply not showing the server.
-
-**Cause — a truthful answer cached as a lasting one.** `build_overview` runs
-its sweep whatever the server's state; when Ollama does not answer it returns
-a payload with an empty inventory and `inventory.error` set. That is the right
-answer to "what can I see right now" and a ruinous one to keep, and it was
-kept twice over:
-
-* `ollama_overview._refresh` handed every payload to `save_snapshot`, so the
- offline sweep replaced the good file in `data/local_models_snapshot.json`.
- `get_overview` paints a disk snapshot for `STALE_AFTER_S` — 24 hours.
-* `useOverview` mirrored every payload into `localStorage`, and reads it back
- as react-query's `initialData` — which survives a failed refetch, so it
- outlives the outage that produced it.
-
-Opening the section while Ollama is still booting is enough. Everything
-downstream then follows from an empty inventory: `RoleState.qualifying` is
-empty, so each role reads `installed: false` and its shortlist falls back to
-"nothing installed fits this job yet".
-
-**Why the dropdown looked stuck.** `RoleLedgerRow` built its options from
-`row.qualifying` plus the configured tag. With `qualifying` empty that list
-holds exactly ONE entry — the tag already configured. There was nothing else
-to select; the "reset" the maintainer saw was a picker that had never offered
-an alternative. An unprobed download (`probed: false`, no capabilities) fell
-out of the list the same silent way. The Simple page compounded it: the
-picker lived behind a "Change" button, two clicks from the row.
-
-**Fix.**
-
-1. `ollama_overview.is_paintable()` — a payload whose inventory carries an
- error is never written to the snapshot, and one already on disk is dropped
- on read instead of painted. The previous, honest snapshot stays.
-2. `localModelsSnapshot.isPaintable()` — the same guard on the browser side,
- on both write and read.
-3. `RolePicker` offers EVERY installed download, grouped "Fits this job" /
- "Other installed models", so there is always something to pick and an
- unprobed model is visible rather than dropped.
-4. The picker is on screen for every job at every detail level; `advanced`
- adds capability badges, Tune and the read-only jobs, it never removes a
- control.
-5. A "Refresh" button in the section header clears the painted snapshot and
- every cached answer, then reads the server again — the recovery a user can
- reach without knowing what a cache is.
-
-**Lesson.** A cache entry is a claim that outlives the moment it was taken.
-"The server did not answer" is true when measured and false ten seconds
-later, so it may be returned but never stored. And a control whose options
-come from a filtered list needs an answer for the empty case: offering one
-option is indistinguishable, to the person using it, from ignoring the click.
## BUG-189: the desktop app hung in every section and sometimes did not paint at all for the first minutes after a cold Windows boot — the event loop was stopped for 15 s at a time behind an SDK import and a thread start (HIGH, FIXED 2026-08-27)
@@ -13288,61 +13322,6 @@ executor was fixed once; anyio's was the same bug one layer over. And a
gate that releases on a timer gates only what fits in the timer: the honest
end of a cold start is the CLI's own input line.
-
-## BUG-190: a message typed on the Agentic IDE's chat stage answered "T11: the prompt is in its input box, not sent" and a pasted screenshot "session not found" — the hidden tile spawned the agent at 10x4, an unconfirmed delivery was read as a refusal, and the pane's history id went out as a chat session id (MEDIUM, FIXED 2026-08-27)
-
-**Symptom.** With the Agentic IDE in chat view, a new pane (T11) was
-opened and "Hlallo" typed into the stage's composer. A warning toast said
-`T11: the prompt is in its input box, not sent` — while the agent in T11
-was already answering it. Pasting a screenshot into the same composer put
-`session not found` in red under the input. The log, eleven seconds apart:
-`PTY spawned: shell=agentic-ide:t11 … size=10x4`, then `never saw the
-prompt reach T11 — it may have been submitted or dropped; reporting it as
-unconfirmed`.
-
-**Cause.** Three, stacked.
-
-1. `AgenticTerminal` measures its tile once before the socket handshake, so
- the agent is spawned at the size the grid shows. On the chat stage every
- cell is `hidden` (display:none) and the staged pane's transcript is drawn
- over the canvas instead — so the fit addon measured a box with no size
- and answered with its own minimum (2x1), the floors clamped that to 10x4,
- and the handshake spawned the CLI at exactly that. The later
- `applyResize` path already refused an unmeasurable tile; the mount-time
- fit did not.
-2. In a ten-column terminal the CLI never draws its input line the way
- `_input_line_holds` reads it, so `_write_and_confirm` reported
- `submitted: null` — "never seen arriving, no claim either way".
- `useWebSocket.ts` folded that null into false and toasted the warning
- meant for a prompt provably still sitting in its box.
-3. `store/paneChat.ts` handed the pane's history id out as
- `activeSessionId`. The composer sends that id as `session_id` with every
- file attach, and `/api/agent-chat/attachments` looks it up in the chat's
- session store — where no pane has ever existed — and answers 404.
-
-**Fix.**
-
-1. The mount-time fit runs only for a tile that has a size (`measurable()`,
- the same check `applyResize` uses); a pane that mounts hidden keeps its
- constructed 80x24 until the tile is shown, and the first real measurement
- follows from `sendResize` then. Test: "does not shrink a pane that mounts
- hidden to the floors".
-2. The prompt toast has the event's three states: success for true, the
- warning for false, and an info line for null that says the pane never
- showed the prompt arriving (`use_web_socket.prompt_unconfirmed`,
- en/de/es). Test: "tells the three states of a prompt typed into a pane
- apart".
-3. A pane's store reports no `activeSessionId`; the attach goes by the
- workspace folder, which is where a pane's files belong anyway. The
- session object beside it still names the pane for the stage.
-
-**Lesson.** A measurement taken from something hidden is not a small
-number, it is no number — code that clamps to a floor must first ask
-whether there was anything to measure. And when the backend goes to the
-trouble of reporting three states, no layer on the way to the user may fold
-two of them together: an honest "unconfirmed" turned into a confident "not
-sent" is a lie the user acts on.
-
## BUG-187: a typed "Hallo" on a local 32k model answered "I can't reach my provider — check the network": 221 tool schemas went out with every turn, nothing read the model's context window, and the 400 that named the size was filed as a network failure (HIGH, FIXED 2026-08-27)
**Symptom.** Front-page chat, 2026-08-27 10:11 (the same at 2026-08-26 20:32
@@ -13416,6 +13395,133 @@ error the provider spells out must reach the user in its own words: filing
an unknown 4xx as "network" turns a one-line fix into a day of "nothing
works".
+## BUG-188: Local models says every model is "not installed" and a job cannot be changed — one sweep taken while Ollama was still booting became the cache both ends read from (HIGH, FIXED 2026-08-27)
+
+**Symptom (maintainer, 2026-08-27 10:09).** The Local models section showed
+`ornith:9b` with a trailing `(not installed)`, and under it the sentence
+"Nothing installed fits this job yet; this download is the pick." Picking a
+different model in the dropdown appeared to do nothing — "it always switches
+back to that odd one, even when you choose something else." Fifteen models
+were on the server at that moment, `ornith:9b` among them.
+
+**What was actually true.** Nothing was broken in the write path. Read live
+during the investigation, the backend was correct on every count:
+
+```
+GET …/local-models/overview?fresh=1 source: live
+ inventory error: None models: 11
+ chat current='ornith:9b' installed=True qualifying=[10 tags]
+PUT …/local-models/roles/chat {"model":"qwen3.5:4b"} -> ok
+ jarvis.toml brain.providers.ollama.model = "qwen3.5:4b"
+ scripts/config-soll.json brain.providers.ollama.model = "qwen3.5:4b"
+```
+
+The pick was written, the drift baseline followed it, and a re-read answered
+the new value. The screen was simply not showing the server.
+
+**Cause — a truthful answer cached as a lasting one.** `build_overview` runs
+its sweep whatever the server's state; when Ollama does not answer it returns
+a payload with an empty inventory and `inventory.error` set. That is the right
+answer to "what can I see right now" and a ruinous one to keep, and it was
+kept twice over:
+
+* `ollama_overview._refresh` handed every payload to `save_snapshot`, so the
+ offline sweep replaced the good file in `data/local_models_snapshot.json`.
+ `get_overview` paints a disk snapshot for `STALE_AFTER_S` — 24 hours.
+* `useOverview` mirrored every payload into `localStorage`, and reads it back
+ as react-query's `initialData` — which survives a failed refetch, so it
+ outlives the outage that produced it.
+
+Opening the section while Ollama is still booting is enough. Everything
+downstream then follows from an empty inventory: `RoleState.qualifying` is
+empty, so each role reads `installed: false` and its shortlist falls back to
+"nothing installed fits this job yet".
+
+**Why the dropdown looked stuck.** `RoleLedgerRow` built its options from
+`row.qualifying` plus the configured tag. With `qualifying` empty that list
+holds exactly ONE entry — the tag already configured. There was nothing else
+to select; the "reset" the maintainer saw was a picker that had never offered
+an alternative. An unprobed download (`probed: false`, no capabilities) fell
+out of the list the same silent way. The Simple page compounded it: the
+picker lived behind a "Change" button, two clicks from the row.
+
+**Fix.**
+
+1. `ollama_overview.is_paintable()` — a payload whose inventory carries an
+ error is never written to the snapshot, and one already on disk is dropped
+ on read instead of painted. The previous, honest snapshot stays.
+2. `localModelsSnapshot.isPaintable()` — the same guard on the browser side,
+ on both write and read.
+3. `RolePicker` offers EVERY installed download, grouped "Fits this job" /
+ "Other installed models", so there is always something to pick and an
+ unprobed model is visible rather than dropped.
+4. The picker is on screen for every job at every detail level; `advanced`
+ adds capability badges, Tune and the read-only jobs, it never removes a
+ control.
+5. A "Refresh" button in the section header clears the painted snapshot and
+ every cached answer, then reads the server again — the recovery a user can
+ reach without knowing what a cache is.
+
+**Lesson.** A cache entry is a claim that outlives the moment it was taken.
+"The server did not answer" is true when measured and false ten seconds
+later, so it may be returned but never stored. And a control whose options
+come from a filtered list needs an answer for the empty case: offering one
+option is indistinguishable, to the person using it, from ignoring the click.
+
+## BUG-190: a message typed on the Agentic IDE's chat stage answered "T11: the prompt is in its input box, not sent" and a pasted screenshot "session not found" — the hidden tile spawned the agent at 10x4, an unconfirmed delivery was read as a refusal, and the pane's history id went out as a chat session id (MEDIUM, FIXED 2026-08-27)
+
+**Symptom.** With the Agentic IDE in chat view, a new pane (T11) was
+opened and "Hlallo" typed into the stage's composer. A warning toast said
+`T11: the prompt is in its input box, not sent` — while the agent in T11
+was already answering it. Pasting a screenshot into the same composer put
+`session not found` in red under the input. The log, eleven seconds apart:
+`PTY spawned: shell=agentic-ide:t11 … size=10x4`, then `never saw the
+prompt reach T11 — it may have been submitted or dropped; reporting it as
+unconfirmed`.
+
+**Cause.** Three, stacked.
+
+1. `AgenticTerminal` measures its tile once before the socket handshake, so
+ the agent is spawned at the size the grid shows. On the chat stage every
+ cell is `hidden` (display:none) and the staged pane's transcript is drawn
+ over the canvas instead — so the fit addon measured a box with no size
+ and answered with its own minimum (2x1), the floors clamped that to 10x4,
+ and the handshake spawned the CLI at exactly that. The later
+ `applyResize` path already refused an unmeasurable tile; the mount-time
+ fit did not.
+2. In a ten-column terminal the CLI never draws its input line the way
+ `_input_line_holds` reads it, so `_write_and_confirm` reported
+ `submitted: null` — "never seen arriving, no claim either way".
+ `useWebSocket.ts` folded that null into false and toasted the warning
+ meant for a prompt provably still sitting in its box.
+3. `store/paneChat.ts` handed the pane's history id out as
+ `activeSessionId`. The composer sends that id as `session_id` with every
+ file attach, and `/api/agent-chat/attachments` looks it up in the chat's
+ session store — where no pane has ever existed — and answers 404.
+
+**Fix.**
+
+1. The mount-time fit runs only for a tile that has a size (`measurable()`,
+ the same check `applyResize` uses); a pane that mounts hidden keeps its
+ constructed 80x24 until the tile is shown, and the first real measurement
+ follows from `sendResize` then. Test: "does not shrink a pane that mounts
+ hidden to the floors".
+2. The prompt toast has the event's three states: success for true, the
+ warning for false, and an info line for null that says the pane never
+ showed the prompt arriving (`use_web_socket.prompt_unconfirmed`,
+ en/de/es). Test: "tells the three states of a prompt typed into a pane
+ apart".
+3. A pane's store reports no `activeSessionId`; the attach goes by the
+ workspace folder, which is where a pane's files belong anyway. The
+ session object beside it still names the pane for the stage.
+
+**Lesson.** A measurement taken from something hidden is not a small
+number, it is no number — code that clamps to a floor must first ask
+whether there was anything to measure. And when the backend goes to the
+trouble of reporting three states, no layer on the way to the user may fold
+two of them together: an honest "unconfirmed" turned into a confident "not
+sent" is a lie the user acts on.
+
## BUG-191: a hold-to-dictate recording that never ended — the bar's X did nothing, every key press was refused, only a restart cleared it (HIGH, FIXED 2026-08-27)
**Symptom (maintainer, 2026-08-27 10:26).** Hold the dictation key
@@ -13580,3 +13686,55 @@ being read is somebody else's file, the fact has to be written down at the
moment it is known and joined back later, not reconstructed from the file.
And a picture the app stored itself is a picture it can show: a receipt that
names an image the viewer could fetch is a chip nobody asked for.
+
+## BUG-193: the Agentic IDE's chat sidebar read "Claude Code…" for half its sessions — panes an hour into typed work, panes restored after a restart, and one with a prompt in memory — while the other half were titled by what they were about (MEDIUM, FIXED 2026-08-27)
+
+**Symptom.** Seventeen rows in the chat-mode sidebar; nine of them "Claude Code…"
+(maintainer screenshot 2026-08-27 11:34). Every one of the nine was a pane with a
+real conversation behind it: T15–T18 had been typed a task and were working on
+it, T2/T5/T8/T9/T11 had been restored with the app at 10:52, and T2 in the
+second workspace had a Jarvis-sent prompt sitting in `last_prompt`.
+
+**Root cause.** Three, stacked.
+1. `known_headline` (the list's title, `recap_engine.py`) remembered the
+ header's deterministic floor WHATEVER it said — and for a pane nothing named
+ the floor is the state label "Claude Code — running since 10:52". The row
+ truncated that to "Claude Code…", and because the frontend's `sessionTitle`
+ takes the recap first, the label outranked the pane's own `last_prompt`.
+2. The remembered floor had no timestamp: a prompt sent AFTER the header's
+ poll changed nothing in the list until some header polled again — and in
+ chat mode no header is drawn, so "again" was never.
+3. For a typed pane, the floor's only source was the echo of the first typed
+ request in the pane's replay buffer (`recap._typed_request`, first 40 rows).
+ After a screen of agent output that echo is gone, and for a pane restored
+ from a snapshot it was never there. Nothing durable named those panes.
+
+**Fix.**
+- `Recap.names_work` (`recap.py`): the floor says whether its headline names
+ the work or describes the pane's state. `recap_for` remembers only the
+ former, stamped with `floor_at`; `known_headline` ignores a floor older than
+ `last_prompt_at` and then falls through to the last prompt and to the new
+ source below. The row (`Terminal.to_row`) is unchanged in shape.
+- `jarvis/agentic_ide/opening.py` + `agent_transcript.first_user_text`: the
+ first thing the PERSON said in the CLI's own transcript — read from the
+ HEAD of the file once per pane (bounded, off the event loop, negative
+ result retried every 20 s), cached by (pane key, session id), dropped on
+ close. It is the same file the chat stage draws, so the row and the page
+ agree, and it survives restarts and scrollback alike. `recap.summarize`
+ uses it for the header after the sent prompt and the typed echo; a
+ leading `@drop.png` attachment reference is stripped from any title.
+- Frontend `promptOpening` skips a brief's "## Task" heading, as the
+ backend's `_job_line` always did.
+
+Tests: `tests/unit/agentic_ide/test_opening.py`, `test_agent_transcript.py`
+(`TestOpening`), `test_recap.py` (opening titles a scrolled pane; a state label
+does not name work; attachment refs), `test_recap_engine.py` (label never
+remembered; stale floor yields to a newer prompt; opening reaches the row),
+`sessionTitle.test.ts`.
+
+**Lesson.** A fallback that is TRUE is not the same as one that is USEFUL —
+"running since 10:52" was correct for every one of the nine rows and answered
+none of them. Memory that stands in for a computation must record WHEN it was
+computed, or a fact that arrives later loses to a stale one. And the durable
+source was on disk the whole time: the CLI's own transcript names every
+session, restart or not.
diff --git a/jarvis/agentic_ide/agent_transcript.py b/jarvis/agentic_ide/agent_transcript.py
index d3647f5422..3ab4047ecc 100644
--- a/jarvis/agentic_ide/agent_transcript.py
+++ b/jarvis/agentic_ide/agent_transcript.py
@@ -395,6 +395,110 @@ def _codex_turns(session_id: str, home: Path | None) -> list[Turn] | None:
return turns
+# --------------------------------------------------------------------------- #
+# the opening — the first thing a person said
+# --------------------------------------------------------------------------- #
+#
+# A session's title is its first message, the way a chat's is. That message is
+# at the HEAD of the file, which is the one part the tail readers above never
+# look at — and reading it is the only way a pane keeps its name across a
+# backend restart (the sent prompt is memory) and past the first screen of
+# output (the typed echo scrolls out of the replay buffer). See
+# :mod:`jarvis.agentic_ide.opening` for who asks and how often.
+
+#: How much of the file's head is read to find that message. A CLI opens its
+#: file with bookkeeping — snapshots, queue rows, the harness's own reminders —
+#: and the person's first message follows within a few kilobytes; this bound
+#: only keeps a pathological file from being read whole.
+MAX_HEAD_BYTES = 512 * 1024
+
+
+def _head_rows(path: Path, *, max_bytes: int = MAX_HEAD_BYTES) -> list[dict[str, Any]]:
+ """Every JSON object in the head of ``path``, oldest first.
+
+ The last line of a bounded read is usually half an object; it fails to parse
+ and is skipped, which is the right outcome for a fragment.
+ """
+ try:
+ with path.open("rb") as handle:
+ blob = handle.read(max_bytes)
+ except OSError as exc:
+ logger.warning("Agent transcript: cannot read {}: {}", path.name, exc)
+ return []
+ out: list[dict[str, Any]] = []
+ for line in blob.decode("utf-8", "replace").splitlines():
+ stripped = line.strip()
+ if not stripped.startswith("{"):
+ continue
+ try:
+ payload = json.loads(stripped)
+ except (ValueError, TypeError):
+ # Not a JSON line — the parse contract, not a swallowed failure.
+ continue
+ if isinstance(payload, dict):
+ out.append(payload)
+ return out
+
+
+def _text_of(content: Any) -> str:
+ """The prose of one message body: a string, or its text blocks joined.
+
+ Tool results, images and the rest of a body's blocks are not prose and are
+ left out — a tool result arrives as a USER record, and quoting it would put
+ the agent's own output in the person's voice.
+ """
+ if isinstance(content, str):
+ return content
+ if not isinstance(content, list):
+ return ""
+ parts: list[str] = []
+ for block in content:
+ if isinstance(block, dict) and str(block.get("type") or "").endswith("text"):
+ parts.append(str(block.get("text") or ""))
+ return "\n".join(parts)
+
+
+def _claude_first_user_text(session_id: str, home: Path | None) -> str | None:
+ path = _claude_file(session_id, home)
+ if path is None:
+ return None
+ for row in _head_rows(path):
+ if str(row.get("type") or "") != "user":
+ continue
+ # A meta row is the CLI annotating the conversation (an image's size, a
+ # slash command's echo); a sidechain is a sub-agent's conversation.
+ # Neither is the person opening this session.
+ if row.get("isMeta") or row.get("isSidechain"):
+ continue
+ message = row.get("message")
+ if not isinstance(message, dict) or str(message.get("role") or "") != "user":
+ continue
+ spoken = _spoken(_text_of(message.get("content")))
+ if spoken:
+ return spoken
+ return ""
+
+
+def _codex_first_user_text(session_id: str, home: Path | None) -> str | None:
+ path = _codex_file(session_id, home)
+ if path is None:
+ return None
+ for row in _head_rows(path):
+ if str(row.get("type") or "") != "response_item":
+ continue
+ payload = row.get("payload")
+ if not isinstance(payload, dict) or str(payload.get("type") or "") != "message":
+ continue
+ # `developer` is the harness; the person is `user`, and the harness
+ # wraps what IT adds to a user message in tags `_spoken` strips.
+ if str(payload.get("role") or "") != "user":
+ continue
+ spoken = _spoken(_text_of(payload.get("content")))
+ if spoken:
+ return spoken
+ return ""
+
+
# --------------------------------------------------------------------------- #
# registry
# --------------------------------------------------------------------------- #
@@ -407,12 +511,37 @@ _READERS: dict[str, Callable[[str, Path | None], list[Turn] | None]] = {
"codex": _codex_turns,
}
+#: The same CLIs, read from the other end: the first thing the person said.
+_OPENERS: dict[str, Callable[[str, Path | None], str | None]] = {
+ "claude": _claude_first_user_text,
+ "codex": _codex_first_user_text,
+}
+
def can_read(agent: str) -> bool:
"""Does this CLI keep a conversation this module knows how to read?"""
return str(agent or "").strip().lower() in _READERS
+def first_user_text(agent: str, session_id: str, *, home: Path | None = None) -> str | None:
+ """The first thing a PERSON said in one session — what opened it.
+
+ ``None`` when this CLI keeps no readable record or the session has no file
+ yet; ``""`` when the file is there but nobody has spoken in it so far. Both
+ are transient for a pane that has just started, and neither is an error.
+ Reads the head of the file only (:data:`MAX_HEAD_BYTES`); the tail readers
+ above are for the conversation's recent past.
+ """
+ opener = _OPENERS.get(str(agent or "").strip().lower())
+ if opener is None or not str(session_id or "").strip():
+ return None
+ try:
+ return opener(session_id.strip(), home)
+ except OSError as exc:
+ logger.warning("Agent transcript: {} session {} unreadable: {}", agent, session_id, exc)
+ return None
+
+
def read(agent: str, session_id: str, *, home: Path | None = None) -> list[Turn] | None:
"""The recent conversation of one session, oldest turn first.
diff --git a/jarvis/agentic_ide/opening.py b/jarvis/agentic_ide/opening.py
new file mode 100644
index 0000000000..b072a0549a
--- /dev/null
+++ b/jarvis/agentic_ide/opening.py
@@ -0,0 +1,145 @@
+"""The first thing a person said in a pane's CLI — remembered, never re-read.
+
+A coding pane has three places its title can come from, and two of them are
+gone exactly when the title is needed most. The instruction Jarvis sent
+(``Terminal.last_prompt``) lives in the backend's memory and does not survive
+a restart. The echo of what the user typed lives in the pane's scrollback and
+scrolls out of the replay buffer as soon as the agent has printed a screen or
+two — which is why a working pane's header read "Claude Code — running since
+11:29" while the pane was an hour into the task it had been typed
+(maintainer report 2026-08-27).
+
+The CLI's own transcript has neither problem. It is on disk, it is the same
+file the chat stage draws the conversation from, and its first user record IS
+the request that opened the session — the closest thing a terminal has to a
+chat's first message. This module reads that one record once per pane and
+keeps it: the opening of a conversation never changes, so a hit is permanent
+and a miss (the CLI has not written its file yet) is retried on a slow clock.
+
+The read happens off the event loop when one is running: the callers here
+(:func:`jarvis.agentic_ide.recap.summarize`, the session list's ``to_row``)
+are polled for every pane of every open workspace, and a directory walk per
+pane per tick is the difference between a list and a stutter. The first poll
+after a pane opens therefore answers with "" and the next one has the text —
+a delay nobody notices against a pane that has just started.
+"""
+
+from __future__ import annotations
+
+import asyncio
+import time
+from dataclasses import dataclass
+from pathlib import Path
+from typing import Any
+
+from loguru import logger
+
+from . import agent_transcript
+
+#: How long a pane whose file is not there yet waits before it is looked for
+#: again. A CLI writes its first record within a second of the first message,
+#: so anything shorter spends directory walks on a pane nobody has typed into.
+RETRY_S = 20.0
+
+#: The opening is a title's raw material, not a transcript: this is more than
+#: any headline shows and less than a pasted brief runs to.
+MAX_CHARS = 400
+
+#: Entries are dropped by pane close (:func:`forget`); this bound only keeps a
+#: process that never closes anything from growing without limit.
+MAX_ENTRIES = 512
+
+
+@dataclass
+class _Entry:
+ text: str = ""
+ checked_at: float = 0.0
+ inflight: bool = False
+
+
+#: Keyed by pane key AND session id: T1 is handed on to a replacement pane,
+#: and a pane that is resumed into a different conversation must not open
+#: under the last conversation's first line.
+_cache: dict[tuple[str, str], _Entry] = {}
+
+
+def opening_for(term: Any) -> str:
+ """What the person first said in ``term``'s CLI session, or "" if unknown.
+
+ "" for a pane with no resume handle, a CLI whose record cannot be read, a
+ file that is not there yet, and for the first call that schedules the read
+ (see the module docstring). Never raises — this is on the path of every
+ state read, and a title is never worth a broken workspace.
+ """
+ handle = getattr(term, "resume", None)
+ session_id = str(getattr(handle, "id", "") or "").strip() if handle is not None else ""
+ agent = str(getattr(term, "agent", "") or "").strip().lower()
+ if not session_id or not agent_transcript.can_read(agent):
+ return ""
+ key = (str(getattr(term, "key", "") or ""), session_id)
+ entry = _cache.get(key)
+ if entry is None:
+ if len(_cache) >= MAX_ENTRIES:
+ _cache.pop(next(iter(_cache)))
+ entry = _cache[key] = _Entry()
+ if entry.text:
+ return entry.text
+ now = time.monotonic()
+ if entry.inflight or (entry.checked_at and now - entry.checked_at < RETRY_S):
+ return ""
+ entry.inflight = True
+ home = _home(term)
+
+ def _read() -> None:
+ try:
+ text = agent_transcript.first_user_text(agent, session_id, home=home)
+ except Exception as exc: # noqa: BLE001 - a title must never break a state read
+ logger.debug("Agentic IDE: opening of {} unreadable: {}", session_id, exc)
+ text = None
+ entry.text = " ".join(str(text or "").split())[:MAX_CHARS]
+ entry.checked_at = time.monotonic()
+ entry.inflight = False
+
+ try:
+ loop = asyncio.get_running_loop()
+ except RuntimeError:
+ # No loop (a test, a CLI): nothing to keep free, so answer now.
+ _read()
+ return entry.text
+ loop.run_in_executor(None, _read)
+ return ""
+
+
+def forget(key: str) -> None:
+ """Drop what is remembered about one pane — it has been closed."""
+ for cached in [item for item in _cache if item[0] == key]:
+ _cache.pop(cached, None)
+
+
+def reset_for_tests() -> None:
+ _cache.clear()
+
+
+def _home(term: Any) -> Path | None:
+ """The config dir this pane's CLI keeps its history in, when redirected.
+
+ Same rule as the transcript routes: each subscription of one CLI keeps its
+ conversations in its own directory, and the machine default would answer
+ with a different account's chat. ``None`` keeps the reader on its default.
+ """
+ account = str(getattr(term, "account", "") or "")
+ agent = str(getattr(term, "agent", "") or "")
+ if not account:
+ return None
+ try:
+ from jarvis import agent_accounts
+
+ if agent not in agent_accounts.platforms():
+ return None
+ return agent_accounts.config_dir_for(agent, account) # type: ignore[arg-type]
+ except Exception as exc: # noqa: BLE001 - the default home is the honest fallback
+ logger.debug("Agentic IDE: account folder for {} is unknown: {}", agent, exc)
+ return None
+
+
+__all__ = ["MAX_CHARS", "RETRY_S", "forget", "opening_for", "reset_for_tests"]
diff --git a/jarvis/agentic_ide/recap.py b/jarvis/agentic_ide/recap.py
index 25f2c89f23..730a12043b 100644
--- a/jarvis/agentic_ide/recap.py
+++ b/jarvis/agentic_ide/recap.py
@@ -48,6 +48,7 @@ import time
from dataclasses import dataclass
from typing import TYPE_CHECKING, Any
+from . import opening
from .activity import observed
if TYPE_CHECKING: # pragma: no cover - typing only
@@ -150,6 +151,11 @@ _MARKUP_RE = re.compile(r"^\s{0,3}(?:#{1,6}\s+|[-*+]\s+|\d{1,2}[.)]\s+|>\s+)")
# no markdown at all.
_EMPHASIS_RE = re.compile(r"[*_`]{1,3}")
+# A prompt that opens with a dropped file names it first — "@.jarvis/drops/…png
+# What is this button?" — and a title that quotes the reference quotes the one
+# part of the sentence the reader cannot use. The words after it are the job.
+_ATTACHMENT_RE = re.compile(r"^(?:@\S+\s*)+")
+
# A raw path list is a frequent last readable row after a search command. It
# contains plenty of letters, so the older "three alphabetic characters" rule
# accepted it as work and headers ended up reading `jarvis/core/bus.py",
@@ -195,6 +201,7 @@ def _job_line(text: str) -> str:
label_seen = ""
for raw in str(text or "").splitlines()[:12]:
line = _EMPHASIS_RE.sub("", _MARKUP_RE.sub("", raw.strip())).strip()
+ line = _ATTACHMENT_RE.sub("", line).strip()
if not line or line.startswith("```"):
continue
# A horizontal rule, a box edge, a row of dashes under a heading.
@@ -225,6 +232,13 @@ class Recap:
headline: str
detail: str
+ #: Whether ``headline`` NAMES THE WORK — the instruction sent, the request
+ #: typed, the message that opened the CLI's conversation — as opposed to
+ #: describing the pane's state ("Claude Code — running since 10:52", "Not
+ #: started"). A reader that remembers headlines for a list (the recap
+ #: engine's floor memory) keeps only the former: a state label is true for
+ #: one poll and is what a fresh title must be allowed to replace.
+ names_work: bool = False
def condense(text: str, limit: int) -> str:
@@ -351,6 +365,22 @@ def _task(term: Any, limit: int = TASK_CHARS) -> str:
return condense(_job_line(getattr(term, "last_prompt", "")), limit)
+def task_headline(term: Any) -> str:
+ """The instruction this pane was last sent, at the header's width — "" if none."""
+ return _task(term, HEADLINE_TASK_CHARS)
+
+
+def opening_headline(term: Any) -> str:
+ """The message that opened this pane's CLI conversation, at the header's width.
+
+ Read from the CLI's own transcript (:mod:`.opening`), so it is there after a
+ backend restart has forgotten the sent prompt and after the typed echo has
+ scrolled out of the pane — the two cases that left a working pane titled
+ "Claude Code — running since 11:29". "" until the CLI has written its file.
+ """
+ return condense(_job_line(opening.opening_for(term)), HEADLINE_TASK_CHARS)
+
+
def idle_phrase(term: Any) -> str:
"""How long ago this pane last printed anything, in words."""
last = getattr(term, "last_output_at", None)
@@ -451,6 +481,13 @@ def summarize(term: Any, *, lines: Sequence[str] | None = None) -> Recap:
# behind the same marker, and titling a shell by its first command would
# pin it forever to "git status" — its newest row is its honest headline.
typed = "" if (task or not coding_tui) else _typed_request(term, rows)
+ # The message that opened the CLI's own conversation, for a coding pane
+ # that neither of the above can name: the sent prompt is memory and does
+ # not survive a restart, and the typed echo scrolls out of the replay
+ # buffer after a screen of output — which is exactly when a pane is deep
+ # in the work it was typed. Answered from a per-pane cache (.opening), so
+ # this costs nothing on the state read.
+ opened = "" if (task or typed or not coding_tui) else opening_headline(term)
# One sentence about the instruction, computed once: every branch below
# opens with it, and a plain terminal answers it differently.
asked = (
@@ -488,6 +525,8 @@ def summarize(term: Any, *, lines: Sequence[str] | None = None) -> Recap:
headline = _task(term, HEADLINE_TASK_CHARS)
elif typed:
headline = typed
+ elif opened:
+ headline = opened
elif activity and not coding_tui:
headline = condense(f"{ended}. Last output: {activity}", HEADLINE_CHARS)
else:
@@ -498,6 +537,7 @@ def summarize(term: Any, *, lines: Sequence[str] | None = None) -> Recap:
asked,
f"{ended}" + (f", last printing: {activity}." if activity else "."),
),
+ names_work=bool(task or typed or opened),
)
# Live. The INSTRUCTION leads, and that ordering was learned the hard way:
@@ -522,6 +562,8 @@ def summarize(term: Any, *, lines: Sequence[str] | None = None) -> Recap:
headline = _task(term, HEADLINE_TASK_CHARS)
elif typed:
headline = typed
+ elif opened:
+ headline = opened
elif activity and not coding_tui:
headline = activity
elif activity or idle:
@@ -549,6 +591,7 @@ def summarize(term: Any, *, lines: Sequence[str] | None = None) -> Recap:
return Recap(
headline=condense(headline, HEADLINE_CHARS),
detail=_sentences(asked, now),
+ names_work=bool(task or typed or opened),
)
diff --git a/jarvis/agentic_ide/recap_engine.py b/jarvis/agentic_ide/recap_engine.py
index d78bad81c0..861a0780a0 100644
--- a/jarvis/agentic_ide/recap_engine.py
+++ b/jarvis/agentic_ide/recap_engine.py
@@ -377,11 +377,20 @@ class _PaneState:
pinned_headline: str = ""
pinned_detail: str = ""
pinned_at: float = 0.0
- #: The deterministic headline the header last read off this pane's screen.
+ #: The deterministic headline the header last read off this pane's screen,
+ #: kept ONLY when it names the work (``Recap.names_work``): the request
+ #: typed into the pane, the prompt sent to it, the message that opened its
+ #: conversation. Never a state label — "Claude Code — running since 10:52"
+ #: remembered here outranked the pane's own last prompt in the session
+ #: list for as long as no header was drawn (maintainer report 2026-08-27).
#: Kept so a reader that must NOT walk the scrollback — the session list,
#: which polls every pane of every open workspace — can still say what the
#: pane's header says (:func:`known_headline`).
floor_headline: str = ""
+ #: When that floor was read. A prompt sent to the pane AFTER it makes the
+ #: floor stale: the header will re-read on its next poll, and until then
+ #: the list must answer from the prompt, not from what was true before it.
+ floor_at: float = 0.0
_panes: dict[str, _PaneState] = {}
@@ -566,10 +575,15 @@ def recap_for(term: Any, *, lines: Sequence[str] | None = None) -> SmartRecap:
plain = recap.summarize(term, lines=None if lines is None else list(lines))
reason = _why_no_summary(term, entry, None if lines is None else len(lines))
# Remember what the header is about to show, so a reader that cannot afford
- # this read (see known_headline) can still repeat it.
+ # this read (see known_headline) can still repeat it — but only a headline
+ # that names the work. A state label ("running since 10:52") is true for
+ # this poll and must not be what the list keeps saying once the pane has
+ # been asked something.
key = str(getattr(term, "key", "") or "")
- if key and plain.headline:
- _state(key).floor_headline = plain.headline
+ if key:
+ state = _state(key)
+ state.floor_headline = plain.headline if plain.names_work else ""
+ state.floor_at = time.time()
return SmartRecap(
headline=plain.headline,
detail=plain.detail,
@@ -590,14 +604,24 @@ def known_headline(term: Any) -> str:
is "Fix the login test" in the grid and "Claude Code" in the sidebar — two
names for one conversation. So this answers from memory alone, in the
header's own order: what the user pinned, else what the model wrote, else
- the floor the header last computed. Empty for a pane no header has
- described yet; the list then falls back to the pane's last prompt, and
- only after that to the CLI's name.
+ the work-naming floor the header last computed — unless a prompt has been
+ sent since, which makes that floor yesterday's news. After those, the two
+ sources the floor itself would read next, both free of a scrollback walk:
+ the last prompt sent to the pane, and the message that opened the CLI's
+ own conversation (:mod:`.opening`, cached). Empty only for a pane that has
+ been asked nothing anywhere; the list then names the CLI, which is then in
+ fact everything there is to say.
"""
entry = _panes.get(str(getattr(term, "key", "") or ""))
- if entry is None:
- return ""
- return entry.pinned_headline or entry.headline or entry.floor_headline
+ if entry is not None:
+ if entry.pinned_headline:
+ return entry.pinned_headline
+ if entry.headline:
+ return entry.headline
+ asked_at = float(getattr(term, "last_prompt_at", None) or 0.0)
+ if entry.floor_headline and entry.floor_at >= asked_at:
+ return entry.floor_headline
+ return recap.task_headline(term) or recap.opening_headline(term)
def refresh_soon(term: Any, *, lines: Sequence[str], folder: str = "") -> None:
diff --git a/jarvis/agentic_ide/session.py b/jarvis/agentic_ide/session.py
index 0abd4410fc..a6640c1fe0 100644
--- a/jarvis/agentic_ide/session.py
+++ b/jarvis/agentic_ide/session.py
@@ -79,7 +79,7 @@ from loguru import logger
from jarvis.workspace import agents as workspace_agents
from jarvis.workspace import launch_picks
-from . import layout_tree, prompt_history, recap_engine, resume_store
+from . import layout_tree, opening, prompt_history, recap_engine, resume_store
from .activity import NO_READING, Reading, has_work_behind_it, observed
from .agent_sessions import (
ResumeHandle,
@@ -1314,11 +1314,12 @@ class Terminal:
"last_prompt": self.last_prompt[:200],
"last_prompt_at": self.last_prompt_at,
# The pane's title as its header last showed it — pinned, written by
- # the model, or the floor read off the screen on the last header
- # poll — from the recap engine's memory alone. Never computed here:
- # this list must not walk a scrollback (see above). Empty for a pane
- # no header has described yet; the list then shows the last
- # prompt's opening, and only after that the CLI's name.
+ # the model, or the work-naming floor read off the screen on the
+ # last header poll — else the last prompt sent, else the message
+ # that opened the CLI's own conversation. From memory alone, never
+ # computed here: this list must not walk a scrollback (see above).
+ # Empty only for a pane that has been asked nothing anywhere; the
+ # list then names the CLI.
"recap": recap_engine.known_headline(self),
# Whether a readable conversation could exist for this pane at all.
# Whether one is actually on disk is the transcript endpoint's
@@ -4503,6 +4504,7 @@ class Registry:
# (a new "Mika" in the same workspace). Dropping it here is what
# stops a fresh pane opening under the last one's sentence.
recap_engine.forget(term.key)
+ opening.forget(term.key)
# Its bell entries go the same way and for the same reason.
# Each one is a "jump to this pane" button, and the pane has
# just stopped existing — while its key has not, so waiting for
diff --git a/jarvis/ui/web/frontend/src/components/agentic/sessionTitle.test.ts b/jarvis/ui/web/frontend/src/components/agentic/sessionTitle.test.ts
index 6dd93ffa89..265c9d976d 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/sessionTitle.test.ts
+++ b/jarvis/ui/web/frontend/src/components/agentic/sessionTitle.test.ts
@@ -39,4 +39,14 @@ describe("promptOpening", () => {
expect(promptOpening("")).toBe("");
expect(promptOpening(" \n ")).toBe("");
});
+
+ it("skips the section heading a composed brief opens with", () => {
+ expect(promptOpening("## Task\nFix the failing login test\n\n## Context\nmore")).toBe(
+ "Fix the failing login test",
+ );
+ expect(promptOpening("**Context**\n\nGoal:\nShip the parser")).toBe("Ship the parser");
+ expect(promptOpening("Task: fix the login test")).toBe("fix the login test");
+ // A brief that is nothing but labels still answers with its first one.
+ expect(promptOpening("## Task\n## Context")).toBe("Task");
+ });
});
diff --git a/jarvis/ui/web/frontend/src/components/agentic/sessionTitle.ts b/jarvis/ui/web/frontend/src/components/agentic/sessionTitle.ts
index 3a4a393242..9beb4b9d83 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/sessionTitle.ts
+++ b/jarvis/ui/web/frontend/src/components/agentic/sessionTitle.ts
@@ -11,10 +11,13 @@ import type { WorkspacePaneRow } from "@/lib/agenticIdeApi";
* (maintainer report 2026-08-27). So the label is the pane's title, the same
* sentence the grid draws in that pane's header:
*
- * 1. the recap — pinned by the user, written by the model, or the floor read
- * off the screen on the last header poll (`known_headline` on the backend);
- * 2. the opening line of the last prompt, for a pane no header has described
- * yet — the closest thing a terminal has to a chat's first message;
+ * 1. the recap — pinned by the user, written by the model, read off the
+ * screen on the last header poll, the last prompt sent, or the message
+ * that opened the CLI's own conversation (`known_headline` on the
+ * backend, which orders them);
+ * 2. the opening line of the last prompt, for a backend that answered with
+ * no recap at all — the closest thing a terminal has to a chat's first
+ * message;
* 3. the CLI's name, for a pane that has been asked nothing at all, where
* "Claude Code" is in fact everything there is to say.
*/
@@ -29,14 +32,63 @@ export function sessionTitle(
}
/**
- * The first non-blank line of a prompt, whitespace collapsed.
+ * Section labels a composed brief is structured with — the same set the
+ * backend's `_job_line` knows. On their own they name the FORM of the prompt,
+ * not the work, so the job is on the line after them; where one prefixes the
+ * sentence ("Task: fix the login test") the sentence is the part worth showing.
+ */
+const SECTION_LABELS = new Set([
+ "brief",
+ "context",
+ "goal",
+ "goals",
+ "instruction",
+ "instructions",
+ "objective",
+ "objectives",
+ "prompt",
+ "request",
+ "summary",
+ "task",
+ "tasks",
+ "what to do",
+ "your task",
+]);
+
+/** A line without its heading marks and emphasis, whitespace collapsed. */
+function bare(row: string): string {
+ return row
+ .replace(/^\s*#{1,6}\s*/, "")
+ .replace(/[*_`]{1,3}/g, "")
+ .replace(/\s+/g, " ")
+ .trim();
+}
+
+/**
+ * The first line of a prompt that says something.
*
- * A composed brief runs to paragraphs; a title is one line, and the row's own
- * width clips it further. The first line rather than the first N characters,
- * because a brief opens with its instruction and the cut then lands between
- * sentences instead of inside a word.
+ * A composed brief runs to paragraphs and opens with "## Task"; a title is one
+ * line, and the row's own width clips it further. The first SAYING line rather
+ * than the first N characters: the cut then lands between sentences instead of
+ * inside a word — and never on the heading, which is the same for every brief.
+ * A brief that is nothing but labels still answers with its first label rather
+ * than with nothing.
*/
export function promptOpening(prompt: string): string {
- const line = prompt.split(/\r?\n/).find((row) => row.trim()) ?? "";
- return line.replace(/\s+/g, " ").trim();
+ let label = "";
+ for (const line of prompt.split(/\r?\n/).slice(0, 12).map(bare).filter(Boolean)) {
+ const colon = line.indexOf(":");
+ if (colon > 0 && SECTION_LABELS.has(line.slice(0, colon).trim().toLowerCase())) {
+ const rest = line.slice(colon + 1).trim();
+ if (rest) return rest;
+ label = label || line;
+ continue;
+ }
+ if (SECTION_LABELS.has(line.replace(/:$/, "").trim().toLowerCase())) {
+ label = label || line;
+ continue;
+ }
+ return line;
+ }
+ return label;
}
diff --git a/jarvis/ui/web/frontend/src/lib/agenticIdeApi.ts b/jarvis/ui/web/frontend/src/lib/agenticIdeApi.ts
index 2b3a2a023f..cafe704671 100644
--- a/jarvis/ui/web/frontend/src/lib/agenticIdeApi.ts
+++ b/jarvis/ui/web/frontend/src/lib/agenticIdeApi.ts
@@ -800,9 +800,10 @@ export interface WorkspacePaneRow {
last_prompt: string;
last_prompt_at: number | null;
/**
- * The pane's title as its grid header last showed it — pinned, model-written,
- * or read off the screen. Empty for a pane no header has described yet; see
- * `sessionTitle` for what a list shows then.
+ * The pane's title — pinned, model-written, read off the screen by its grid
+ * header, the last prompt sent, or the message that opened the CLI's own
+ * conversation, in that order. Empty only for a pane asked nothing anywhere;
+ * see `sessionTitle` for what a list shows then.
*/
recap: string;
has_resume: boolean;
diff --git a/tests/unit/agentic_ide/test_agent_transcript.py b/tests/unit/agentic_ide/test_agent_transcript.py
index a7c172aa63..ff3f8f71ac 100644
--- a/tests/unit/agentic_ide/test_agent_transcript.py
+++ b/tests/unit/agentic_ide/test_agent_transcript.py
@@ -185,3 +185,118 @@ class TestRegistry:
assert clipped.startswith("START")
assert clipped.endswith("END")
assert len(clipped) < len(text)
+
+
+class TestOpening:
+ """The first thing the PERSON said — read from the file's head, once."""
+
+ def test_claude_skips_bookkeeping_meta_rows_and_tool_results(self, tmp_path: Path) -> None:
+ _claude_session(
+ tmp_path,
+ "abc",
+ [
+ {"type": "queue-operation", "operation": "enqueue"},
+ {"type": "file-history-snapshot", "snapshot": {}},
+ # A harness reminder in the user's voice — nobody spoke.
+ _msg("user", "<system-reminder>be brief</system-reminder>"),
+ # A tool result also arrives as a USER record.
+ _msg("user", [{"type": "tool_result", "content": "x"}]),
+ {
+ "type": "user",
+ "isMeta": True,
+ "message": {"role": "user", "content": "[Image: original 3840x2054]"},
+ },
+ {
+ "type": "user",
+ "isSidechain": True,
+ "message": {"role": "user", "content": "a sub-agent's brief"},
+ },
+ _msg("user", "@.jarvis/drops/shot.png There is a bug in the sidebar"),
+ _msg("assistant", [{"type": "text", "text": "Looking."}]),
+ _msg("user", "a later question"),
+ ],
+ )
+ assert (
+ agent_transcript.first_user_text("claude", "abc", home=tmp_path)
+ == "@.jarvis/drops/shot.png There is a bug in the sidebar"
+ )
+
+ def test_claude_reads_text_blocks_and_ignores_the_rest_of_a_body(self, tmp_path: Path) -> None:
+ _claude_session(
+ tmp_path,
+ "abc",
+ [
+ _msg(
+ "user",
+ [
+ {"type": "image", "source": {}},
+ {"type": "text", "text": " What is this button? "},
+ ],
+ )
+ ],
+ )
+ assert agent_transcript.first_user_text("claude", "abc", home=tmp_path) == (
+ "What is this button?"
+ )
+
+ def test_a_missing_file_is_none_and_a_silent_one_is_empty(self, tmp_path: Path) -> None:
+ assert agent_transcript.first_user_text("claude", "abc", home=tmp_path) is None
+ _claude_session(tmp_path, "abc", [{"type": "queue-operation"}])
+ assert agent_transcript.first_user_text("claude", "abc", home=tmp_path) == ""
+ assert agent_transcript.first_user_text("some-new-cli", "abc", home=tmp_path) is None
+ assert agent_transcript.first_user_text("claude", " ", home=tmp_path) is None
+
+ def test_codex_skips_the_harness_preamble(self, tmp_path: Path) -> None:
+ _write(
+ tmp_path / "sessions" / "2026" / "08" / "05" / "rollout-2026-abc.jsonl",
+ [
+ {"type": "session_meta", "payload": {"id": "abc"}},
+ {
+ "type": "response_item",
+ "payload": {
+ "type": "message",
+ "role": "developer",
+ "content": [{"type": "input_text", "text": "You are Codex."}],
+ },
+ },
+ {
+ "type": "response_item",
+ "payload": {
+ "type": "message",
+ "role": "user",
+ "content": [
+ {
+ "type": "input_text",
+ "text": "<environment_context>x</environment_context>",
+ }
+ ],
+ },
+ },
+ {
+ "type": "event_msg",
+ "payload": {"type": "user_message", "message": "duplicate announcement"},
+ },
+ {
+ "type": "response_item",
+ "payload": {
+ "type": "message",
+ "role": "user",
+ "content": [{"type": "input_text", "text": "Refactor the parser"}],
+ },
+ },
+ ],
+ )
+ assert agent_transcript.first_user_text("codex", "abc", home=tmp_path) == (
+ "Refactor the parser"
+ )
+
+ def test_only_the_head_of_the_file_is_read(self, tmp_path: Path) -> None:
+ """A bounded read: a message past the cap is simply not found."""
+ filler = [_msg("assistant", [{"type": "text", "text": "x" * 1000}])] * 20
+ _claude_session(tmp_path, "abc", [*filler, _msg("user", "late request")])
+ path = next((tmp_path / "projects").glob("*/abc.jsonl"))
+ assert agent_transcript._head_rows(path, max_bytes=5_000)
+ assert not any(
+ row.get("type") == "user" for row in agent_transcript._head_rows(path, max_bytes=5_000)
+ )
+ assert agent_transcript.first_user_text("claude", "abc", home=tmp_path) == "late request"
diff --git a/tests/unit/agentic_ide/test_opening.py b/tests/unit/agentic_ide/test_opening.py
new file mode 100644
index 0000000000..f0ad8420b5
--- /dev/null
+++ b/tests/unit/agentic_ide/test_opening.py
@@ -0,0 +1,131 @@
+"""The remembered opening of a pane's CLI conversation.
+
+What is testable is the memory around the file read: that a pane is read once
+and then answered from the cache, that a pane without a handle costs nothing,
+that a file not there yet is retried on a slow clock rather than every poll,
+and that the read happens off the event loop when one is running.
+"""
+
+from __future__ import annotations
+
+import asyncio
+from types import SimpleNamespace
+
+import pytest
+
+from jarvis.agentic_ide import agent_transcript, opening
+
+
[email protected](autouse=True)
+def _clean():
+ opening.reset_for_tests()
+ yield
+ opening.reset_for_tests()
+
+
+def _pane(session_id: str = "abc", key: str = "mika") -> SimpleNamespace:
+ return SimpleNamespace(
+ key=key,
+ agent="claude",
+ account="",
+ resume=SimpleNamespace(kind="claude_session", id=session_id),
+ )
+
+
+def test_a_pane_without_a_handle_is_never_read(monkeypatch) -> None:
+ calls: list[str] = []
+ monkeypatch.setattr(
+ agent_transcript, "first_user_text", lambda *a, **k: calls.append("read") or "hello"
+ )
+ assert opening.opening_for(SimpleNamespace(key="k", agent="claude", resume=None)) == ""
+ assert opening.opening_for(SimpleNamespace(key="k", agent="shell", resume=None)) == ""
+ assert calls == []
+
+
+def test_the_opening_is_read_once_and_then_remembered(monkeypatch) -> None:
+ """The whole point: one file read per pane, however often the list polls."""
+ calls: list[str] = []
+
+ def _read(agent: str, session_id: str, *, home=None) -> str:
+ calls.append(session_id)
+ return "@.jarvis/drops/shot.png Fix the login\nmore"
+
+ monkeypatch.setattr(agent_transcript, "first_user_text", _read)
+ term = _pane()
+
+ first = opening.opening_for(term)
+ for _ in range(5):
+ assert opening.opening_for(term) == first
+
+ assert first == "@.jarvis/drops/shot.png Fix the login more"
+ assert calls == ["abc"]
+
+
+def test_a_file_not_there_yet_is_retried_on_a_slow_clock(monkeypatch) -> None:
+ calls: list[str] = []
+ answers = iter([None, "", "Make the wizard one screen"])
+
+ def _read(agent: str, session_id: str, *, home=None):
+ calls.append(session_id)
+ return next(answers)
+
+ monkeypatch.setattr(agent_transcript, "first_user_text", _read)
+ clock = [1000.0]
+ monkeypatch.setattr(opening.time, "monotonic", lambda: clock[0])
+ term = _pane()
+
+ assert opening.opening_for(term) == ""
+ assert opening.opening_for(term) == "" # within RETRY_S: not asked again
+ assert calls == ["abc"]
+
+ clock[0] += opening.RETRY_S + 1
+ assert opening.opening_for(term) == "" # the file is there, nobody spoke yet
+ assert calls == ["abc", "abc"]
+
+ clock[0] += opening.RETRY_S + 1
+ assert opening.opening_for(term) == "Make the wizard one screen"
+ assert opening.opening_for(term) == "Make the wizard one screen"
+ assert calls == ["abc", "abc", "abc"]
+
+
+def test_under_a_running_loop_the_read_happens_off_it(monkeypatch) -> None:
+ """The first poll answers at once with ""; the next one has the text."""
+ monkeypatch.setattr(agent_transcript, "first_user_text", lambda *a, **k: "Refactor the parser")
+ term = _pane()
+
+ async def scenario() -> tuple[str, str]:
+ first = opening.opening_for(term)
+ await asyncio.sleep(0.2)
+ return first, opening.opening_for(term)
+
+ assert asyncio.run(scenario()) == ("", "Refactor the parser")
+
+
+def test_a_reader_that_raises_never_reaches_the_caller(monkeypatch) -> None:
+ def _boom(*a, **k):
+ raise RuntimeError("disk on fire")
+
+ monkeypatch.setattr(agent_transcript, "first_user_text", _boom)
+ assert opening.opening_for(_pane()) == ""
+
+
+def test_a_closed_pane_is_forgotten_and_a_new_conversation_is_its_own(monkeypatch) -> None:
+ answers = {"abc": "First job", "xyz": "Second job"}
+ monkeypatch.setattr(
+ agent_transcript, "first_user_text", lambda agent, sid, *, home=None: answers[sid]
+ )
+ assert opening.opening_for(_pane("abc")) == "First job"
+ # Same call-sign, different conversation: never the last one's first line.
+ assert opening.opening_for(_pane("xyz")) == "Second job"
+
+ opening.forget("mika")
+ assert opening._cache == {} # noqa: SLF001 - the memory under test
+
+
+def test_a_pasted_brief_is_capped_to_a_titles_raw_material(monkeypatch) -> None:
+ monkeypatch.setattr(
+ agent_transcript,
+ "first_user_text",
+ lambda *a, **k: "word " * opening.MAX_CHARS,
+ )
+ assert len(opening.opening_for(_pane())) == opening.MAX_CHARS
diff --git a/tests/unit/agentic_ide/test_recap.py b/tests/unit/agentic_ide/test_recap.py
index 8a8239157d..de2466fa37 100644
--- a/tests/unit/agentic_ide/test_recap.py
+++ b/tests/unit/agentic_ide/test_recap.py
@@ -393,3 +393,42 @@ def test_summarize_survives_a_pane_without_a_transcript() -> None:
last_output_at = None
assert summarize(Half()).headline
+
+
+def test_the_conversations_opening_titles_a_pane_whose_echo_scrolled_away(monkeypatch) -> None:
+ """The typed echo leaves the replay buffer after a screen of output — which
+ is exactly when a pane is deep in the work it was typed. The CLI's own
+ transcript still opens with that request, and a dropped file's reference
+ in front of it is not the job."""
+ from jarvis.agentic_ide import opening
+
+ monkeypatch.setattr(
+ opening,
+ "opening_for",
+ lambda term: "@.jarvis/drops/shot.png There is a bug in the sidebar",
+ )
+ term = _pane(status="live")
+ for step in range(60):
+ term.transcript.feed(f"Analysing crash path {step} of the login flow\r\n")
+
+ recap = summarize(term)
+ assert recap.headline == "There is a bug in the sidebar"
+ assert recap.names_work is True
+
+
+def test_a_state_label_does_not_name_the_work(monkeypatch) -> None:
+ from jarvis.agentic_ide import opening
+
+ monkeypatch.setattr(opening, "opening_for", lambda term: "")
+ term = _pane(status="live")
+ for step in range(8):
+ term.transcript.feed(f"Startup step {step} of the banner sequence\r\n")
+
+ recap = summarize(term)
+ assert recap.headline.startswith("Claude Code — running")
+ assert recap.names_work is False
+
+
+def test_a_dropped_files_reference_is_not_the_job() -> None:
+ term = _pane(status="live", last_prompt="@.jarvis/drops/a.png @b.png Fix the login test")
+ assert summarize(term).headline == "Fix the login test"
diff --git a/tests/unit/agentic_ide/test_recap_engine.py b/tests/unit/agentic_ide/test_recap_engine.py
index af9ebf9e8b..779df6ae0c 100644
--- a/tests/unit/agentic_ide/test_recap_engine.py
+++ b/tests/unit/agentic_ide/test_recap_engine.py
@@ -108,14 +108,65 @@ def test_the_known_headline_is_what_the_header_last_showed() -> None:
def test_the_session_row_carries_the_known_headline_without_a_walk() -> None:
- """``to_row`` is the list's payload: it repeats the title, it never computes one."""
+ """``to_row`` is the list's payload: it repeats the title, it never walks the pane.
+
+ Before any header has described the pane, the row already names the prompt
+ it was sent — that is a field, not a scrollback walk. After the header's
+ poll, the row says exactly what the header says.
+ """
term = _pane(lines=3, last_prompt="Fix the failing login test")
- assert term.to_row()["recap"] == ""
+ assert term.to_row()["recap"] == "Fix the failing login test"
recap_engine.recap_for(term, lines=term.transcript.lines())
assert term.to_row()["recap"] == recap_engine.known_headline(term)
- assert term.to_row()["recap"] != ""
+ assert term.to_row()["recap"] == "Fix the failing login test"
+
+
+def test_a_state_label_is_not_what_the_list_remembers() -> None:
+ """The header of a pane asked nothing says "Claude Code — running since …".
+
+ That is true for one poll and is what a fresh title must replace; a list
+ that kept repeating it showed "Claude Code…" for panes an hour into their
+ work (maintainer report 2026-08-27).
+ """
+ term = _pane(lines=3)
+ shown = recap_engine.recap_for(term, lines=term.transcript.lines())
+ assert shown.headline.startswith("Claude Code — running")
+
+ assert recap_engine.known_headline(term) == ""
+ assert term.to_row()["recap"] == ""
+
+
+def test_a_prompt_sent_after_the_header_poll_outranks_the_stale_floor() -> None:
+ """The floor the header read BEFORE the prompt is yesterday's news."""
+ term = _pane(status="live")
+ term.transcript.feed("> make the setup wizard one screen\r\n")
+ for step in range(8):
+ term.transcript.feed(f"Working on step {step}\r\n")
+ recap_engine.recap_for(term, lines=term.transcript.lines())
+ assert recap_engine.known_headline(term) == "make the setup wizard one screen"
+
+ term.last_prompt = "Now fix the failing login test"
+ term.last_prompt_at = time.time() + 1.0
+
+ assert recap_engine.known_headline(term) == "Now fix the failing login test"
+
+
+def test_the_conversations_opening_titles_a_pane_nothing_else_names(monkeypatch) -> None:
+ """A restored pane has no prompt in memory and its typed echo has scrolled
+ away; the CLI's own transcript still opens with what it was asked."""
+ from jarvis.agentic_ide import opening
+
+ monkeypatch.setattr(
+ opening, "opening_for", lambda term: "@.jarvis/drops/shot.png There is a bug in the sidebar"
+ )
+ term = _pane(lines=3)
+
+ assert recap_engine.known_headline(term) == "There is a bug in the sidebar"
+ shown = recap_engine.recap_for(term, lines=term.transcript.lines())
+ assert shown.headline == "There is a bug in the sidebar"
+ assert term.to_row()["recap"] == "There is a bug in the sidebar"
# ------------------------------------------------------------- when it refreshes