Skip to content

fix: push agent state to all WS connections and sync sidebar in backg…#1636

Open
vanja-emichi wants to merge 1 commit into
agent0ai:readyfrom
vanja-emichi:fix/background-state-sync
Open

fix: push agent state to all WS connections and sync sidebar in backg…#1636
vanja-emichi wants to merge 1 commit into
agent0ai:readyfrom
vanja-emichi:fix/background-state-sync

Conversation

@vanja-emichi
Copy link
Copy Markdown
Contributor

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

  • element for DOM-based targeting by extensions.

    index.js — Moved chatsStore.applyContexts() and tasksStore.applyTasks() before the context-equality early-return in applySnapshot(). Background state changes now always reach the sidebar.

  • …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
    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