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): a session's badge holds through a pause, follows the socket, and says done with a check

rubenluetke10-beep93c69af2508a
diff --git a/docs/BUGS.md b/docs/BUGS.md
index f506e5d301..59ccf3b533 100644
--- a/docs/BUGS.md
+++ b/docs/BUGS.md
@@ -13767,3 +13767,77 @@ the rail's stacking context").
overlays out, and it lets a section's z-indexes in. Anything in the chrome that
reaches past its own column must not rely on the column's z-index; a portal at
the tooltip level is the one placement no section can tie with.
+
+## BUG-194: the chat sidebar's session badges flipped between "working" and "done" for sessions that never stopped — a pane whose own spinner read "11m 00s" wore "Working for 7s", and ten sessions turned to finished dots at once and back two seconds later (MEDIUM, FIXED 2026-08-27)
+
+**Symptom.** In the Agentic IDE's chat mode the session rows showed a
+turning spinner or a still dot per session, and the dots were wrong: a
+session visibly mid-job in its terminal wore the finished dot for a beat,
+then the spinner again, and the chat stage's header restarted its clock
+each time ("Working for 7s" beside a Claude Code spinner reading
+"Untangling… 11m 00s"). The maintainer: "correct the indicators so they work,
+make them update live, and give me an indicator that says whether the
+session is working or done" (2026-08-27). Sampled from the live app over six
+minutes (`GET /api/agentic-ide/panes` every half second): at 11:48:11 TEN
+working panes flipped to `waiting` in the same second — each with output
+0.1–0.6 s old — and back to `working` two seconds later; single panes did
+the same after output gaps of 4.5–6.4 s.
+
+**Cause.** Three things, in the order they mattered.
+
+1. The badge published the RAW stillness edge. `activity.read_activity`
+ calls a pane `waiting` the moment its screen has stood still for
+ `STILL_S` (4 s), and the sweep stamped that word straight onto the pane.
+ Two known pauses cross that line while a job is running: a coding TUI's
+ gap between tool steps (measured 4.5–6.4 s on the maintainer's panes),
+ and the resize shadow — after a layout change every pane's output is
+ discounted for `RESIZE_SHADOW_S` and its screen changes for one sweep
+ more, so a global resize turns every working pane "still" at once. The
+ mass flip at 11:48:11 is that shadow. `WORK_RESUME_GRACE_S` (BUG-tool-step,
+ 2026-08-07) had only spared the RE-CONFIRMATION on the way back up; the dip
+ itself still went out, and `stamp` restarted `activity_since` on every
+ transition, which is where "for 7s" came from.
+2. The sidebar learned any of it four seconds late. `store/workspacePanes.ts`
+ polled `/panes` every 4 s and nothing pushed a change, so even a correct
+ backend word showed up a poll late — long enough for a finished session to
+ keep spinning while the user looked at it.
+3. "Done" was a still amber dot beside amber spinners, which read as "also
+ busy, just not animated" — the reason the maintainer asked for an
+ indicator the list already had.
+
+**Fix.**
+
+1. `notifications.WORK_HOLD_S` (= `SETTLE_S`): a pane that wore "working"
+ keeps wearing it for five seconds past the raw flip to `waiting`, with
+ `moving_since` kept so its clock counts the whole episode. A question on
+ screen is not held — it outranks the hold, as it outranks the submit
+ grace. When the hold runs out the stop is dated from the last paint
+ (`_stopped_at`), not from the sweep that admitted it. The bell already
+ waited `SETTLE_S` before announcing; the badge now never says "done"
+ after the bell has.
+2. The sweep publishes every change of the shown reading on the bus
+ (`AgenticIdePaneActivity`: workspace id, pane key, status, activity,
+ since, worked — the activity half of a `/panes` row). `ActivityFeed`
+ diffs against the last sweep so only transitions go out; the web server
+ hands the sweep its `bus.publish` at router mount (the registry stays
+ bus-less by design). `useWebSocket` raises it as
+ `jarvis:agentic-ide-activity`; the pane store and the grid's activity
+ cache patch their row in place. The polls stay as the fallback.
+3. `PaneActivityPill` draws a finished job as a check mark; the still dot
+ is left to `exited`.
+
+Tests: `tests/unit/agentic_ide/test_pane_notifications.py` ("a short pause
+is not published as done", "a stop is dated from the last paint", "a
+question is not held back by the hold", the feed reports a pane once per
+change, changes go to the bus as pane activity events, a deaf bus does not
+end the sweep), `store/workspacePanes.test.ts`, `useWebSocket.test.tsx`
+("hands a pane's activity change to the window"), and the three icon
+assertions moved from `dot` to `check`.
+
+**Lesson.** A detector's raw edge is not the user's word for it. The
+movement rule was measured and right; publishing its first flicker was the
+bug, and the fix for the way UP (`WORK_RESUME_GRACE_S`) had left the way
+DOWN alone. When a badge and a bell answer the same question they must
+share the same debounce, or one of them is wrong by construction. And a
+list that only polls is a list that lies for a poll interval — the thing
+that decides a state should say so.
diff --git a/jarvis/agentic_ide/notifications.py b/jarvis/agentic_ide/notifications.py
index 2beb7439ff..281b927eef 100644
--- a/jarvis/agentic_ide/notifications.py
+++ b/jarvis/agentic_ide/notifications.py
@@ -88,6 +88,7 @@ from __future__ import annotations
import asyncio
import time
from collections import deque
+from collections.abc import Awaitable, Callable
from dataclasses import dataclass, field
from itertools import count
from typing import TYPE_CHECKING, Any, Literal, NamedTuple
@@ -133,6 +134,28 @@ SWEEP_INTERVAL_S = 2.0
#: the user prints something into it (the case the confirm gate exists for).
WORK_RESUME_GRACE_S = 15.0
+#: How long the badge keeps saying "working" after the screen stopped moving.
+#:
+#: The other half of the tool-step problem ``WORK_RESUME_GRACE_S`` solved. That
+#: grace let a job RESUME without re-confirmation, but the dip itself was still
+#: published: the raw reading flips to ``waiting`` the moment a pane has stood
+#: still for ``STILL_S``, so every pause longer than that — a slow tool call,
+#: the model's own think time, the redraw shadow of a resize — turned the
+#: session's badge into a finished dot for a sweep or two and restarted its
+#: clock. The maintainer watched a pane whose own spinner read "11m 00s" wear
+#: "Working for 7s" beside it (2026-08-27), and a row of twenty sessions
+#: flickered between busy and done for work that never stopped.
+#:
+#: So a pane that WAS working is only called stopped once it has held still
+#: for this long past the raw flip — the same window the bell already waits
+#: (``SETTLE_S``) before announcing the stop. One number for both on purpose:
+#: the badge is the thing the bell points at, and it must never say "done"
+#: after the bell has already said so. Cost: a finished pane shows its dot
+#: about ``STILL_S + SETTLE_S`` seconds after its last paint instead of
+#: ``STILL_S``. The hold covers ``waiting`` only — a question on screen still
+#: takes over at once, because the pane really has stopped for the user.
+WORK_HOLD_S = SETTLE_S
+
#: How many entries are kept. A heavy day across six workspaces produces a few
#: dozen; past this the oldest fall off the back, which is the right end to lose
#: — the panes they point at are the ones most likely to be gone.
@@ -369,6 +392,18 @@ class _PaneWatch:
stamped_working_at: float = 0.0
+def _stopped_at(term: Any, watch: _PaneWatch) -> float:
+ """When this pane's screen last moved — the honest start of its stillness.
+
+ The later of the last output byte and the last sweep that saw the picture
+ change: output is stamped the instant it arrives, while a screen change is
+ only noticed at sweep time, so either can be the fresher of the two. Zero
+ when neither is known, which ``stamp`` reads as "now".
+ """
+ out_at = float(getattr(term, "last_output_at", 0.0) or 0.0)
+ return max(out_at, float(watch.changed_at or 0.0))
+
+
def _detail(term: Any) -> str:
"""One line about what the pane was doing, from state it already keeps."""
text = " ".join(str(getattr(term, "last_prompt", "") or "").split())
@@ -568,12 +603,17 @@ class ActivityWatcher:
# ``since`` is the moment the movement episode actually began, so the
# handover at the confirm boundary does not restart the badge's clock —
# "working for 6s" must not read "for 0s" merely because the first 5
- # were spent confirming.
+ # were spent confirming. And a pane that STOPPED is dated from its last
+ # movement, not from the sweep that noticed: the hold above means the
+ # notice comes seconds after the fact, and "Done for 0s" about a pane
+ # that went quiet nine seconds ago is the clock lying in the other
+ # direction.
+ confirmed = self._confirmed(term, watch, activity, now)
stamp(
term,
- self._confirmed(term, watch, activity, now),
+ confirmed,
now=now,
- since=watch.moving_since,
+ since=watch.moving_since if confirmed == "working" else _stopped_at(term, watch),
)
self._checkpoint_resume_state(term, activity, watch, now)
@@ -630,8 +670,17 @@ class ActivityWatcher:
false "waiting" dips. The gate exists for the pane that has been SITTING
at its prompt when a burst arrives, and such a pane has not worn
"working" for a long time.
+
+ And the way DOWN is guarded too (:data:`WORK_HOLD_S`): a pane that wore
+ "working" a moment ago keeps wearing it through a short still spell,
+ so a tool-step pause or a resize redraw is not published as "done".
+ ``moving_since`` survives the hold, which is what keeps the badge's
+ clock counting the whole episode rather than restarting after every
+ pause. Only ``waiting`` is held — a question outranks the hold.
"""
if activity != "working":
+ if activity == "waiting" and 0 <= now - watch.stamped_working_at <= WORK_HOLD_S:
+ return "working"
watch.moving_since = None
return activity
if watch.moving_since is None:
@@ -821,6 +870,96 @@ _CENTER = NotificationCenter()
_WATCHER = ActivityWatcher(_CENTER)
+class ActivityFeed:
+ """Which panes' PUBLISHED reading changed since the last sweep.
+
+ The sweep stamps a word on every pane two times a second-ish; almost every
+ stamp repeats the last one. Clients want the transitions — a pane that
+ started, stopped, asked, or died — and this is the diff that finds them, so
+ the bus carries one event per change rather than a heartbeat per pane.
+
+ Compared on what a client would SHOW (:meth:`Terminal.reading`, the graced
+ word behind ``/panes``, plus ``worked`` and the process status), not on the
+ watcher's raw reading: the point is that the row on screen and the event
+ that patched it can never disagree. Every pane of every open workspace is
+ covered — a plain shell too, whose only news is its process ending.
+ """
+
+ def __init__(self) -> None:
+ self._last: dict[tuple[str, str], tuple[str, str, float, bool]] = {}
+
+ def changes(self, registry: Registry) -> list[dict[str, Any]]:
+ """The rows whose reading differs from the last call — and drop the gone."""
+ # Local import: ``session`` imports this module's siblings.
+ from .activity import has_work_behind_it
+
+ changed: list[dict[str, Any]] = []
+ alive: set[tuple[str, str]] = set()
+ for session in registry.sessions:
+ for term in session.terminals:
+ ident = (str(session.id), str(getattr(term, "key", "") or ""))
+ alive.add(ident)
+ reading = term.reading()
+ status = str(getattr(term, "status", "") or "")
+ activity = str(reading.activity)
+ since = float(reading.since or 0.0)
+ worked = has_work_behind_it(term)
+ mark = (status, activity, since, worked)
+ if self._last.get(ident) != mark:
+ self._last[ident] = mark
+ changed.append(
+ {
+ "session_id": ident[0],
+ "key": ident[1],
+ "name": str(getattr(term, "name", "") or ""),
+ "status": status,
+ "activity": activity,
+ "activity_since": since,
+ "worked": worked,
+ }
+ )
+ for gone in self._last.keys() - alive:
+ del self._last[gone]
+ return changed
+
+ def clear(self) -> None:
+ self._last.clear()
+
+
+_FEED = ActivityFeed()
+
+#: Where a change goes once the feed has found one — the app bus's ``publish``,
+#: handed in by the one place that holds a bus (the web server, at router
+#: mount). The registry deliberately has no bus of its own (see
+#: ``session.terminals_added_event``), and the sweep is started by the
+#: registry, so the hook is module state rather than an argument. ``None``
+#: means nobody is listening: a headless embedding, or a test — the feed still
+#: runs, its answers just go nowhere.
+Publisher = Callable[[Any], Awaitable[None]]
+_publisher: Publisher | None = None
+
+
+def set_publisher(publish: Publisher | None) -> None:
+ """Route pane activity changes onto ``publish`` (``None`` to stop)."""
+ global _publisher
+ _publisher = publish
+
+
+async def _publish_changes(registry: Registry) -> None:
+ """Send every pane whose reading changed this sweep to the bus."""
+ publish = _publisher
+ changed = _FEED.changes(registry)
+ if publish is None or not changed:
+ return
+ from jarvis.core.events import AgenticIdePaneActivity
+
+ for row in changed:
+ try:
+ await publish(AgenticIdePaneActivity(**row, source_layer="agentic_ide.notifications"))
+ except Exception as exc: # noqa: BLE001 - a deaf bus must not end the sweep
+ logger.warning("Agentic IDE: could not publish activity for {}: {}", row["name"], exc)
+
+
def center() -> NotificationCenter:
"""The process-wide store the routes read."""
return _CENTER
@@ -836,6 +975,8 @@ def reset() -> None:
_CENTER.clear()
_WATCHER._panes.clear() # noqa: SLF001 - same module, one owner
_WATCHER._resume_dirty = False # noqa: SLF001 - same module, one owner
+ _FEED.clear()
+ set_publisher(None)
reset_switch_cache()
@@ -869,6 +1010,9 @@ async def _run(registry: Registry) -> None:
_WATCHER.poll(registry, emit=await _enabled_off_loop())
if _WATCHER.take_resume_dirty():
await registry.persist_resume_activity()
+ # After the stamps, so the event carries the word this sweep
+ # decided on — the same one the next ``/panes`` poll would.
+ await _publish_changes(registry)
except Exception as exc: # noqa: BLE001 - one bad pane must not end the sweep
logger.warning("Agentic IDE: pane notification sweep failed: {}", exc)
except asyncio.CancelledError: # pragma: no cover - shutdown
@@ -934,7 +1078,9 @@ __all__ = [
"MAX_ENTRIES",
"SETTLE_S",
"SWEEP_INTERVAL_S",
+ "WORK_HOLD_S",
"WORK_RESUME_GRACE_S",
+ "ActivityFeed",
"ActivityWatcher",
"Kind",
"Notification",
@@ -943,6 +1089,7 @@ __all__ = [
"center",
"enabled",
"reset",
+ "set_publisher",
"reset_switch_cache",
"start",
"state",
diff --git a/jarvis/core/events.py b/jarvis/core/events.py
index 1c9d2f717c..6448e859dc 100644
--- a/jarvis/core/events.py
+++ b/jarvis/core/events.py
@@ -757,6 +757,34 @@ class AgenticIdeWorkspaceChanged(Event):
open_workspaces: int = 0
+@dataclass(frozen=True, slots=True)
+class AgenticIdePaneActivity(Event):
+ """One pane's agent changed state: started working, stopped, asked, exited.
+
+ The pane list and the chat stage used to learn this by polling — every
+ four seconds for the sidebar — so a session that finished showed a spinner
+ for up to a poll interval after its terminal had gone quiet, and the
+ dozen rows of a busy workspace never quite agreed with the grid. The sweep
+ that stamps the reading (``jarvis.agentic_ide.notifications``) already
+ knows the moment a word changes; this carries that moment to every client
+ on the app socket, and the polls become the fallback they should be.
+
+ The payload IS the reading, not a trigger: it is exactly the activity half
+ of a row from ``GET /api/agentic-ide/panes`` (``session_id`` naming the
+ workspace, ``key`` the pane's stable call-sign), so a client patches its
+ row in place and never has to re-fetch the list to act on it. A row the
+ client does not hold — a pane it has not listed yet — is ignored there and
+ arrives with the next poll.
+ """
+ session_id: str = ""
+ key: str = ""
+ name: str = ""
+ status: str = ""
+ activity: str = ""
+ activity_since: float = 0.0
+ worked: bool = False
+
+
@dataclass(frozen=True, slots=True)
class AgenticIdePromptSent(Event):
"""A prompt was typed into one pane by Jarvis rather than by the user.
diff --git a/jarvis/ui/web/frontend/src/components/agentic/PaneActivityPill.test.tsx b/jarvis/ui/web/frontend/src/components/agentic/PaneActivityPill.test.tsx
index aafe513ec9..6e1f344499 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/PaneActivityPill.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/PaneActivityPill.test.tsx
@@ -30,10 +30,13 @@ describe("what the badge shows", () => {
expect(badge.getAttribute("data-icon")).toBe("spinner");
});
- it("shows a still amber dot for a pane that was given a job and has stopped", () => {
+ it("shows an amber check mark for a pane that was given a job and has finished", () => {
+ // A check, not a still dot: beside a row of spinners a dot read as "also
+ // busy, just not animated", and the maintainer asked for an indicator
+ // that says working or done (2026-08-27).
const badge = pill({ status: "live", activity: "waiting", worked: true });
expect(badge.textContent).toBe("");
- expect(badge.getAttribute("data-icon")).toBe("dot");
+ expect(badge.getAttribute("data-icon")).toBe("check");
expect(badge.className).toContain("text-amber-400");
});
diff --git a/jarvis/ui/web/frontend/src/components/agentic/PaneActivityPill.tsx b/jarvis/ui/web/frontend/src/components/agentic/PaneActivityPill.tsx
index e5b027dfd8..a36a86f9f9 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/PaneActivityPill.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/PaneActivityPill.tsx
@@ -1,4 +1,4 @@
-import { AlertCircle, Loader2 } from "lucide-react";
+import { AlertCircle, Check, Loader2 } from "lucide-react";
import { cn } from "@/lib/utils";
import type { PaneActivity } from "@/lib/agenticIdeApi";
@@ -49,18 +49,25 @@ import type { PaneActivity } from "@/lib/agenticIdeApi";
*
* The two states a person scans this list for — still grinding vs. finished —
* are told apart by SHAPE first, not by hue: a pane that is working shows a
- * turning spinner, and a pane that has stopped shows a still dot. That reads at
- * a glance, survives every colour-blindness, and it is why the working state is
- * no longer a pulsing dot: a slow throb and a steady dot are the same silhouette
- * at 8 pixels, so the difference lived entirely in a colour the eye had to
- * compare against its neighbours to judge.
+ * turning spinner, and a pane that has finished shows a check mark. That reads
+ * at a glance, survives every colour-blindness, and it is why the working state
+ * is no longer a pulsing dot: a slow throb and a steady dot are the same
+ * silhouette at 8 pixels, so the difference lived entirely in a colour the eye
+ * had to compare against its neighbours to judge.
+ *
+ * The finished state is a CHECK and not a still dot for the same reason. A dot
+ * is what every list uses for "online", and beside a row of amber spinners an
+ * amber dot read as "also busy, just not animated right now" — the maintainer
+ * asked for an indicator that says working or done, looking at a list that
+ * already had one (2026-08-27). A check says finished the way a spinner says
+ * busy: on its own, without a neighbour to compare against.
*
* Colour then carries the second question — is this pane's stillness news? Amber
- * is the app's own accent and marks a pane holding something for you: filled for
- * a finished job, hollow for one that is merely ready and has done nothing yet.
- * Blue is spent on the one state that wants an action from you right now, a pane
- * stopped on a question. Grey is for a pane with nothing to report, red for a
- * broken one.
+ * is the app's own accent and marks a pane holding something for you: a check
+ * for a finished job, a hollow ring for one that is merely ready and has done
+ * nothing yet. Blue is spent on the one state that wants an action from you
+ * right now, a pane stopped on a question. Grey is for a pane with nothing to
+ * report, red for a broken one.
*/
/**
@@ -87,9 +94,9 @@ type Look = {
state: PaneActivityState;
label: string;
className: string;
- icon: "spinner" | "dot" | "ring" | "alert" | "beacon";
+ icon: "spinner" | "dot" | "ring" | "alert" | "beacon" | "check";
/**
- * A soft halo of the dot's own colour. Spent on exactly one state — a
+ * A soft halo of the mark's own colour. Spent on exactly one state — a
* finished job — so the one row holding something for you glows and the
* grey ones (exited, a plain shell) stay matte.
*/
@@ -156,18 +163,19 @@ const DONE: Look = {
state: "done",
label: "done",
className: "text-amber-400",
- icon: "dot",
+ icon: "check",
glow: true,
hint: "Finished and waiting at its prompt. That it stopped, not that the work is right.",
};
/**
- * Ready, but holding nothing — the same amber, drawn hollow.
+ * Ready, but holding nothing — the same amber, drawn as an empty ring.
*
* A ring rather than a second colour because this is the SAME piece of news as
* `done` with one part missing: the pane is quiet and yours to talk to, it just
- * has no finished job behind it. Reading "empty" out of an unfilled shape is
- * what a fuel gauge does, and it keeps the accent colour meaning one thing.
+ * has no finished job behind it. Reading "nothing here yet" out of an unfilled
+ * shape is what a fuel gauge does, and it keeps the accent colour meaning one
+ * thing.
*/
const IDLE: Look = {
state: "idle",
@@ -286,12 +294,22 @@ export function durationLabel(since: number, now: number): string {
return hours === 1 ? "1 hour" : `${hours} hours`;
}
-/** The soft self-coloured halo a dot that holds something for you wears. */
+/** The soft self-coloured halo a mark that holds something for you wears. */
const GLOW = "shadow-[0_0_5px_currentColor]";
+/** The same halo for a stroked icon, where a box shadow would draw a square. */
+const GLOW_STROKE = "drop-shadow-[0_0_3px_currentColor]";
function Icon({ look }: { look: Look }) {
if (look.icon === "spinner")
return <Loader2 className="h-3 w-3 animate-spin motion-reduce:animate-none" />;
+ if (look.icon === "check")
+ return (
+ <Check
+ className={cn("h-3.5 w-3.5", look.glow && GLOW_STROKE)}
+ strokeWidth={3}
+ aria-hidden="true"
+ />
+ );
if (look.icon === "dot")
return (
<span
diff --git a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceChats.tsx b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceChats.tsx
index 83985f309d..617ecc4cbe 100644
--- a/jarvis/ui/web/frontend/src/components/agentic/WorkspaceChats.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentic/WorkspaceChats.tsx
@@ -454,10 +454,12 @@ function SessionRow({
still dot are the same silhouette, so twelve sessions in twelve
states read as twelve identical dots (maintainer report
2026-08-27). The pill tells busy from finished by SHAPE: a turning
- spinner while the agent works, a still dot once it has stopped, a
+ spinner while the agent works, a check mark once it has finished, a
hollow ring for a pane nobody has asked anything, a beacon for one
holding a question. Same component as the pane's header, so the
- list and the grid can never disagree about one pane. */}
+ list and the grid can never disagree about one pane — and both
+ follow the socket's word the moment the backend decides it (see
+ the store), so the row changes with the pane, not with the poll. */}
<span className="mt-0.5 shrink-0">
<PaneActivityPill
status={pane.status}
diff --git a/jarvis/ui/web/frontend/src/hooks/useWebSocket.test.tsx b/jarvis/ui/web/frontend/src/hooks/useWebSocket.test.tsx
index 7fbbe269ac..1f54f341d2 100644
--- a/jarvis/ui/web/frontend/src/hooks/useWebSocket.test.tsx
+++ b/jarvis/ui/web/frontend/src/hooks/useWebSocket.test.tsx
@@ -204,6 +204,43 @@ describe("useWebSocket VoiceBootStatus handling", () => {
expect(toasts[2].message).toContain("never showed it arriving");
});
+ it("hands a pane's activity change to the window, payload intact and without a toast", async () => {
+ render(<Harness />);
+ await Promise.resolve();
+ const seen: unknown[] = [];
+ const onActivity = (event: Event) => seen.push((event as CustomEvent).detail);
+ window.addEventListener("jarvis:agentic-ide-activity", onActivity);
+ try {
+ MockWebSocket.last!.deliver(
+ envelope("AgenticIdePaneActivity", {
+ session_id: "ide_1",
+ key: "t3",
+ name: "T3",
+ status: "live",
+ activity: "waiting",
+ activity_since: 1787823736,
+ worked: true,
+ }),
+ );
+ } finally {
+ window.removeEventListener("jarvis:agentic-ide-activity", onActivity);
+ }
+
+ expect(seen).toEqual([
+ {
+ session_id: "ide_1",
+ key: "t3",
+ name: "T3",
+ status: "live",
+ activity: "waiting",
+ activity_since: 1787823736,
+ worked: true,
+ },
+ ]);
+ // The bell is the surface for "it finished"; the badge just keeps up.
+ expect(useEventStore.getState().toasts).toEqual([]);
+ });
+
it("routes native microphone levels outside React state and clears them after listening", async () => {
render(<Harness />);
await Promise.resolve();
diff --git a/jarvis/ui/web/frontend/src/hooks/useWebSocket.ts b/jarvis/ui/web/frontend/src/hooks/useWebSocket.ts
index 1b9d8ea503..4957d4777e 100644
--- a/jarvis/ui/web/frontend/src/hooks/useWebSocket.ts
+++ b/jarvis/ui/web/frontend/src/hooks/useWebSocket.ts
@@ -25,6 +25,7 @@ import {
} from "@/store/commandActivity";
import { useDeckStore } from "@/store/deck";
import { useHomeStore } from "@/store/home";
+import { PANE_ACTIVITY_EVENT } from "@/store/workspacePanes";
import { WSAudioLevel, WSEventEnvelope, WSWelcome } from "@/schema/ws";
import { useI18nStore, hydrateUiLanguage, hydrateReplyLanguage, translate } from "@/i18n";
import { hydrateUiTheme } from "@/hooks/useTheme";
@@ -520,6 +521,19 @@ export function useWebSocket(): void {
}
}
+ if (env.event_name === "AgenticIdePaneActivity") {
+ // One pane's agent changed state — started, stopped, asked, died.
+ // The payload is the activity half of a `/panes` row, so the session
+ // list and the grid patch their row in place the moment the sweep
+ // decides, instead of showing a spinner over a finished session
+ // until their next poll (up to four seconds in the sidebar). No
+ // toast: the bell is the surface for "it finished", this is the
+ // badge keeping up with the pane.
+ window.dispatchEvent(
+ new CustomEvent(PANE_ACTIVITY_EVENT, { detail: env.payload }),
+ );
+ }
+
if (env.event_name === "AgenticIdeComposeProgress") {
// One beat of a brief being written for a pane — the prompt bar
// shows it as a live status line. Deliberately no toast: a single
diff --git a/jarvis/ui/web/frontend/src/store/workspacePanes.test.ts b/jarvis/ui/web/frontend/src/store/workspacePanes.test.ts
new file mode 100644
index 0000000000..4397d7f1d8
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/store/workspacePanes.test.ts
@@ -0,0 +1,147 @@
+/**
+ * The session list's one store: a poll for the list, and the socket's word
+ * for what each session is DOING — patched in place the moment it arrives,
+ * so a finished session does not keep its spinner until the next poll.
+ */
+import { act, renderHook } from "@testing-library/react";
+import { afterEach, beforeEach, describe, expect, it } from "vitest";
+
+import type { WorkspacePaneRow } from "@/lib/agenticIdeApi";
+import {
+ PANE_ACTIVITY_EVENT,
+ readPaneActivityChange,
+ resetWorkspacePanesPoll,
+ useWorkspacePanes,
+ useWorkspacePanesStore,
+} from "@/store/workspacePanes";
+
+function pane(name: string, workspaceId: string, overrides: Partial<WorkspacePaneRow> = {}) {
+ return {
+ workspace_id: workspaceId,
+ workspace_name: "Personal Jarvis",
+ folder: "C:\\Users\\dev\\Personal Jarvis",
+ workspace_active: true,
+ key: name.toLowerCase(),
+ history_id: `${name}@${workspaceId}`,
+ name,
+ agent: "claude",
+ display_name: "Claude Code",
+ accepts_prompts: true,
+ status: "live" as const,
+ exit_code: null,
+ activity: "working" as const,
+ activity_since: 1000,
+ worked: true,
+ started_at: 1,
+ last_output_at: 2,
+ last_prompt: "",
+ last_prompt_at: null,
+ recap: "Refactor the router",
+ has_resume: false,
+ readable: true,
+ account: null,
+ account_label: null,
+ archived: false,
+ ...overrides,
+ };
+}
+
+const finished = (name: string, workspace = "w1") => ({
+ session_id: workspace,
+ key: name.toLowerCase(),
+ name,
+ status: "live",
+ activity: "waiting" as const,
+ activity_since: 1042,
+ worked: true,
+});
+
+describe("the pane store follows the socket's word", () => {
+ beforeEach(() => {
+ resetWorkspacePanesPoll();
+ useWorkspacePanesStore.setState({
+ panes: [pane("T1", "w1"), pane("T2", "w1"), pane("T1", "w2")],
+ activeId: "w1",
+ loaded: true,
+ load: async () => {},
+ });
+ });
+ afterEach(() => resetWorkspacePanesPoll());
+
+ it("patches exactly the row the change names — by workspace AND call-sign", () => {
+ useWorkspacePanesStore.getState().applyActivity(finished("T1", "w2"));
+
+ const rows = useWorkspacePanesStore.getState().panes;
+ expect(rows.map((row) => `${row.workspace_id}/${row.name}:${row.activity}`)).toEqual([
+ "w1/T1:working",
+ "w1/T2:working",
+ "w2/T1:waiting",
+ ]);
+ const patched = rows[2];
+ expect(patched.activity_since).toBe(1042);
+ expect(patched.worked).toBe(true);
+ // Everything the event does not carry is kept, not blanked.
+ expect(patched.recap).toBe("Refactor the router");
+ expect(patched.display_name).toBe("Claude Code");
+ });
+
+ it("leaves a pane it has never listed for the next poll", () => {
+ const before = useWorkspacePanesStore.getState().panes;
+ useWorkspacePanesStore.getState().applyActivity(finished("T9"));
+ expect(useWorkspacePanesStore.getState().panes).toBe(before);
+ });
+
+ it("keeps the list's identity when the event repeats what the poll said", () => {
+ useWorkspacePanesStore.getState().applyActivity(finished("T1"));
+ const after = useWorkspacePanesStore.getState().panes;
+ useWorkspacePanesStore.getState().applyActivity(finished("T1"));
+ expect(useWorkspacePanesStore.getState().panes).toBe(after);
+ });
+
+ it("takes a process status only from the four the row can hold", () => {
+ useWorkspacePanesStore
+ .getState()
+ .applyActivity({ ...finished("T2"), status: "exited", activity: "exited" });
+ expect(useWorkspacePanesStore.getState().panes[1].status).toBe("exited");
+
+ useWorkspacePanesStore
+ .getState()
+ .applyActivity({ ...finished("T2"), status: "bogus", activity: "waiting" });
+ expect(useWorkspacePanesStore.getState().panes[1].status).toBe("exited");
+ });
+
+ it("listens on the window for as long as somebody reads the list", () => {
+ const { unmount } = renderHook(() => useWorkspacePanes());
+
+ act(() => {
+ window.dispatchEvent(new CustomEvent(PANE_ACTIVITY_EVENT, { detail: finished("T1") }));
+ });
+ expect(useWorkspacePanesStore.getState().panes[0].activity).toBe("waiting");
+
+ unmount();
+ act(() => {
+ window.dispatchEvent(
+ new CustomEvent(PANE_ACTIVITY_EVENT, {
+ detail: { ...finished("T2"), activity: "asking" },
+ }),
+ );
+ });
+ // Nobody is looking: the event is dropped, exactly like the poll stops.
+ expect(useWorkspacePanesStore.getState().panes[1].activity).toBe("working");
+ });
+
+ it("ignores a detail that is not a change", () => {
+ expect(readPaneActivityChange(null)).toBeNull();
+ expect(readPaneActivityChange("T1")).toBeNull();
+ expect(readPaneActivityChange({ key: "t1" })).toBeNull();
+ expect(readPaneActivityChange({ session_id: "w1", key: "t1" })).toEqual({
+ session_id: "w1",
+ key: "t1",
+ name: "",
+ status: "",
+ activity: "",
+ activity_since: 0,
+ worked: false,
+ });
+ });
+});
diff --git a/jarvis/ui/web/server.py b/jarvis/ui/web/server.py
index 4171d6ae94..4fda2db49d 100644
--- a/jarvis/ui/web/server.py
+++ b/jarvis/ui/web/server.py
@@ -514,6 +514,13 @@ class WebServer:
# workspace above; adds the folder picker, call-signs, transcripts, and
# the focused coding mode.
app.include_router(agentic_ide_router)
+ # The pane-activity sweep has no bus of its own (the registry is a plain
+ # holder by design); this is the one place that holds one, so the sweep
+ # is told where a changed reading goes. A reference, not work — nothing
+ # runs until a workspace is opened (AP-26).
+ from jarvis.agentic_ide import notifications as ide_notifications
+
+ ide_notifications.set_publisher(self.bus.publish)
# The project/chat library behind the chat surface's sidebar. Pure file
# store, no Brain and no session dependency — it lists on a fresh
# install with no keys and answers headless.
diff --git a/tests/unit/agentic_ide/test_pane_notifications.py b/tests/unit/agentic_ide/test_pane_notifications.py
index 5221275c08..7d111ebbff 100644
--- a/tests/unit/agentic_ide/test_pane_notifications.py
+++ b/tests/unit/agentic_ide/test_pane_notifications.py
@@ -18,11 +18,13 @@ and is unusable in a grid of twelve.
from __future__ import annotations
+import time
from pathlib import Path
from typing import Any
import pytest
+from jarvis.agentic_ide import activity as activity_mod
from jarvis.agentic_ide import notifications
from jarvis.agentic_ide import session as session_mod
from jarvis.agentic_ide.activity import STILL_S, read_activity
@@ -723,19 +725,186 @@ async def test_a_tool_step_gap_does_not_demand_reconfirmation(
watcher.poll(registry, now=at)
assert term.activity == "working", "sustained movement confirms"
- # A quiet tool step: the screen stands still past its freshness tail.
+ # A quiet tool step: the screen stands still past its freshness tail. The
+ # RAW reading says waiting; the badge holds (see the next test).
watcher.poll(registry, now=1008.0 + STILL_S + 1)
+ assert watcher._panes[(_session.id, term.key)].activity == "waiting" # noqa: SLF001
+ assert term.activity == "working"
+
+ # The pause outlasts the hold: now it is a stop, dated from the last paint.
+ watcher.poll(registry, now=1008.0 + notifications.WORK_HOLD_S + 1)
assert term.activity == "waiting"
# Work resumes. The badge must follow on the SAME sweep, not five later.
term.transcript.clear()
_draw(term, "\r\n· working again after the tool call\r\n")
- term.last_output_at = 1015.0
- watcher.poll(registry, now=1015.0)
+ term.last_output_at = 1020.0
+ watcher.poll(registry, now=1020.0)
assert term.activity == "working", "a resuming job needs no re-confirmation"
+async def test_a_short_pause_is_not_published_as_done(registry: Registry, tmp_path: Path) -> None:
+ """The dip itself. A working pane that stands still for a beat — a slow
+ tool call, the redraw shadow of a resize — used to flip the badge to a
+ finished dot for a sweep and restart its clock: a pane whose own spinner
+ read "11m 00s" wore "Working for 7s" (maintainer, 2026-08-27). The badge
+ now holds "working" for WORK_HOLD_S past the raw flip, and the episode's
+ start survives the pause."""
+ watcher = notifications.watcher()
+ _session, term = await _pane(registry, tmp_path)
+ term.last_submit_at = 500.0
+ term.submit_generation = term.process_generation
+ _quiet_since(term, 999.0)
+ _draw(term, IDLE_SCREEN)
+ watcher.poll(registry, now=996.0)
+
+ for step, at in enumerate((1000.0, 1002.0, 1004.0, 1006.0, 1008.0)):
+ term.transcript.clear()
+ _draw(term, f"\r\n· working, frame {step}\r\n")
+ term.last_output_at = at
+ watcher.poll(registry, now=at)
+ assert (term.activity, term.activity_since) == ("working", 1000.0)
+
+ # Still past STILL_S — the raw reading has flipped — but inside the hold.
+ for at in (1008.0 + STILL_S + 1, 1008.0 + notifications.WORK_HOLD_S):
+ watcher.poll(registry, now=at)
+ assert term.activity == "working", f"a pause of {at - 1008.0:.0f}s is not a stop"
+ assert term.activity_since == 1000.0, "the clock counts the whole episode"
+
+ # Work resumes: same episode, same clock.
+ term.transcript.clear()
+ _draw(term, "\r\n· working again\r\n")
+ term.last_output_at = 1014.0
+ watcher.poll(registry, now=1014.0)
+ assert (term.activity, term.activity_since) == ("working", 1000.0)
+
+
+async def test_a_stop_is_dated_from_the_last_paint(registry: Registry, tmp_path: Path) -> None:
+ """When the hold runs out the badge says "done" — and says since WHEN it
+ has been done: the moment the screen last moved, not the sweep that
+ finally admitted it. "Done for 0s" about a pane quiet for nine seconds is
+ the clock lying the other way."""
+ watcher = notifications.watcher()
+ _session, term = await _pane(registry, tmp_path)
+ term.last_submit_at = 500.0
+ term.submit_generation = term.process_generation
+ _quiet_since(term, 999.0)
+ _draw(term, IDLE_SCREEN)
+ watcher.poll(registry, now=996.0)
+ for step, at in enumerate((1000.0, 1002.0, 1004.0, 1006.0, 1008.0)):
+ term.transcript.clear()
+ _draw(term, f"\r\n· working, frame {step}\r\n")
+ term.last_output_at = at
+ watcher.poll(registry, now=at)
+
+ watcher.poll(registry, now=1008.0 + STILL_S + 1)
+ watcher.poll(registry, now=1008.0 + notifications.WORK_HOLD_S + 1)
+
+ assert term.activity == "waiting"
+ assert term.activity_since == 1008.0, "quiet since the last paint, not since the sweep"
+
+
+async def test_a_question_is_not_held_back_by_the_hold(registry: Registry, tmp_path: Path) -> None:
+ """A working pane that stops on a permission prompt has stopped FOR THE
+ USER. The hold covers a plain pause only; a question on screen takes the
+ badge over the moment the raw reading sees it."""
+ watcher = notifications.watcher()
+ _session, term = await _pane(registry, tmp_path)
+ term.last_submit_at = 500.0
+ term.submit_generation = term.process_generation
+ _quiet_since(term, 999.0)
+ _draw(term, IDLE_SCREEN)
+ watcher.poll(registry, now=996.0)
+ for step, at in enumerate((1000.0, 1002.0, 1004.0, 1006.0, 1008.0)):
+ term.transcript.clear()
+ _draw(term, f"\r\n· working, frame {step}\r\n")
+ term.last_output_at = at
+ watcher.poll(registry, now=at)
+
+ term.transcript.clear()
+ _draw(term, QUESTION_SCREEN)
+ term.last_output_at = 1009.0
+ watcher.poll(registry, now=1009.0)
+ watcher.poll(registry, now=1009.0 + STILL_S + 1)
+
+ assert term.activity == "asking"
+
+
+# ------------------------------------------------------------ the live feed
+#
+# The sweep is the one thing that knows the MOMENT a pane's word changes; the
+# feed turns that into one event per change for every client on the app
+# socket, so a finished session shows as finished without waiting for a poll.
+
+
+async def test_the_feed_reports_a_pane_once_per_change(registry: Registry, tmp_path: Path) -> None:
+ feed = notifications.ActivityFeed()
+ session, term = await _pane(registry, tmp_path)
+
+ first = feed.changes(registry)
+ assert [(row["session_id"], row["key"], row["name"]) for row in first] == [
+ (session.id, term.key, "Alex")
+ ]
+ assert feed.changes(registry) == [], "nothing changed, nothing to say"
+
+ # The sweep stamps a new word (on the wall clock: `reading()` trusts a
+ # stamp only while it is fresh against the real time).
+ now = time.time()
+ activity_mod.stamp(term, "working", now=now)
+ term.last_submit_at = now
+ term.submit_generation = term.process_generation
+ rows = feed.changes(registry)
+ assert [(row["activity"], row["activity_since"], row["worked"]) for row in rows] == [
+ ("working", now, True)
+ ]
+ assert feed.changes(registry) == []
+
+ # A pane that is gone is forgotten, not carried as a ghost.
+ await registry.close_terminal(term.name)
+ assert feed.changes(registry) == []
+ assert feed._last == {} # noqa: SLF001 - the leak this guards against is invisible otherwise
+
+
+async def test_changes_go_to_the_bus_as_pane_activity_events(
+ registry: Registry, tmp_path: Path
+) -> None:
+ """What a client receives: the activity half of a `/panes` row, verbatim,
+ under the workspace id and the pane's stable key — enough to patch the
+ row in place without a second request."""
+ from jarvis.core.events import AgenticIdePaneActivity
+
+ published: list[Any] = []
+
+ async def publish(event: Any) -> None:
+ published.append(event)
+
+ notifications.set_publisher(publish)
+ session, term = await _pane(registry, tmp_path)
+
+ await notifications._publish_changes(registry) # noqa: SLF001 - the sweep's own step
+ await notifications._publish_changes(registry) # noqa: SLF001
+
+ assert len(published) == 1
+ event = published[0]
+ assert isinstance(event, AgenticIdePaneActivity)
+ assert (event.session_id, event.key, event.name) == (session.id, term.key, "Alex")
+ assert event.status == "live"
+ assert event.activity == term.reading().activity
+ assert event.worked is False
+ assert event.source_layer == "agentic_ide.notifications"
+
+
+async def test_a_deaf_bus_does_not_end_the_sweep(registry: Registry, tmp_path: Path) -> None:
+ async def publish(_event: Any) -> None:
+ raise RuntimeError("bus closed")
+
+ notifications.set_publisher(publish)
+ await _pane(registry, tmp_path)
+
+ await notifications._publish_changes(registry) # noqa: SLF001 - must not raise
+
+
async def test_a_question_is_reported_even_though_it_never_worked(
registry: Registry, tmp_path: Path
) -> None: