feat(coding-agent): event-driven supervisor agent roster serving list from one ledger - #1897
Merged
Conversation
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.
Part 2 of 3 for ENG-5794 (https://linear.app/primeintellect/issue/ENG-5794). Stacked on #1895; base is
feat/agent-roster-classifier, so this diff is PR2-only. Part 3 (subscription push + TUI consumption) follows.Summary
roster_delta/roster_heartbeatprivate worker frames): send-only-if-changed deltas from every session/child lifecycle point, queued RLM children included before any session exists, plus a complete replacing snapshot on every (re)auth that carries pending removals — deletions survive supervisor disconnectsAgentRosterLedger: status classified once at write via the shared classifier (feat(coding-agent): shared agent-status classifier, honest worker visibility, subagents bar rename #1895), seeded at startup from the catalog and the RLM spawn ledger (artifact-dir subagents included, tombstones excluded), then kept current purely by eventslistis served synchronously from the ledger with zero worker round-trips; the per-worker fan-out with its 5s timeout, the silent stale-summaries path, andmergeSessionListsare deleted; the public list population is byte-compatible with pre-PR2 behavior (pinned by the restored process test)recoveringnatively via socket close; recovery exhaustion marksfailed; one 15s unref'd watchdog stampslastHeardFromAtafter 45s of silence (honest staleness instead of silently stale data)worker.summariesremains only for adoption/recovery/eviction; wake fallback, create readiness, and reuse lookups read the ledger;sessionDirfiltering matches artifact-dir subagents by owning-root topology (no sibling-dir cross-contamination)Validation
npm run checkgreenNote
High Risk
Core daemon supervision and session listing now depend on a new worker–supervisor roster protocol and ledger consistency; legacy workers are rejected until restarted, and delete/list/ownership paths were rewired around tombstones and roster state.
Overview
Moves daemon
listoff per-worker pulls onto a supervisor-ownedAgentRosterledger: workers advertiseagent_rosteron auth and pushroster_delta(diff or full snapshot on reconnect) plusroster_heartbeatover private worker frames; the supervisor applies frames with epoch/chaining, seeds offline rows from the session catalog and RLM spawn ledger, and serveslistsynchronously from that store.Workers compose and flush roster rows from session lifecycle (including queued subagents before a session exists, passivated/evicted rows, and explicit removals on archive/delete/swap). Worker disconnect marks rows recovering; prolonged silence sets
lastHeardFromAtvia a watchdog. Client-owned workers drop roster rows when unregistered; sharedtombstoneSavedSessionDeleteruns before saved-session deletes.pendingRlmSpawnAppendskeys are scoped byparentActiveSessionId#childId. Legacy workers without the capability are rejected (PreRosterWorkerError) and non–client-owned ones may be restarted on adoption.Reviewed by Cursor Bugbot for commit 385f566. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add event-driven
AgentRosterto daemon supervisor and worker protocolAgentRosterin agent-roster.ts as the single source of truth for session listing, root selection, and ownership checks in the supervisor, replacing direct reads ofworker.summariesroster_delta(snapshot or diff) androster_heartbeatframes to authenticated supervisors; the protocol is extended in daemon-worker-protocol.ts withDAEMON_WORKER_ROSTER_CAPABILITYandDaemonWorkerRosterOutboundagent_rostercapability, and throwsPreRosterWorkerErrorfor legacy workers; non-client-owned legacy workers are auto-restarted during recoverytombstoneSavedSessionDeletebefore file removal; roster entries for deleted/closed sessions are removed in the next deltaready, displaying the worker state as the status labelagent_rostercapability will be rejected and restarted;pendingRlmSpawnAppendskeys change fromchildIdto${parentActiveSessionId}#${childId}in daemon-mode.ts — any out-of-tree consumers of that map will breakChanges since #1897 opened
DaemonSupervisorroster reseed logic to filter spawn-ledger edges by session family root [385f566]RlmSpawnLedger.familyUnlockedmethod to emit orphaned children as root rows and modified delete-session tombstoning to cover all duplicate edges [385f566]Macroscope summarized 1639737.