Skip to content

fix: keep active sidebar session messages cached#764

Merged
SamSaffron merged 1 commit into
SamSaffron:mainfrom
sam-saffron-jarvis:feat/sidebar-session-blank
Jun 3, 2026
Merged

fix: keep active sidebar session messages cached#764
SamSaffron merged 1 commit into
SamSaffron:mainfrom
sam-saffron-jarvis:feat/sidebar-session-blank

Conversation

@sam-saffron-jarvis

Copy link
Copy Markdown
Contributor

What

Fix the web sidebar message-cache eviction so the active session is never evicted when the UI caps cached message histories at 10 sessions.

Also prefer lastMessageAt over creation time when choosing which non-active sessions stay cached.

Why

Repro from Sam: click sidebar sessions 1, 2, 3, ... 10, then click session 11. If session 11 sits below the first 10 entries, it opens blank.

The lazy-load path hydrated session 11, then saveSessions() immediately evicted its messages because eviction kept the 10 newest-created sessions, not the active session. The render after hydration then had an active _serverOnly stub with no messages. Tiny little footgun; very committed to being exactly off-by-one adjacent.

Tests

  • mise exec node@24.15.0 -- node internal/serveui/static/app_core_test.js
  • all internal/serveui/static/*_test.js via mise exec node@24.15.0 -- node
  • go build ./...
  • go test ./internal/tools passes
  • go test ./... mostly passed, with one transient failure in internal/tools (TestRunAgentScriptTool_TimeoutKillsGrandchildren) that passed on direct rerun

@SamSaffron SamSaffron merged commit 86fb19f into SamSaffron:main Jun 3, 2026
1 check passed
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.

2 participants