Skip to content

chore: prime to always supervise subagents - #179

Merged
maxy-shpfy merged 1 commit into
mainfrom
maxy/chore--prime-to-always-supervise-subagents
Nov 18, 2026
Merged

maxy-shpfy merged 1 commit into
mainfrom
maxy/chore--prime-to-always-supervise-subagents

Conversation

@maxy-shpfy

@maxy-shpfy maxy-shpfy commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Prime now supervises every sub-agent it spawns. On spawn, a supervise reactor is installed on the sub-agent's Conversation so the orchestrator is woken on any termination cause surfaced there — budget exhausted, a failed Run, a dropped connection — which otherwise lands as a system notice no membership reaction fires on. On kill, the reactor is removed so a dead worker's thread stops showing in the workflow view.

  • installSupervisor / removeSupervisor in internalAgents.ts, wired into /spawn and /kill. Both best-effort: a failure is logged, never surfaced as a failed spawn/kill. Install is idempotent (the store keys a reactor by its scope).
  • subagentRecord helper extracted for the persisted roster row.
  • ReactorRegistry threaded into createInternalAgentsRouter.
  • New internalAgents.test.ts covering install on spawn, firing on a cause, and removal on kill.

Screenshots

N/A — backend only.

How to test

  1. Spawn a sub-agent via /internal/agents/spawn; confirm a supervise reactor is installed for the orchestrator, scoped to the sub-agent's Conversation.
  2. Surface a termination cause in that Conversation; confirm the orchestrator's reactor fires.
  3. Kill the sub-agent; confirm the reactor is removed.
  4. pnpm --filter @tangent/server exec tsx --test src/routes/internalAgents.test.ts.

@maxy-shpfy
maxy-shpfy added this pull request to stack #180 November 12, 2026 03:38
@maxy-shpfy
maxy-shpfy removed this pull request from stack #180 November 12, 2026 05:50
@maxy-shpfy
maxy-shpfy force-pushed the maxy/chore--prime-to-always-supervise-subagents branch from c2752ab to 24e28b9 Compare November 12, 2026 05:55
@maxy-shpfy
maxy-shpfy changed the base branch from maxy/feat--capture-agents-cost to main November 12, 2026 05:55
@maxy-shpfy
maxy-shpfy marked this pull request as ready for review November 12, 2026 18:38
@maxy-shpfy
maxy-shpfy requested a review from Mbeaulne November 12, 2026 19:38
Co-authored-by: Cursor <cursoragent@cursor.com>
@maxy-shpfy
maxy-shpfy force-pushed the maxy/chore--prime-to-always-supervise-subagents branch from 24e28b9 to bf4bb4c Compare November 18, 2026 20:54
@maxy-shpfy
maxy-shpfy requested a review from a team as a code owner November 18, 2026 20:54
@maxy-shpfy
maxy-shpfy merged commit 3338450 into main Nov 18, 2026
10 checks passed
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