Skip to content

refactor(ui): unify Per Session and Live Sessions tables into shared renderer#336

Merged
BYK merged 2 commits into
mainfrom
ui/unify-live-sessions-table
May 15, 2026
Merged

refactor(ui): unify Per Session and Live Sessions tables into shared renderer#336
BYK merged 2 commits into
mainfrom
ui/unify-live-sessions-table

Conversation

@BYK
Copy link
Copy Markdown
Owner

@BYK BYK commented May 15, 2026

Summary

  • Replaces the separate "Per Session" table (Cost Intelligence page) and "Live Sessions" table (Cache Warming page) with a single shared renderLiveSessionsTable() renderer
  • Both pages now render the identical unified 9-column table with text filter, project links, session links, and sortable columns
  • Column layout: Project | Session | Turns | Total $ | Savings $ | Cache Hit % | P(returns) | Status | Hits/Warmups

What each page gains

  • Cost Intelligence: warming status badge with idle time, P(returns) probability, warmup hits/count, cache hit ratio, text filter
  • Cache Warming: project column with links, session links, cost totals + savings, cache hit ratio

Review fixes (2nd commit)

  • Replaced ensureProject() (DB write) with read-only projectId() in the render path
  • Parameterized buildLiveSessionRows() to accept pre-fetched data — eliminates double calls to getAllSessionCosts/getActiveSessions/computeWarmingSnapshot
  • Derived warming page summary stats from the same rows as the table (fixes potential count divergence)
  • Reduced from 14 to 9 columns: merged Conversation+Worker into Total, dropped S(t) and TTL, merged Idle into Status badge, merged Warmups+Hits into single "Hits/Warmups" column
  • Added Cache Hit % column (cacheReadTokens / total input tokens)
  • Shows - instead of $0.00/0 when cost or warming data is absent
  • Fixed TTL fallback: shows 5m when snapshot exists but TTL is undefined (was showing -)
  • Restored informative empty-state message on warming page
  • Added data-sort to Session column

Single file change: packages/gateway/src/ui.ts

BYK added 2 commits May 15, 2026 12:06
…renderer

Both the Cost Intelligence and Cache Warming pages now render the same
unified live-sessions table via buildLiveSessionRows() + renderLiveSessionsTable().

The unified table merges all columns from both: identity (Project, Session),
activity (Turns, Idle), cost (Conversation, Worker, Total, Savings), and
warming (TTL, S(t), P(returns), Status, Warmups, Hits).

Both pages gain features they were missing: Costs page gets warming columns
and text filter; Warming page gets project/session links and cost columns.
- Replace ensureProject() (write) with projectId() (read-only) in render path
- Parameterize buildLiveSessionRows() to accept pre-fetched data, eliminating
  double calls to getAllSessionCosts/getActiveSessions/computeWarmingSnapshot
- Derive warming page summary stats from same rows as table (fixes count divergence)
- Reduce from 14 to 9 columns: merge Conversation+Worker into Total, drop S(t)
  and TTL, merge Idle into Status badge, merge Warmups+Hits into single column
- Add Cache Hit % column (cacheReadTokens / total input tokens)
- Show '-' instead of '$0.00' for cost columns when no cost data exists
- Show '-' instead of '0' for warming columns when no warming snapshot exists
- Fix TTL fallback: show '5m' when snap exists but ttl is undefined (was '-')
- Restore informative empty-state message on warming page
- Add data-sort to Session column
@BYK BYK merged commit 92a952b into main May 15, 2026
7 checks passed
@BYK BYK deleted the ui/unify-live-sessions-table branch May 15, 2026 12:23
This was referenced May 15, 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