fix: guard finalizeThinkingCard with session ID check#1366
Conversation
Without this check, switching browser tabs while a stream is running causes finalizeThinkingCard() to operate on the wrong session's thinking card DOM — the card belongs to the stream that started it, not the session currently displayed in the tab. The guard ensures finalize only runs when the live assistant turn's session matches the current session.
|
Shipped in v0.50.250 via batch release PR #1368 (merge Live at https://github.com/nesquena/hermes-webui/releases/tag/v0.50.250. What landedYour guard at
Known limitations (tracked as follow-ups)Opus flagged that the guard catches the stale-A-turn-in-DOM case (your scenario) but does NOT fully prevent A's late callback from finalizing B's thinking card when both A and B have live streams concurrently. A complete fix would have Lessons captured in |
Without this check, switching browser tabs while a stream is running causes finalizeThinkingCard() to operate on the wrong session's thinking card DOM — the card belongs to the stream that started it, not the session currently displayed in the tab. The guard ensures finalize only runs when the live assistant turn's session matches the current session. Co-authored-by: Josh <josh@fyul.link>
Bundles 2 PRs: - nesquena#1366 fix: guard finalizeThinkingCard with session ID check (with pre-release fix) - nesquena#1367 fix(clarify-sse): stale-detector health timer (Opus SHOULD-FIX from v0.50.249) Pre-release fix on nesquena#1366: the contributor's guard depends on liveAssistantTurn.dataset.sessionId, but no code in the repo sets that attribute. Without the fix, the guard would always early-return (undefined !== sid is always true), breaking the streaming UI completely — every assistant turn's thinking card would stay open forever. Added per-site stamps at all 3 places that create liveAssistantTurn in static/ui.js, plus a regression test that fails any future creation site that forgets the stamp.
Without this check, switching browser tabs while a stream is running causes finalizeThinkingCard() to operate on the wrong session's thinking card DOM — the card belongs to the stream that started it, not the session currently displayed in the tab. The guard ensures finalize only runs when the live assistant turn's session matches the current session. Co-authored-by: Josh <josh@fyul.link>
Bundles 2 PRs: - nesquena#1366 fix: guard finalizeThinkingCard with session ID check (with pre-release fix) - nesquena#1367 fix(clarify-sse): stale-detector health timer (Opus SHOULD-FIX from v0.50.249) Pre-release fix on nesquena#1366: the contributor's guard depends on liveAssistantTurn.dataset.sessionId, but no code in the repo sets that attribute. Without the fix, the guard would always early-return (undefined !== sid is always true), breaking the streaming UI completely — every assistant turn's thinking card would stay open forever. Added per-site stamps at all 3 places that create liveAssistantTurn in static/ui.js, plus a regression test that fails any future creation site that forgets the stamp.
Resolve conflicts: - api/models.py: keep all imports (read_session_lineage_metadata, normalize_agent_session_source, wal); keep all METADATA_FIELDS (compression_anchor + parent_session_id lineage); normalize_agent_session_source() spreads correctly - static/ui.js: keep WAL recoveredBadge + all buttons (edit/tts/fork/copy/retry); keep session-guard in finalizeThinkingCard; keep S.session guard for turn.dataset.sessionId (nesquena#1366)
Without this check, switching browser tabs while a stream is running causes finalizeThinkingCard() to operate on the wrong session's thinking card DOM, the card belongs to the stream that started it, not the session currently displayed in the tab. The guard ensures finalize only runs when the live assistant turn's session matches the current session.