fix: push agent state to all WS connections and sync sidebar in backg…#1636
Open
vanja-emichi wants to merge 1 commit into
Open
fix: push agent state to all WS connections and sync sidebar in backg…#1636vanja-emichi wants to merge 1 commit into
vanja-emichi wants to merge 1 commit into
Conversation
…round tabs - agent.py: add finally block to _process_chain that calls mark_dirty_all() so non-active tabs see running:false without manual refresh - message-queue-store.js: deduplicate allItems by id to prevent Alpine 'Duplicate key' errors during server-poll vs pending-item race - chats-list.html: add data-chat-id attribute for DOM-based targeting - index.js: move chatsStore/tasksStore updates before context-equality check so background state changes always reach the sidebar
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.
Description:
Problem
Background tabs don't update — When an agent finishes running, non-active browser tabs don't see running: false until the user clicks on them
Alpine "Duplicate key" console errors — The allItems getter can return duplicate items during the race between server poll updates and pending item cleanup
Sidebar stale in background tabs — chatsStore.applyContexts() runs after the context-equality check, so background chat state changes never reach the sidebar
Changes
agent.py — Added a finally block to _process_chain() that calls mark_dirty_all(). When any agent chain completes, the updated running state is pushed to all WebSocket connections.
message-queue-store.js — Deduplicate allItems by id using a Set to prevent Alpine "Duplicate key" errors during server-poll vs pending-item race.
chats-list.html — Added :data-chat-id="context.id" to the
index.js — Moved chatsStore.applyContexts() and tasksStore.applyTasks() before the context-equality early-return in applySnapshot(). Background state changes now always reach the sidebar.