Web UI: reconcile session list so external renames show up (#272)#287
Merged
Conversation
A session/state broadcast (e.g. a rename from the TUI) could fail to reach the web UI and leave a stale title until a manual refresh, two ways: - on (re)connect, subscribe.events ran AFTER session.list, so an event in the snapshot↔subscribe gap was lost; - in steady state the daemon drops broadcasts to a lagging subscriber (busy fleet / slow tunnel) with no resync, so the client never learns. Fix client-side: - subscribe before fetching the list (closes the connect race); - reconcile the list on visibilitychange/focus and on a 30s safety interval while visible, so a missed broadcast self-heals. The in-place reconcile (#281) makes this cheap and flicker-free. Real-time broadcasts still handle the instant common case; this is the resilience net. A daemon-side resync-on-lag is a possible follow-up for the continuously-visible-during-lag edge. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #272 — a session title renamed elsewhere (e.g. the TUI) didn't update the web UI until a manual refresh.
Root cause
The
session/statehandler,set_titlebroadcast, andforward_broadcastare all correct, so steady-state delivery works — but a broadcast can be missed two ways, and nothing re-syncs:connect()ranrefreshSessions()beforesubscribe.events, so asession/statelanding in the snapshot↔subscribe gap was lost.server.rsRecvError::Laggedjust logs) with no resync, so the client never learns of them.Either way the rename stays invisible until the next full list fetch (only on reconnect/initial load).
Fix (client-side)
connect()— closes the connect race.visibilitychange/focusand on a 30s interval while visible, so any missed broadcast self-heals. The in-place reconcile (Web UI: reconcile session list in place (Phase 2) #281) makes this cheap and flicker-free, and it never changes selection or disturbs the current view.Real-time broadcasts still handle the instant common case; this is the resilience net.
Scope
Client-only (hot-reloadable). A daemon-side resync-on-lag signal would also cover the continuously-visible-during-lag edge instantly rather than within 30s — noted as a possible follow-up (needs a daemon rebuild).
🤖 Generated with Claude Code