Per-session TPS indicator in sidebar#1272
Per-session TPS indicator in sidebar#1272JKJameson wants to merge 18 commits intonesquena:masterfrom
Conversation
|
Thanks for this PR! What this does: Adds a live per-session tokens-per-second (TPS) indicator in the sidebar, replacing the old global The approach looks correct:
The diff is large (692 additions, 922 deletions) and touches
Overall the core TPS display feature looks well-designed. The large diff warrants careful review before merge. |
41f0358 to
acfac3d
Compare
|
Sorry for the mess. I want to be upfront about what happened rather than just push a clean commit and move on. The short version: this is my first real contribution to a repo that moves this fast, and I got sloppy with mixing concerns across multiple sessions without rebasing or splitting things out properly. The TPS feature itself is solid, the rest is a learning curve. What went wrong:
What I'd do differently:
On the Recommended path forward: Drop the plan file, then I can either (a) split this into focused PRs, or (b) if you're comfortable with it, merge as-is with a note that subsequent clean-up PRs will follow. The TPS feature itself ( |
|
Thanks for the honest write-up, @JKJameson — this kind of transparency about what happened is genuinely useful for reviewers. A few thoughts based on what you described: On the accidental plan file: Good that you force-pushed to remove it from history. For future reference, a quick On the diff size: The maintainer will ultimately decide whether to merge as-is or ask for a split. Given that the TPS feature commits are identifiable ( On the Suggested next step for maintainers: Review the TPS core commits ( |
Hold — skipped XSS sanitizer tests must pass before mergeThanks for the TPS-per-session feature, @JKJameson! The core metering work looks well-structured. A few things need resolution before this can merge:
Once the rebase is done and all tests pass (full |
## Release v0.50.240 Batch release of 13 PRs that passed full triage + code review + test suite (3199 tests, 0 failures). --- ### Added - **Compact tool activity mode** (`simplified_tool_calling`, default on) — groups tool calls and thinking traces into a single collapsed "Activity" disclosure card per assistant turn. Also adds a new **Calm Console** theme with earth/slate palette and serif prose. @Michaelyklam — #1282 - **PDF first-page preview** — `MEDIA:` `.pdf` files render a canvas thumbnail via PDF.js CDN (4 MB cap). **HTML sandbox iframe** — `.html`/`.htm` files render inline in a sandboxed `<iframe srcdoc>` (256 KB cap). 10 i18n keys × 7 locales. @bergeouss — #1280, closes #480 #482 - **Inline Excalidraw diagram preview** — `.excalidraw` files render as pure SVG (no external deps; rectangles, ellipses, diamonds, text, lines, arrows, freehand; 512 KB cap). @bergeouss — #1279, closes #479 - **Inline CSV table rendering** — fenced `csv` blocks and `MEDIA:` CSV files render as scrollable HTML tables with auto-separator detection. @bergeouss — #1277, closes #485 - **Inline SVG, audio, and video rendering** — SVG as `<img>`, audio as `<audio controls>`, video as `<video controls>`. @bergeouss — #1276, closes #481 - **Batch session select mode** — multi-select sessions for bulk Archive/Delete/Move. 11 i18n keys × 7 locales. @bergeouss — #1275, closes #568 - **Collapsible skill category headers** — click to collapse/expand without re-render; state persists across filter cycles. @bergeouss — #1281 - **`providers.only_configured` setting** — opt-in flag to restrict the model picker to explicitly configured providers. @KingBoyAndGirl — #1268 - **OpenCode Go model catalog** — adds Kimi K2.6, DeepSeek V4 Pro/Flash, MiMo V2.5/Pro, Qwen3.6/3.5 Plus. @nesquena-hermes — #1284, closes #1269 ### Fixed - **Profile `TERMINAL_CWD` TypeError** — `_build_agent_thread_env()` helper merges env before `_set_thread_env()` call. @hi-friday — #1266 - **Service worker subpath cache bypass** — regex now matches `/api/*` under any mount prefix. @Michaelyklam — #1278 - **SSE client disconnect leaks** — `TimeoutError`/`OSError` treated as clean disconnects; server backlog 64, threads daemonized; session list renders before saved-session restore. @KayZz69 — #1267 - **i18n locale corrections** — Korean MCP strings (23), Chinese MCP strings (23), zh-Hant missing keys (41), de missing keys (229). @bergeouss — #1274, closes #1273 --- ### Test results ``` 3199 passed, 2 skipped, 3 xpassed in 72.79s ``` ### PRs on hold (not included) #1265 (draft), #1271 (superseded by #1266), #1272 (skipped XSS tests), #1232 (partial test run), #1222 (review questions open), #1134 (live-server tests), #1132 (superseded by #1134), #1108 (negative UX review), #1084 (empty description)
acfac3d to
e91bdfe
Compare
|
XSS tests: Rebased onto origin/master high/low rolling history: Confirmed no frontend consumption. Updated the stale docstring in api/metering.py which still described the removed 60-minute rolling history. cleanup: removed filter-branch backup artifacts. |
…menu open - CSS: hide .session-state-indicator.is-streaming on hover (via :has) and when .menu-open, so the menu button is easier to click without the live indicator covering it - sessions.js: guard all four sidebar refresh paths (streaming poll, time-refresh poll, gateway fallback poll, SSE sessions_changed) with if(_sessionActionMenu) return to prevent closeSessionActionMenu() from destroying an open menu mid-interaction
…extarea draft on chat finish - index.html: add role=img aria-label=Hermes to .app-titlebar-icon (was aria-hidden=true) - style.css: add .app-titlebar-rename-input CSS class matching .session-title-input styling - messages.js: save raw textarea draft to S._drafts[sid] before clearing on send() - ui.js: in setBusy(false), restore draft for current session when no queued message fires
…witch The S._drafts path in messages.js was dead code: 1. Saved to S._drafts[sid] then immediately deleted in the same function, so nothing could ever be read from it. 2. sessions.js reads from S.composerDrafts[sid] anyway — completely disjoint keys. Draft persistence works correctly via S.composerDrafts in sessions.js: switch-away saves it, loadSession() restores it.
Bug 1 — composerDrafts key mismatch:
sessions.js writes drafts to S.composerDrafts (correct), but ui.js
setBusy(false) restore path read from S._drafts (never written).
Fix: switch ui.js to S.composerDrafts on both read and delete.
Bug 2 — stream_end missing queue drain:
The stream_end handler closed the SSE source but did not call
_queueDrainSid=activeSid;setBusy(false), so queued messages were never
drained when a stream ended without a preceding done event.
Fix: add the same drain call that done{} performs.
cancel_stream() uses Session.load() (imported as _Session locally) not get_session(), so the test patches must target api.models.Session.load. The original get_session patches were a leftover from before the WAL crash-recovery changes (852708d) switched cancel_stream to use Session.load.
e91bdfe to
e6d2a81
Compare
|
Re-reviewed after the 2026-04-30 push. The skipped XSS sanitizer tests are now rebased and passing, the stale 60-min rolling-history docstring in Adding Thanks for the persistence and the transparent write-up about the workflow earlier. |
This adds the tokens-per-second display from into the sidebar next
to each streaming session, and adds two UX improvements
for the chat menu button.
Changes
Backend
api/metering.pyandapi/streaming.pyupdated so sessions receiveper-conversation metering events, with
first_token_tsset before themetering stat is computed
Frontend
sessions.jsadds_tpsWindow, a per-session rolling 5-second bufferof raw TPS readings;
_refreshTpsLabel(sid)computes the average andupdates the DOM at most once per second
session-attention-indicatorin the sidebar now shows thelive TPS value (e.g.
42or1.2K) during streaming, replacing theold global
tpsStatchip in the headerjustify-content:centertojustify-content:space-betweento accommodate the new TPS display slotUX fixes
the chat menu is open, making the menu button easier to click
gateway fallback poll, SSE sessions_changed) skip the DOM rebuild while
a chat menu is open, preventing the menu from being accidentally closed
Tests
test_sprint9,test_sprint37,test_issue856_pinned_indicator_layout, andtest_workspace_panel_session_listto account for the new sidebarlayout, versioned file URLs, and the 28px TPS spinner size