Skip to content

feat: server-side studio filtering via channelPoll (by Wren)#266

Merged
conoremclaughlin merged 2 commits intomainfrom
wren/feat/channel-poll-studio-filter
Mar 26, 2026
Merged

feat: server-side studio filtering via channelPoll (by Wren)#266
conoremclaughlin merged 2 commits intomainfrom
wren/feat/channel-poll-studio-filter

Conversation

@conoremclaughlin
Copy link
Owner

Summary

  • Move thread studio filtering from channel plugin (client-side) to get_inbox handler (server-side)
  • Add channelPoll: true parameter — opt-in studio filtering using studioId from request context headers
  • Server checks metadata.pcp.sender.studioId on agent's thread messages to determine ownership
  • Threads with no agent messages (new/broadcast) pass through to all studios
  • Channel plugin simplified: drops isThreadOwnedByThisStudio, reverts to markRead: true, passes channelPoll: true
  • Single routing implementation — fix routing on the server, all channel plugins pick it up on next poll without redeployment

Test plan

  • 11 channel plugin unit tests pass
  • 18 inbox handler unit tests pass
  • Live test: verify studio filtering works via channel events
  • Verify non-channelPoll get_inbox calls still return all threads

🤖 Generated with Claude Code

conoremclaughlin and others added 2 commits March 25, 2026 18:18
Move thread studio filtering from the channel plugin (client-side) to
the get_inbox handler (server-side). When channelPoll=true, the server
filters threadsWithUnread by checking thread message metadata for studio
ownership — same logic the trigger system uses.

- Add channelPoll boolean to getInboxSchema
- Server checks metadata.pcp.sender.studioId on the agent's messages
- Threads with no agent messages (new/broadcast) pass through to all
- Channel plugin passes channelPoll=true, drops isThreadOwnedByThisStudio
- Channel plugin reverts to markRead=true (safe now that server filters)
- Removes peek-then-mark-read dance (no longer needed)

Single routing implementation, testable server-side, no worktree deploys.

Co-Authored-By: Wren <noreply@anthropic.com>
- Extract isThreadOwnedByStudio as exported pure function for testing
- Add 7 tests covering ownership check (accept/reject/broadcast/null cases)
- Channel plugin now sends x-pcp-studio-id and x-pcp-session-id headers
  on callPcp() requests so the server can resolve callerStudioId for
  channelPoll filtering (Lumen's review catch)

Co-Authored-By: Wren <noreply@anthropic.com>
@conoremclaughlin conoremclaughlin merged commit 11b5437 into main Mar 26, 2026
3 of 4 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.

1 participant