Skip to content

fix: session switch and replay races in the frontend - #78

Open
tcsenpai wants to merge 1 commit into
patoles:mainfrom
tcsenpai:fix/session-switch-races
Open

tcsenpai wants to merge 1 commit into
patoles:mainfrom
tcsenpai:fix/session-switch-races

Conversation

@tcsenpai

@tcsenpai tcsenpai commented Sep 9, 2026

Copy link
Copy Markdown

Three pre-existing frontend races that show up as a tab 'replaying' history under a LIVE badge, or a canvas that stops updating until you switch tabs.

  • session-started re-sent for the already-selected session (resume after inactivity) armed sessionSwitchPendingRef with nothing to clear it, so no event reached the canvas until the user switched tabs and back. A same-id started now only updates the session list.
  • Live events arriving while part of the eventLog was still un-replayed (review playback, restored snapshot) snapped eventIndex to the end and skipped those events forever. They are applied first now.
  • restoreSnapshot forced isPlaying on a paused/scrubbed snapshot, which played the remaining log at 1x while the (component-global) LIVE badge showed. It now fast-forwards to the end of the log, and a tab switch leaves review mode.
  • Cached snapshots are dropped on a bridge reset; lastActivityTime is refreshed (throttled) from incoming events.

Typecheck clean (web/node_modules/.bin/tsc --noEmit). Found during an audit of a backfill feature (#77) but independent of it.

https://claude.ai/code/session_01AGs5TZo6yxv7NHARHawyJf

- 'session-started' re-sent for the already-selected session (resume after
  inactivity) armed sessionSwitchPendingRef with nothing to clear it, so no
  event reached the canvas until the user switched tabs. Same-id 'started'
  now only updates the session list.
- Live events arriving while part of the eventLog was still un-replayed
  (review playback, restored snapshot) snapped eventIndex to the end and
  skipped those events forever. They are applied first now.
- restoreSnapshot forced isPlaying on a paused/scrubbed snapshot, which
  played the remaining log at 1x under a LIVE badge. It now fast-forwards
  to the end of the log, and the tab switch leaves review mode.
- Cached snapshots are dropped on a bridge reset.
- lastActivityTime is refreshed (throttled) from incoming events.

Claude-Session: https://claude.ai/code/session_01AGs5TZo6yxv7NHARHawyJf
@cla-assistant

cla-assistant Bot commented Sep 9, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

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