Skip to content

feat(communities): follow the communities from a page that shows nothing - #1743

Closed
loganj wants to merge 1 commit into
agent-host-local-portfrom
agent-host-page-communities
Closed

loganj wants to merge 1 commit into
agent-host-local-portfrom
agent-host-page-communities

Conversation

@loganj

@loganj loganj commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

🤖 Stacked on #1742. Part of the work to run agents in a hidden page, so that a frozen or hidden main window cannot stall them.

What this does

The hidden agents page needs its own relay sessions for the communities its agents are in. It must not become a second owner of what the device saves. This PR adds the piece that gives it those sessions:

  • provideRelay(..., { ephemeral: true }): a session for a page that shows nothing.
    • Its sends are kept in memory, not in the shared outbox journal. If they used the journal, a reload of the main window would restore pending agent sends there as "unknown".
    • It keeps no on-disk channel cache and restores nothing.
    • A denial or a cache clear in it does not touch what the main page saved.
  • pageCommunities: follows the viewer, memberships and selection that the main page sends.
    • It opens a session only for a joined community, and only once a viewer is known.
    • It lets go of a session when its community is left, or of every session when the viewer changes.
    • The agents page never boots its own identity or reads the device's community record.
  • AgentCommunities now needs only the viewer and the selection from the snapshot. pageCommunities satisfies it.

Presence is not published from these sessions, because no presence activity is passed. Read state stays on the shared multi-tab store. That store already lets two pages share one journal: one lock owner publishes for both.

Nothing calls pageCommunities yet. The agents page entry, in the next PR, is its first caller. So this PR does not change behavior.

Evidence

  • src/features/communities/page.test.ts covers opening, normalization, leave, viewer change, selection outside memberships, and the ephemeral provideRelay arguments.
  • src/features/relay/startup-service.test.ts covers an ephemeral session: it creates no head persistence and no outbox journal, even with a saved resume and a cache clear. A kept session, with the same inputs, creates both.
  • Mutation checks: each guard in page.ts and the ephemeral branches in provideRelay make the tests fail when removed.
  • tsc --noEmit and Biome are clean. The full vitest run passes except four emoji and avatar-picker tests. Those fail only in this worktree, where Vite denies the symlinked node_modules.

🤖 Generated with Claude Code

The hidden agents page needs relay sessions for the communities its agents
are in, without becoming a second owner of what the device saves. Its
sessions are ephemeral: sends and history stay in memory, nothing is
restored, and no presence is published. If they shared the outbox journal,
a reload of the main window would show pending agent sends as unknown.

pageCommunities follows the viewer, memberships and selection that the main
page sends, opens a session only for a joined community, and lets go of a
session when its community is left or the viewer changes. AgentsService now
needs only the viewer and selection from the communities snapshot.

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 added a commit that referenced this pull request Oct 29, 2026
The Runner becomes its own service, apart from the Manager, and on macOS
it runs in a hidden "agents" webview that the system never throttles,
with its storage and the plugins' agent entries. The screens' page keeps
the Manager. Only JSON crosses, over the native agents port, on two
lanes: "agents" for the Manager and Runner link, and "page" for where
agent storage is, the followed communities, and local activity.

- The Runner owns presence, keep-awake, agent hooks and the reconnect
  of its own connections.
  A failed relay is retried at most every 30 s, whichever owner asks.
- The Manager waits at most 10 s for the Runner's first decision.
- The agents page starts the Runner once the screens' page says where
  agent storage is; the screens' page still loads and moves it first.
- Other platforms keep the Runner in the screens' page.

Includes #1735 (page-owned native work), #1743 and #1744's native page.
Squashes #1892 and #1893.

Signed-off-by: Logan Johnson <loganj@squareup.com>
Co-authored-by: Larry <627498bd4bd1f281a16431e3c6cce3b5c25b6692798c78672298aefbf2f8f8b5@buzz.block.builderlab.xyz>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
loganj added a commit that referenced this pull request Oct 29, 2026
The Runner becomes its own service, apart from the Manager, and on macOS
it runs in a hidden "agents" webview that the system never throttles,
with its storage and the plugins' agent entries. The screens' page keeps
the Manager. Only JSON crosses, over the native agents port, on two
lanes: "agents" for the Manager and Runner link, and "page" for where
agent storage is, the followed communities, and local activity.

- The Runner owns presence, keep-awake, agent hooks and the reconnect
  of its own connections.
  A failed relay is retried at most every 30 s, whichever owner asks.
- The Manager waits at most 10 s for the Runner's first decision.
- The agents page starts the Runner once the screens' page says where
  agent storage is; the screens' page still loads and moves it first.
- Other platforms keep the Runner in the screens' page.

Includes #1735 (page-owned native work), #1743 and #1744's native page.
Squashes #1892 and #1893.

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

loganj commented Oct 29, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Closing this PR because #1893 (#1893) contains its work. communities/page.ts and its tests are in that stack.

@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