Skip to content

web (W11): sessions dashboard — runtime + spend, richer viewer, submission-health panel - #498

Closed
ZIJ wants to merge 1 commit into
mainfrom
feat/w11-sessions-viewer
Closed

web (W11): sessions dashboard — runtime + spend, richer viewer, submission-health panel#498
ZIJ wants to merge 1 commit into
mainfrom
feat/w11-sessions-viewer

Conversation

@ZIJ

@ZIJ ZIJ commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

W11 — Dashboard + Tier-2. Extends the existing Sessions UI (web/) rather than building greenfield. Runtime-agnostic: renders flue and brain-box (claude/codex/pi) sessions alike.

What's new

  1. Sessions listRuntime badge (flue accented + Cloud icon, brain-box neutral) and a Spend column. Adds agent_snapshot to the web SessionSchema and a display-only flue label to lib/runtimes — deliberately kept OUT of the create picker (RUNTIMES), since flue's behavior ships in a deployed artifact (no model/key to pick).
  2. Conversation viewer — distinct rendering for agent.thinking, tool results (exec.completed from brain-box AND flue's tool.result — so both render identically), turn.failed, and a body-spill affordance (content_ref/body_truncated/body_bytes → "output too large, stored in blob" instead of an empty bubble). Keeps the existing Conversation/All level filter and the live SSE tail untouched.
  3. Submission health — new turns panel (GET /v3/sessions/:id/turns): per-turn state, yield_reason, timing (active_seconds), usage, and error (opaque object → one-line message). Recovery stays the existing cancel + steer and webhook redeliver — no fake "retry turn" button.
  4. Per-session spend — Spend / Tokens / Events metric cards on the detail page, derived defensively from the opaque usage object.

Honest scope reconciliation (spec vs. /v3 reality)

  • "Tier-2 streaming parts/deltas" does not exist in /v3. The runtime emits whole events; tiering is the level field (internal|progress|user). There's no token-delta stream to render — so "Tier-2 fidelity" = a faithful full internal-level trace, which this delivers. No view=/parts=/tier= params exist.
  • No public turn re-drive/retry endpoint. Recovery is cancel + steer + webhook redeliver; the panel labels this honestly.
  • No dedicated spend endpoint. Spend is derived from session.usage / turn.usage. flue meters at the gateway and reports {} here → spend renders (correct, not a bug).

Live SSE tail

Left the working inline EventSource client as-is (resume via Last-Event-ID/?after=<seq>, seq cursor, 5s poll fallback). Did not extract a useSSE hook — extraction risked regressing the working live tail for no functional gain (per the task's guardrail).

Verification

  • npm run typecheck ✅ · npm run build ✅ · preview dev server boots clean.
  • npm run lint: the only 2 errors are pre-existing on main (SessionDetail.tsx synchronous setState-in-effect — the SSE reset I didn't touch; Browsers.tsx media-caption — not in this diff). Zero new lint errors.
  • Preview mocks (api/mock.ts) extended (a flue session + brain-box sessions with usage, agent.thinking/exec.completed events, a turns fixture) so VITE_PREVIEW=1 npm run dev renders every new surface with no backend.
  • Live prod verification is the reviewer's (localhost is wired to prod) — see run steps below.

Run against prod locally

  • Fast path: OC_V3_KEY=osb_… npm run dev from web/ (Vite injects x-api-key server-side to prod /v3, per vite.config.ts), then open /sessions.
  • Cookie path: plain npm run dev if your edge/session is already wired.
  • Open /sessions (runtime + spend columns), a session detail (/sessions/:id — spend cards, submission-health panel, richer trace), and a running session to watch the live tail.

Base branch

Based on main — W11 is runtime-agnostic dashboard breadth that ships independently of the flue-native evergreen. If the coordinator wants it inside the flue-native unit, it's a cheap rebase (web-only, separate surface).

🤖 Generated with Claude Code

… turns health panel

Extends the existing Sessions UI (runtime-agnostic; renders flue and brain-box
sessions alike):
- Sessions list: Runtime badge (flue accented) + Spend column, from the session's
  agent_snapshot.runtime + usage. Adds agent_snapshot to the web SessionSchema and
  a display-only flue label to lib/runtimes (kept OUT of the create picker).
- Conversation viewer: distinct rendering for agent.thinking, tool results
  (exec.completed AND flue's tool.result), turn.failed, and a body-spill affordance
  (content_ref/body_truncated). Keeps the Conversation/All level filter + live SSE tail.
- Submission health: new turns panel (GET /v3/sessions/:id/turns) — per-turn state,
  yield_reason, timing, usage, error. Recovery stays cancel + steer + webhook redeliver
  (no fake retry — v3 has no turn re-drive endpoint).
- Per-session spend: Spend/Tokens/Events metric cards on detail, derived defensively
  from the opaque usage object (flue meters at the gateway → renders '—').
- Data layer: getSessionTurns/getSessionResult wrappers + schemas; lib/usage helpers;
  preview mocks extended so the new surfaces render with no backend.

Tier-2 note: /v3 has no streaming-parts/delta mode — tiering is the level field
(internal/progress/user); 'Tier-2 fidelity' = faithful internal-level trace.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ZIJ

ZIJ commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

Folded into the flue-native evergreen (#489) — 1 repo = 1 flue PR. The W11 dashboard commit is now in flue-native (rides the flue PR, not a standalone main PR).

@ZIJ ZIJ closed this Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant