Skip to content

Web UI: reconcile session list so external renames show up (#272)#287

Merged
edwin-zvs merged 1 commit into
mainfrom
webui-272-session-resync
May 31, 2026
Merged

Web UI: reconcile session list so external renames show up (#272)#287
edwin-zvs merged 1 commit into
mainfrom
webui-272-session-resync

Conversation

@edwin-zvs

Copy link
Copy Markdown
Contributor

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/state handler, set_title broadcast, and forward_broadcast are all correct, so steady-state delivery works — but a broadcast can be missed two ways, and nothing re-syncs:

  1. Connect race: connect() ran refreshSessions() before subscribe.events, so a session/state landing in the snapshot↔subscribe gap was lost.
  2. Lagged drop: when a subscriber lags (busy fleet / slow tunnel), the daemon's forward loop drops the missed broadcasts (server.rs RecvError::Lagged just 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)

  • Subscribe before fetching the list in connect() — closes the connect race.
  • Reconcile on return + safety interval: re-fetch the session list on visibilitychange/focus and 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

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>
@edwin-zvs
edwin-zvs merged commit e53b4fb into main May 31, 2026
1 check passed
@edwin-zvs
edwin-zvs deleted the webui-272-session-resync branch May 31, 2026 00:12
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.

Web UI doesn't live-update a session's title after rename

1 participant