Skip to content

feat(coding-agent): roster subscription push consumed by the agents view and subagents bar - #1900

Merged
xeophon merged 98 commits into
mainfrom
feat/agent-roster-push
Sep 1, 2026
Merged

feat(coding-agent): roster subscription push consumed by the agents view and subagents bar#1900
xeophon merged 98 commits into
mainfrom
feat/agent-roster-push

Conversation

@snimu

@snimu snimu commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Part 3 of 3 for ENG-5794 (https://linear.app/primeintellect/issue/ENG-5794). Stacked on #1897; base is feat/agent-roster-ledger, so this diff is PR3-only.

Summary

  • add roster_subscribe/roster_unsubscribe commands and coalesced roster_update pushes (schema 24), gated on a new agent_roster capability advertised only by the supervisor hello — a TUI can never subscribe against a daemon that cannot serve it
  • every ledger mutation funnels into one setImmediate-coalesced push per macrotask; backpressured subscribers are skipped and receive one full resync on drain (refused resync writes re-arm the retry); client-owned visibility transitions push removals/writes
  • the agents view holds a persistent RosterStore across scope transitions: subscribe once, re-attach is a no-op, rows render ledger truth (classify-once statuses, queued/recovering/failed labels, last heard Xs ago staleness); queued subagents appear under their parent before any session exists, and row identity is stable across queued -> bound -> passivated (parent-qualified agent alias)
  • on roster-capable daemons the 1s poll never starts, navigation and refreshes issue zero daemon requests, and the saved catalog loads at most once per view instance, only when the user types a search query — the per-transition reconcile storm (previously up to ~GB-scale transient allocations with 200 saved sessions) is gone from the nav path
  • the 1s poll path is deleted outright, not kept as a fallback: the agents view requires the agent_roster capability and fails fast against a daemon that lacks it (unreachable in practice — the wired entry paths enforce an exact schema match and replace stale daemons); the chat subagents bar degrades to snapshot-driven counts, so interactive startup never depends on the capability
  • the subagents bar drops terminal runs that never bound (matching the roster's removal rule) via a sticky everBound marker immune to evidence laundering across repeated terminal projections; bar and view counts come from one shared population and formula
  • SessionSummary gains additive rosterStatus/statusLabel/lastHeardFromAt so list consumers read the same classify-once verdicts

Validation

  • three adversarial review rounds to APPROVE; production-fed lifecycle matrix (unbound-error, queued, bound, heartbeat-only, passivated, recovering) drives the real handler; header==bar equality pinned from production data paths
  • mutants killed by named tests: staleness-stamp push drop, drain-resync deletion, re-attach re-subscribe, capability-gate strip, per-write flush (real-socket coalescing), terminal-rule removal, incoming-only evidence (laundering), plus the PR2 suite intact
  • sandbox: 28-suite battery 892+ passed; full coding-agent suite zero regressions vs base; root npm run check green; schema digest test green

Note

Medium Risk
Touches daemon protocol revision, supervisor push/backpressure, and agents-view live data path; session attach is isolated from roster failures but agents view now hard-requires the new capability.

Overview
Replaces the agents view’s 1s live-session polling with a daemon push subscription (roster_subscribe / roster_update, schema 24, agent_roster capability). The supervisor coalesces ledger mutations into subscriber updates (full resync on socket drain when backpressured); clients hold an AgentsViewRosterStore that survives scope transitions and drives row labels from ledger fields (queued / recovering / failed, last heard staleness). Views without the capability fail fast; the chat subagents bar optionally uses the same stream and falls back to snapshot counts.

Saved-session catalog loads only when search needs deep text, once per view instance—not on every navigation. DaemonAgentConnection exposes optional subscribeAgentRoster (roster attach failures do not break session recovery). AgentSession hides terminal RLM child runs that never bound a session and emits cancelled as the removal signal for pre-bind failures.

Reviewed by Cursor Bugbot for commit 90e87f2. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Add push-based agent roster subscription for agents view and subagents bar

  • Introduces a new daemon protocol (schema rev 24) with roster_subscribe/roster_unsubscribe commands and roster_update push frames, gated behind an agent_roster server capability.
  • The supervisor in daemon-supervisor.ts maintains a live AgentRoster seeded from disk and the spawn ledger, pushes incremental deltas to subscribed clients, and requires workers to advertise roster capability; legacy pre-roster workers are restarted from the current binary or marked failed.
  • The agents view (agents-view-mode.ts) and interactive mode subagent bar (interactive-mode.ts) replace 1s polling with push-driven roster updates; saved sessions are fetched lazily.
  • Fixes: getRlmChildSnapshots no longer includes terminal unbound child runs; orphaned spawn-ledger children degrade to root rows; delete_saved_session now rejects symlinked paths resolving to the active session.
  • Behavioral Change: DaemonClient.request adds a recoverable option (default true); non-recoverable requests are rejected immediately on socket close instead of being parked across reconnects. refreshSessions no longer returns a boolean and is called without options at updated call sites. Workers without agent_roster capability are not adopted and will be replaced.

Changes since #1900 opened

  • Modified roster seeding logic in DaemonSupervisor.seedRosterLedger and family-root roster seeding to read persisted session info and populate summary.cwd from info.cwd when available, falling back to setting seededCwd: true only when session info cannot be read [1f315f3]
  • Extended SupervisorLedgerInternals interface with seedRosterLedger method, tightened handleCommand return type, and added test validating cwd hydration for ledger-seeded roster entries [1f315f3]
  • Added staleness checks in daemon.DaemonSupervisor.applyWorkerRosterSnapshot to abort roster snapshot application [9ae9e67]
  • Modified agents-view.AgentsViewMode.reconnectClient to read roster summaries after heartbeat refresh [9ae9e67]
  • Added test coverage for roster snapshot timing and staleness behavior [9ae9e67]
  • Modified DaemonSupervisor.applyWorkerRosterSnapshot to track removed agent IDs, skip absentee sweep when spawn ledger edges are unreadable, precompute and cache session info reads for children requiring reseeding with currency checks via isWorkerRosterApplyCurrent, preserve surviving roster entries by matching ID or session file path and restoring from unclaimed entries, hydrate cwd for ledger-seeded children before publishing, and respect explicitly removed agent IDs during snapshot application [086ceb6]
  • Added status label rendering in AgentsViewMode.renderRow that displays roster recovery and stale-worker status ahead of model label and summary in row title suffixes when the row is not in pending delete or kill state [086ceb6]
  • Added test coverage for roster status label rendering in AgentsViewMode and expanded supervisor ledger tests to verify cwd hydration for ledger-seeded children, roster preservation during mid-hydration worker disconnection, and handling of removed rows versus assigned rows during snapshot application with delayed session info reads [086ceb6]
  • Changed AgentsViewMode constructor initialization logic for savedCatalogReady property [90e87f2]
  • Added test coverage for AgentsViewMode persistent catalog state initialization [90e87f2]

Macroscope summarized 8394b67.

Comment thread packages/coding-agent/src/modes/agents-view/roster-store.ts
Comment thread packages/coding-agent/src/modes/agents-view/agents-view-mode.ts Outdated
Comment thread packages/coding-agent/src/modes/agents-view/agents-view-mode.ts Outdated
Comment thread packages/coding-agent/src/modes/agents-view/agents-view-mode.ts
Comment thread packages/coding-agent/src/modes/agents-view/agents-view-mode.ts Outdated
Comment thread packages/coding-agent/src/modes/daemon/daemon-protocol.ts
Comment thread packages/coding-agent/src/modes/agents-view/roster-store.ts
Comment thread packages/coding-agent/src/modes/agents-view/agents-view-mode.ts Outdated
Comment thread packages/coding-agent/src/modes/interactive/interactive-mode.ts
Comment thread packages/coding-agent/src/modes/agents-view/agents-view-mode.ts Outdated
Comment thread packages/coding-agent/src/modes/agents-view/roster-store.ts Outdated
Comment thread packages/coding-agent/src/modes/agents-view/roster-store.ts
Comment thread packages/coding-agent/src/modes/agents-view/agents-view-mode.ts
Comment thread packages/coding-agent/scripts/roster-soak.ts Outdated
Comment thread packages/coding-agent/src/modes/agents-view/agents-view-mode.ts
Comment thread packages/coding-agent/src/modes/agents-view/agents-view-mode.ts Outdated
Comment thread packages/coding-agent/src/modes/agents-view/roster-store.ts
Comment thread packages/coding-agent/src/modes/agent-connection/daemon-agent-connection.ts Outdated
Comment thread packages/coding-agent/src/modes/agents-view/agents-view-mode.ts
Comment thread packages/coding-agent/src/modes/agents-view/agents-view-mode.ts
Comment thread packages/coding-agent/src/modes/daemon/daemon-supervisor.ts
Comment thread packages/coding-agent/src/modes/interactive/interactive-mode.ts
Comment thread packages/coding-agent/src/modes/agents-view/agents-view-mode.ts
@snimu
snimu force-pushed the feat/agent-roster-push branch 2 times, most recently from db18389 to 32f3abc Compare August 31, 2026 16:08
Comment thread packages/coding-agent/src/modes/interactive/interactive-mode.ts Outdated
Comment thread packages/coding-agent/src/modes/agents-view/agents-view-mode.ts
Comment thread packages/coding-agent/src/modes/agents-view/roster-store.ts
Comment thread packages/coding-agent/src/modes/daemon/agent-roster.ts
@snimu
snimu force-pushed the feat/agent-roster-ledger branch from c58eb05 to c86f81a Compare August 31, 2026 16:53
@snimu
snimu force-pushed the feat/agent-roster-push branch from 32f3abc to 4a961d6 Compare August 31, 2026 16:53
Comment thread packages/coding-agent/src/modes/agents-view/agents-view-state.ts
Comment thread packages/coding-agent/src/modes/interactive/components/subagent-summary-line.ts Outdated
@snimu
snimu force-pushed the feat/agent-roster-push branch from 4a961d6 to a2744ff Compare August 31, 2026 17:34
Comment thread packages/coding-agent/src/modes/interactive/interactive-mode.ts
@snimu
snimu force-pushed the feat/agent-roster-ledger branch from e59b37a to f5e960d Compare August 31, 2026 18:22
@snimu
snimu force-pushed the feat/agent-roster-push branch from a2744ff to 7f1eccd Compare August 31, 2026 18:22
Comment thread packages/coding-agent/src/modes/daemon/daemon-supervisor.ts Outdated
@snimu
snimu force-pushed the feat/agent-roster-push branch from 7f1eccd to d607820 Compare August 31, 2026 18:51
xeophon
xeophon previously approved these changes Sep 1, 2026
Comment thread packages/coding-agent/src/modes/daemon/daemon-supervisor.ts Outdated
xeophon
xeophon previously approved these changes Sep 1, 2026
Comment thread packages/coding-agent/src/modes/agents-view/agents-view-mode.ts

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 9ae9e67. Configure here.

Comment thread packages/coding-agent/src/modes/daemon/daemon-supervisor.ts Outdated
xeophon
xeophon previously approved these changes Sep 1, 2026
xeophon
xeophon previously approved these changes Sep 1, 2026
Comment thread packages/coding-agent/src/modes/agents-view/agents-view-mode.ts Outdated
@xeophon
xeophon merged commit 1d2e91d into main Sep 1, 2026
23 checks passed
@xeophon
xeophon deleted the feat/agent-roster-push branch September 1, 2026 09:51
xeophon added a commit that referenced this pull request Sep 1, 2026
# Conflicts:
#	packages/coding-agent/src/modes/agents-view/agents-view-mode.ts
#	packages/coding-agent/src/modes/daemon/daemon-client.ts
#	packages/coding-agent/src/modes/daemon/daemon-supervisor.ts
#	packages/coding-agent/test/agents-view-mode.test.ts
olety added a commit to oneiron-dev/prime-agent that referenced this pull request Sep 1, 2026
Takes upstream's event-driven supervisor roster ledger + push (PrimeIntellect-ai#1897, PrimeIntellect-ai#1900),
direct TUI<->worker transport (ENG-5817), daemon startup/recovery hardening
(PrimeIntellect-ai#1929, PrimeIntellect-ai#1909), single-dump kernel snapshots (PrimeIntellect-ai#1945), empty-draft eviction
(PrimeIntellect-ai#1946), rlm_child_update suppression (PrimeIntellect-ai#1944), bash-skill preview (PrimeIntellect-ai#1911).

Fork laws re-expressed on the roster architecture:
- stable-target follow-up honesty kept (capability proof via worker hello,
  target_unavailable never not_found when ownership unproven)
- schema revision 26 (union of fork rev-24 stable-target + upstream
  rev-24/25 roster+transport); digest minted by the repo's own algorithm
- summary freshness reuse + single-flight + staleness + root-omission
  rejection restored on upstream's refresh pull
- adoption/recovery never fails a live worker on a slow or root-omitting
  catalog: get_state root seed + stale mark + bounded background rehydration
- repl.py keeps fork prune-on-aggregate-overflow
- delete handlers keep fork persistence reporting; eviction fence test keeps
  the stronger two-worker contention variant

Known test debt (deferred to post-Wave cleanup per owner): roster-era fixture
migrations in daemon-supervisor-monitor (2), plus un-triaged failures in
package-command-paths, agent-session-recursion, daemon-runtime-stress,
4600-supervisor-singleton, 4603-worker-recovery, 4606-update-restart-
coordinator, agents-view-roster. Production laws preserved; failures are
fixture-era artifacts or mechanism assertions to rewrite.
sethkarten pushed a commit that referenced this pull request Sep 1, 2026
…1960)

* fix(coding-agent): load the saved catalog when the agents view opens

v0.9.0 regression: the Inactive section was empty on a fresh agents
view until a search query was typed. The saved catalog was loaded
only for search (a #1900 optimization premised on the roster boot
seed carrying the saved corpus as inactive rows); #1951 scoped that
seed to live families, so the view must load what it displays.
The load stays progressive and once-per-view.

* docs: tighten the catalog-load comment
ketema added a commit to ketema/prime-agent that referenced this pull request Sep 1, 2026
- Direct session transport between TUI and worker (ENG-5817, PrimeIntellect-ai#1926)
- Event-driven supervisor agent roster with push subscriptions (PrimeIntellect-ai#1897, PrimeIntellect-ai#1900, PrimeIntellect-ai#1895)
- Hardened daemon startup, recovery ownership, and worker launch diagnostics (PrimeIntellect-ai#1929, PrimeIntellect-ai#1918)
- Python REPL runtime single-dump snapshots and bash preview tool (PrimeIntellect-ai#1945, PrimeIntellect-ai#1911)
- Non-blocking RLM subagent deletion and snapshot update suppression (PrimeIntellect-ai#1954, PrimeIntellect-ai#1944)
- Saved catalog loading on Agents View open (PrimeIntellect-ai#1960)
- Advanced Anthropic prompt caching marker across tool results (PrimeIntellect-ai#1927)
- TUI process replacement on update and empty draft eviction (PrimeIntellect-ai#1631, PrimeIntellect-ai#1946, PrimeIntellect-ai#1920)
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.

2 participants