diff --git a/web/src/features/chat/session-state.ts b/web/src/features/chat/session-state.ts index 9cd14ee..2b6c52e 100644 --- a/web/src/features/chat/session-state.ts +++ b/web/src/features/chat/session-state.ts @@ -541,13 +541,15 @@ function withCurrent(view: DotView, state: SessionState, viewed: boolean): DotVi * attention amber (`sessionStatusKey` still labels it "interrupted"). */ function parentDot(state: SessionState): DotView { - if (state.status === "exited") return { status: "dead" }; + // `interrupted` sits with `exited`: both mean the process is gone, and in the + // plugin every "not running" row is `exited` (sessions.lua:75-78), which is + // why a dead row outranks its own unread error/attention/done flags. + if (state.status === "exited" || state.status === "interrupted") return { status: "dead" }; if (state.flags.error) return { status: "err" }; if (attentionPending(state)) return { status: "attention" }; if (state.flags.done) return { status: "ok" }; if (state.status === "busy") return { status: "busy" }; if (state.status === "compacting") return { status: "compacting" }; - if (state.status === "interrupted") return { status: "dead" }; return { status: "idle" }; } diff --git a/web/src/features/chat/subagent-view.tsx b/web/src/features/chat/subagent-view.tsx index 8faeeb6..97a4158 100644 --- a/web/src/features/chat/subagent-view.tsx +++ b/web/src/features/chat/subagent-view.tsx @@ -4,7 +4,7 @@ import { useTranslation } from "react-i18next"; import { Icon } from "@/components/icons"; import { Empty } from "@/components/ui/empty"; -import { StatusDot, type DotStatus } from "@/components/ui/status-dot"; +import { StatusDot } from "@/components/ui/status-dot"; import { toast } from "@/components/ui/toast"; import { cn } from "@/lib/utils"; @@ -12,6 +12,7 @@ import { EntryBlock } from "./blocks"; import { Composer } from "./composer"; import type { ModelGroup } from "./data"; import { HeadChips } from "./head-chips"; +import { subagentDot } from "./session-state"; import { subagentTitle } from "./session-title"; import type { TrayTab } from "./store"; @@ -19,14 +20,6 @@ import "@/styles/pages/chat-telemetry.css"; type ToolBlock = Extract; -const SUB_DOT: Record = { - active: "busy", - completed: "ok", - failed: "err", - interrupted: "attention", - dormant: "exited", -}; - function str(value: unknown): string | undefined { return typeof value === "string" && value.trim() ? value.trim() : undefined; } @@ -250,6 +243,10 @@ export function SubagentView({ .catch(() => undefined); } + // The child view is the session you are looking at, so its unread markers are + // already consumed (`viewed: true`) — a failed child is steady red here. + const dot = subagentDot(subagent, { viewed: true }); + return (
{t("chat.subview.back")}
- +

{name}

diff --git a/web/src/features/chat/telemetry.tsx b/web/src/features/chat/telemetry.tsx index 6ecf87b..dbdec93 100644 --- a/web/src/features/chat/telemetry.tsx +++ b/web/src/features/chat/telemetry.tsx @@ -2,10 +2,12 @@ import type { ContextUsage, Entry, SessionState, Subagent, UsageTotals } from "@ import { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; +import { StatusDot } from "@/components/ui/status-dot"; import { plural } from "@/lib/i18n"; import { cn } from "@/lib/utils"; import { formatDuration } from "./format"; +import { subagentDot } from "./session-state"; import { synthesizeSubagentTimeline } from "./subagent-view"; import "@/styles/pages/chat-telemetry.css"; @@ -24,14 +26,6 @@ const SUB_TONE: Record = { dormant: "is-idle", }; -const SUB_DOT: Record = { - active: "dot--busy", - completed: "dot--ok", - failed: "dot--err", - interrupted: "dot--attention", - dormant: "dot--exited", -}; - export interface TelemetryCounts { /** `role === "user"` entries in the view's timeline. */ turns: number; @@ -175,6 +169,9 @@ export function Telemetry({ session, subagent, entries, className }: TelemetryPr if (subagent) { const timeline = synthesizeSubagentTimeline(subagent, entries); + // The subagent view is the session you have open: its unread markers are + // already consumed, so a failed child is steady red here. + const dot = subagentDot(subagent, { viewed: true }); const { turns, tools } = countTelemetry(timeline); const created = subagent.createdAt; const end = ticking ? now : (subagent.lastActiveAt ?? created); @@ -191,7 +188,7 @@ export function Telemetry({ session, subagent, entries, className }: TelemetryPr data-testid="telemetry" > - {elapsed ? ( diff --git a/web/tests/session-dot.test.ts b/web/tests/session-dot.test.ts index b8d28c9..3c8bbf6 100644 --- a/web/tests/session-dot.test.ts +++ b/web/tests/session-dot.test.ts @@ -122,6 +122,16 @@ describe("sessionDot (parent rows)", () => { expect(sessionDot(state)).toEqual({ status: "dead" }); }); + it("interrupted is a dead process too (outranks error, attention and done)", () => { + // The plugin has no `interrupted`: any "not running" row is `exited` + // (sessions.lua:75-78), and `exited` sits at the top of dot_hl. + expect(sessionDot(makeSession({ status: "interrupted", flags: { error: true } })).status).toBe("dead"); + expect(sessionDot(makeSession({ status: "interrupted", flags: { attention: true } })).status).toBe("dead"); + expect(sessionDot(makeSession({ status: "interrupted", flags: { done: true } })).status).toBe("dead"); + // …and it never wears the blue current marker either. + expect(sessionDot(makeSession({ status: "interrupted" }), { viewed: true })).toEqual({ status: "dead" }); + }); + it("attention beats done (flags.attention outranks flags.done)", () => { const state = makeSession({ flags: { attention: true, done: true },