Skip to content

Polish web UI for demo-readiness - #18

Merged
anilmurty merged 12 commits into
mainfrom
polish-web-ui
Apr 8, 2026
Merged

anilmurty merged 12 commits into
mainfrom
polish-web-ui

Conversation

@anilmurty

Copy link
Copy Markdown
Contributor

Summary

  • Sidebar: Brand renders Open(white)Claw(blue)Watch(white) matching opencla.watch. Footer links restyled as full-width nav items with icons + version number.
  • Traces list: Agent first column, Trace ID removed (tooltip on hover), → chevron, friendlySpanName() for readable type labels (LLM Call, Tool Call, Agent Run, etc.)
  • Waterfall: Hover glow on bars, selected span accent border, 3% min bar width for fast tools, "Click a span for details" hint, friendly labels
  • Span detail: Friendly name heading with raw name below, formatted <pre> attributes
  • Status: Clickable agent cards linking to traces, "Last seen" time
  • Cost: Redundant columns hidden based on group-by (e.g. Agent column hidden when grouping by agent)
  • Alerts: Friendly type names, ▸/▾ expand toggle icon
  • Drift: Pass badges green (was blue), threshold shown in header
  • General: Duration formatting (340ms / 1.1s / 2m 15s), actionable empty states

Test plan

  • All 243 tests pass
  • ruff check clean
  • Visual: sidebar brand shows colored text, footer links match nav style
  • Visual: traces table has no Trace ID column, friendly names, chevron
  • Visual: waterfall bars glow on hover, fast tools visible, hint text appears
  • Visual: drift pass badges are green, alerts have toggle icons

🤖 Generated with Claude Code

anilmurty and others added 12 commits April 8, 2026 11:31
Global:
- Sidebar brand: Open(white)Claw(blue)Watch(white) matching opencla.watch
- Footer links styled as full nav items with icons + version number

Traces:
- Agent first column, Trace ID removed (tooltip on hover), arrow chevron
- friendlySpanName() maps raw names to readable labels

Waterfall:
- Hover glow on bars, selected span accent border
- 3% minimum bar width so fast tool calls are always visible
- "Click a span for details" hint, friendly labels

Span detail: friendly heading, raw name below, formatted attributes

Status: clickable agent cards linking to traces, "last seen" time

Cost: hide redundant columns based on group-by selection

Alerts: friendly type names, expand/collapse toggle icon

Drift: pass badges green (not blue), threshold shown in header

General: better duration formatting, actionable empty states

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
- Title: "Trace details for <agent>" instead of truncated trace ID
- Move "Click a span for details" hint under heading
- Bar labels: show model/tool name + duration (no redundant type name)
- Remove parentheses from model names
- Reduce label column width to close whitespace gap

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
The flex gap was applying between each text node. Wrapping
Open/Claw/Watch in one <span> makes them a single flex item
so gap only applies between the SVG icon and the text.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
- Add left arrow to "Back to traces" button
- Reduce label column from 140px to 100px
- Waterfall row hover: text brightens to --text (matches sidebar nav)
- Selected row: text turns --accent blue

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Shows duration, provider, model, input/output tokens, and cost
in a multi-line native tooltip on hover.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
- Custom CSS tooltip appears immediately on hover (no browser delay)
- Positioned above the bar, styled to match the UI
- Shows: type, duration, provider, model, tokens, cost
- Added trace ID and conversation ID to click detail panel

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
- Agent spans show: "duration — cost"
- Sub-spans show: "model — duration — cost"
- Cost only shown when > $0 (avoids clutter on zero-cost spans)
- fmtCost shows $0.0000 instead of - for null/zero costs in tables

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
- Add tests/manual-pre-release-testing.md
- Rename .claude/specs/07-cli to 07-cli.md
- UI: all accumulated polish changes (tooltips, cost in bars, etc.)

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@anilmurty
anilmurty merged commit 7f9e05e into main Apr 8, 2026
4 checks passed
@anilmurty
anilmurty deleted the polish-web-ui branch April 8, 2026 20:57
anshss added a commit to anshss/tokenjam that referenced this pull request Jul 1, 2026
A terminal that opened and did nothing (0 tokens, 0 tool calls, 0 cost)
carries no method or cost worth reviewing and only clutters the archive.
Drop these post-rollup (so a fan-out session's trace-keyed spend still
counts as signal even when its stored aggregate reads 0 — Metabuilder-Labs#18), scanning
a wider candidate window so up to ARCHIVE_LIMIT real sessions still
surface. Existing routing/namespace tests that used incidental 0/0/0
sessions get a minimal tool_call_count=1 to clear the filter.

Co-Authored-By: Claude <[email protected]>
anilmurty pushed a commit that referenced this pull request Jul 2, 2026
The Status archived-sessions list and the /api/v1/sessions/{id} detail view
read tokens/cost straight off the denormalized `sessions` aggregate columns.
Those columns are accumulated per span keyed by `span.session_id` in
`IngestPipeline._build_or_update_session`. That is correct when telemetry
stamps the session id on its cost spans (the /v1/logs Claude Code/Codex path
and the on-disk backfill both do). But a fan-out harness posting raw OTLP to
/api/v1/spans emits the zero-cost `invoke_agent` marker span WITH `session.id`
while its cost-bearing `gen_ai.llm.call` spans carry only `agent_id` + a shared
`traceId` (otlp_parsing reads the optional `attrs.get("session.id")`). Those
cost spans arrive with session_id=None, so `_resolve_session` mints a throwaway
UUID for each and they never accumulate onto the marker's session row. The row
stays 0 even though the spend is real and surfaces correctly on Cost / Analytics
/ Traces, which key by agent_id / trace and never by session_id.

The defensible association is the trace: the marker span (which carries the
session_id) and the cost spans share a `trace_id` — exactly the join /traces
already uses to attribute the same spans. New `session_token_cost_rollup()` in
core/db.py rolls up every span whose `session_id` matches OR whose `trace_id`
appears on a span carrying this session_id. It only follows trace linkage that
originates from a span already bearing the session_id, so it never pulls in
unrelated traces and never resorts to a lossy agent_id+time-window heuristic
that could cross-attribute concurrent sessions. When the cost spans DO carry the
session_id (the common case) the trace clause is redundant and the result equals
the plain session_id sum — a strict superset that never under- or over-counts
the already-correct paths. Each span is counted once (a disjunction over rows,
not a self-join), so no double-counting. Returns None when the session has no
spans, and both callers fall back to the stored row in that case.

Status `_build_archive` and the session-detail `session` block + framing now
report the rolled-up figures, reconciling per-session rows with /api/v1/cost.

Covered by three integration tests over a fixture that mirrors the harness shape
(session + marker carry session_id+trace; cost spans carry only trace+agent_id):
they assert the session-detail row, the Status archived row, and reconciliation
with /api/v1/cost's agent total.

Co-Authored-By: Claude <[email protected]>
(cherry picked from commit c616d1c)
anilmurty pushed a commit that referenced this pull request Jul 2, 2026
…status/detail wiring deferred to the UI PRs)
anilmurty pushed a commit that referenced this pull request Jul 2, 2026
Carve-fallout fixes discovered by the test suite after cherry-picking PR#5:
- transcript.py: port session_transcript_path/session_transcript_mtime helpers
  (runlink.py + sessions.py + status rescue depend on them; their originating
  commit is outside PR#5's range).
- models.py/db.py: add SessionRecord.cache_write_tokens as a model-level default
  (0) so the session-detail rollup totals work without PR#4's migration 12.
- status.py: wire the transcript-mtime live-status rescue (_live_status) so a
  live CC session with fresh transcript shows active, matching the ebef638 test.
- tests: drop out-of-scope #18 trace-keyed-cost rollup tests and the PR#4
  subagent-totals reconcile test (both depend on non-PR5 infrastructure); add
  missing CaptureConfig/GenAIAttributes imports + reingest mock kwarg; de-dup
  work-map/user-prompt regression tests.
anilmurty added a commit that referenced this pull request Jul 30, 2026
…ead (#654–#657) (#660)

* feat: Lens polish — Dashboard IA, 30d default, inbox clarity, drift lead

Batch of four self-contained Lens web-UI polish fixes (all in the
single-file offline SPA at tokenjam/ui/index.html), each closing an
enhancement issue. No new external HTTP/deps (Rule #18) and no
client-side re-implementation of framing/analysis — copy, markup,
default-value, and nav-grouping changes only.

#654 — Dashboard nav + default landing. The Dashboard's waste tiles +
spend pivot serve both the Improve and Observe lenses equally, so it is
now a persistent top-level sidebar entry (data-lens="all") seated ABOVE
the Improve/Observe toggle, visible in either mode. The empty-hash
default route now resolves to Dashboard in getRoute() (the single source
of the default) instead of the Review inbox — no render-time
location.hash redirect, which would race first paint (#132).

#655 — one shared 30d window default. Traces defaulted to 24h and Cost
to 7d while Optimize/Analytics already used 30d. A single DEFAULT_SINCE
constant now feeds every window-driven screen's DEFAULTS.since, resolved
in the param layer when no since is in the URL. Alerts keeps its
all-alerts empty default on purpose (it filters, not windows; a 30d
default would hide older unacknowledged alerts).

#656 — Review inbox clarity. Added an appliable-count line ("N of M can
be applied automatically — the rest are copy-and-apply") so "Open (6)"
beside a single checkbox stops reading as unselected rows, and gated the
bulk Select-all + action bar on more than one auto-appliable row. Reworded
the Approve/apply affordances to state the write is a file/config change
effective on the NEXT run — not live, in-path enforcement, and not a
guaranteed saving (honesty Rule 14).

#657 — Drift empty-state. Led the no-baselines screen with a scannable
one-line headline stating the requirement, keeping the existing grey
detail lines below.

Guarded by static-grep assertions in the new
tests/unit/test_lens_ui_regression.py (Dashboard persistence + default
route, the 30d constant, the inbox count/Apply copy, the Drift headline);
test_ui_offline.py and the node-extraction behaviour tests stay green.

Closes #654
Closes #655
Closes #656
Closes #657

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

* fix: resolve 3 Lens nav/routing P1 regressions in PR #660

The Lens polish batch (#654–#657) introduced three coupled regressions
around the new lens-neutral Dashboard and the moved 30d window default.
Greptile flagged all three as P1; all are pure routing/nav-sync logic in
the single-file offline SPA.

P1-1 — default route inconsistency. getRoute() defaults an empty hash to
Dashboard, but the URL-normalization effect still replaceState'd #/review
(the old Improve home), so the rendered page and the address bar
disagreed and a refresh or shared bare link opened Review. The
normalization now writes #/dashboard to match getRoute() — one default,
no render-time hash redirect (#132 preserved).

P1-2 — Traces drill-through dropped a non-default window. The default
moved to 30d, but tracesHrefForWindow() still omitted the window at the
retired 24h literal, so a Dashboard set to 24h drilled into Traces and
silently fell back to 30d. Both tracesHrefForWindow and optimizeFindingHref
now decide "omit since" against the shared DEFAULT_SINCE constant, so
drill-through preserves the window the tile was computed from and the
default can move again without dropping a real window.

P1-3 — Dashboard nav reset the active lens. Dashboard is data-lens="all"
(visible in both lenses) but was still mapped to 'improve' in VIEW_LENS,
so opening it from Observe flipped the sidebar to Improve and hid the
Observe nav. Dashboard is now absent from VIEW_LENS; the route-sync effect
falls back to the sidebar's current lens for an unmapped (lens-neutral)
view, so the active lens is preserved.

Extends tests/unit/test_lens_ui_regression.py with three static-grep
guards (default-route normalization agrees on dashboard;
DEFAULT_SINCE-driven drill-through omission; Dashboard lens-neutral +
lens-preserving fallback). node --check on the extracted module + lens
scripts passes; test_lens_ui_regression, test_ui_offline, and the JS
behaviour lens tests are green.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
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