Skip to content

Give the Runner its own community connections - #1755

Closed
loganj wants to merge 2 commits into
agents-runner-ownerfrom
agents-runner-connections
Closed

loganj wants to merge 2 commits into
agents-runner-ownerfrom
agents-runner-connections

Conversation

@loganj

@loganj loganj commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

🤖 This is step 5 of the Manager/Runner split for agents. It is an inert refactor.

What changes

Agents hear their community's events through that community's live session. Until now the Runner borrowed the Manager's sessions, which the Manager also uses for agent listings and cleanup.

This PR gives the Runner its own connections (connections.ts):

  • Runner: keeps a live session for each community where the viewer has an agent. It also owns the listener that delivers events, catch-up epochs, held-roster release and the core memory refresh on reconnect. That code moved out of AgentsService.
  • Manager: keeps its own sessions for listings and cleanup. It still syncs listings again when a connection recovers, now with its own small subscription.

RunnerManager no longer gives the Runner live sessions. It gives only the community relay to open and the list of running agents.

Ordering

Each watcher subscribes to the same community relay. Whenever the Runner's session starts, is replaced or ends, it asks the Manager to show and reconcile what runs again. So the reconcile sees the Runner's new session whichever subscription fires first. (An independent review found the case where the Manager's subscription is older: a community selected before its first agent. The second commit fixes it.) Core memory is refreshed once per new session, as before.

Presence still uses the Manager's connections in this PR, so offline notices for removed agents keep their current timing. Presence moves with the hidden page.

Why

In a hidden agents page, the Runner must open its own connections. This is the last live object that RunnerManager passed. What remains can cross the agents link (#1748) as data.

Tests

  • connections.test.ts: the Runner's connection hears a live session, and reports each start and end.
  • The agents suite passes (716 tests). The full vitest run fails only the emoji-picker tests that always fail in this local worktree. The browser journeys in CI cover connect, reconnect and catch-up end to end.

🤖 Generated with Claude Code

loganj and others added 2 commits October 27, 2026 15:27
The Runner now keeps its own live session of each community it runs
agents in, and its own listener that delivers those events to the
agents. The Manager keeps its connections for listings and cleanup, and
syncs again on reconnect itself. RunnerManager no longer hands the
Runner live sessions: it gives only the community relay to open and the
running agents.

The Runner binds first on every change, so the Manager's update sees
its new session, as before. No behavior changes.

Co-authored-by: Larry <627498bd4bd1f281a16431e3c6cce3b5c25b6692798c78672298aefbf2f8f8b5@buzz.block.builderlab.xyz>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Logan Johnson <loganj@squareup.com>
The Manager's relay subscription can be older than the Runner's: a
community selected before its first agent, or one whose agents were
all deleted for a time. Its update then ran before the Runner's session
changed, and nothing reconciled after it. Queued work waited for the
next tick. The Runner now asks for an update each time its session
starts, is replaced or ends, and no longer refreshes core memory a
second time.

Co-authored-by: Larry <627498bd4bd1f281a16431e3c6cce3b5c25b6692798c78672298aefbf2f8f8b5@buzz.block.builderlab.xyz>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Logan Johnson <loganj@squareup.com>
@loganj

loganj commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Closing: this change is now part of #1748, which collects one column of the Manager/Runner split in one PR.

@loganj loganj closed this Oct 29, 2026
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