Skip to content

[argus patch #103] Open tabs stream runs they did not start - #85

Open
Nichol4s wants to merge 1 commit into
argusfrom
argus-live-thread-activity
Open

Nichol4s wants to merge 1 commit into
argusfrom
argus-live-thread-activity

Conversation

@Nichol4s

@Nichol4s Nichol4s commented Oct 5, 2026

Copy link
Copy Markdown

Problem

A tab streams only the runs it starts, or one it finds active when it loads. A run started anywhere else (a build wake-up from the Argus host, a Telegram message, a scheduled playbook) never reached a tab that already had the thread open: the reply appeared only after a reload. The sidebar missed new threads and titles the same way.

Change (patch bytedance#103)

  • Backend. RunManager publishes {thread_id, run_id, status, user_id, updated_at} on admission (create_or_reject) and every status change (set_status) to an in-process hub (runtime/runs/activity.py). One gateway worker per stack sees every run. Publishing never blocks or raises; a subscriber 256 events behind gets one resync.
  • GET /api/threads/activity (routers/thread_activity.py, registered before the /{thread_id} routes): SSE, filtered to runs stamped with the viewer's id or on threads they own, heartbeat every 25 s (under nginx's 600 s timeout), no content, no replay.
  • Frontend. ThreadActivityBridge in the workspace: a run event invalidates ["thread", id] (the runs list, so the existing activeRunId rejoin joins and streams the reply), a terminal one the thread's history too, plus a debounced sidebar refresh. Hidden tabs close their stream and resync when shown; errors back off 2 s to 5 min.

Load

One idle SSE connection per visible workspace tab; per run, ~3 tiny events and a few small refetches for the tabs of that user. No polling.

Tests

backend/tests/test_thread_activity.py (6), frontend/tests/unit/core/threads/activity.dom.test.tsx (4). Existing run manager / runs API / features (147) and frontend threads+app (33 files) suites green; tsc, eslint, prettier, ruff clean.

Rollout

Canary on atlas-nicholas only, with its own image tags (not the shared :latest), before any pin bump.

🤖 Generated with Claude Code

A tab streamed only runs it started or found active on load, so a build
wake-up, a Telegram message or a schedule run never reached a tab that already
had the thread open; the reply showed only after a reload.

The run manager publishes {thread, run, status} on admission and every status
change to an in-process hub; GET /api/threads/activity streams those (SSE,
viewer's own runs and threads only, heartbeat, no content, no replay). The
workspace mounts one subscriber per visible tab that invalidates the thread's
runs list (so the existing rejoin streams the reply), its history when the run
ends, and the sidebar. Hidden tabs close their stream and resync when shown;
errors back off to 5 min.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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