Reframe agent connect notice; gate it off web UI sessions#29
Merged
andrew-jon-p7a merged 1 commit intomainfrom May 1, 2026
Merged
Reframe agent connect notice; gate it off web UI sessions#29andrew-jon-p7a merged 1 commit intomainfrom
andrew-jon-p7a merged 1 commit intomainfrom
Conversation
The broker pushed a welcome message to every WebSocket subscriber the
moment its `/subscribe` upgrade landed. Two problems:
1. It went to web UI sessions too. A human signing in saw an `ac7`-
from message in their chat — noise, since the dashboard already
tells them they're connected.
2. The message was titled "comms check" and worded
"<name> online. N active objective(s) on your plate." Agents read
that as a probe and started DMing teammates to "test" the comms
surface, instead of just absorbing the context.
The intent of the notice is to give the agent's first turn enough
state to decide whether to resume work, action a new objective, or
stand by. Reframed it accordingly.
═══ Changes ═══
apps/server/src/app.ts:
- Subscribe handler now gates the push on `c.var.tokenId !== null`.
That's the auth-middleware signal for opaque-bearer auth (the
runner's auth path). Cookie-auth and JWT-auth subscribers no
longer receive it.
- Extracted `composeSessionOnlineMessage(memberName, activeCount)
→ { title, body }` and exported it for unit tests. Pure; no
broker / objectives store dependencies.
- New wording:
title: 'ac7 session online' (was 'comms check')
body: 'Connected to ac7 as <name>. <plate>. This is a system
notice marking the start of a runtime session — no
acknowledgement is required. Resume any in-progress
work, address open objectives, or stand by for new
direction as appropriate.'
`<plate>` renders as either "You have N active objective(s) on
your plate — call `objectives_list` to see them." or "No active
objectives are assigned to you right now."
═══ Tests — apps/server/test/session-online.test.ts (new, 6 tests) ═══
- 4 unit tests on the composer: empty / populated plate output,
regression assertions that "comms check" never appears, and
that no reply-inviting phrasing slips back in.
- 1 end-to-end via runServer + a real `ws` client: bearer-auth
subscriber receives the new notice with the new title/from/to.
- 1 end-to-end via createApp + injectWebSocket against a raw
node:http server, with a session minted directly through
SessionStore.create (skips TOTP enrollment ceremony). Confirms
a cookie-auth subscriber receives nothing from `ac7` within
1.5s. Verified by temporarily reverting the gate — this test
catches it with the exact "expected null, got 'ac7 session
online'" the bug produced.
Signed-off-by: Andrew Jon Przybilla <andrew@przy.email>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
The broker pushed a welcome message to every WebSocket subscriber the
moment its
/subscribeupgrade landed. Two problems:It went to web UI sessions too. A human signing in saw an
ac7- from message in their chat — noise, since the dashboard already tells them they're connected.The message was titled "comms check" and worded " online. N active objective(s) on your plate." Agents read that as a probe and started DMing teammates to "test" the comms surface, instead of just absorbing the context.
The intent of the notice is to give the agent's first turn enough
state to decide whether to resume work, action a new objective, or
stand by. Reframed it accordingly.
═══ Changes ═══
apps/server/src/app.ts:
═══ Tests — apps/server/test/session-online.test.ts (new, 6 tests) ═══
Summary
What changed
Test plan
Related
Checklist
git commit -s) — the DCO bot will confirmpnpm lintis cleanpnpm typecheckis cleanpnpm testpasses