Repository navigation
feat(mcp): room tools for shared multi-agent sessions (ent#169) - #1740
Merged
Merged
Conversation
Five tools — create_room, list_rooms, read_room, post_to_room, close_room — proxying the enterprise rooms API (Invariant #13: tool code ships in the public server even when the feature is gated). Thin by design: all authorization is server-side. Membership is the grant, the acting identity comes from the API key (so an agent-scoped key always posts as its own agent and cannot post as another participant), and a non-member gets a uniform 404. Nothing here decides access. On an OSS build the routes are absent, so the tools return a structured "shared_sessions_not_enabled" result rather than throwing a transport error at the agent — verified live against a backend with the module unregistered. Known gap: TrinityClient.request() takes no headers argument, so post_to_room cannot send an Idempotency-Key. The endpoint accepts one (Invariant #18 is satisfied at the boundary); wiring it through the MCP client needs a client signature change and is left as a follow-up. Related to Abilityai/trinity-enterprise#169 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
_VALID_TRIGGERS is a filter allow-list, and an unrecognised value degrades to
None — i.e. NO filter — so an unlisted trigger silently returns EVERY execution
instead of that trigger's. Observed live before the fix:
triggered_by=room -> 14 rows, kinds=['agent','public','room']
triggered_by=bogus-trigger -> 14 rows, kinds=['agent','public','room']
Identical to a garbage value: the filter lied rather than erroring or returning
nothing. ent#169 posts executions with triggered_by="room", so without listing
it the Sessions UI (ent#170) cannot filter room executions and any user
filtering for them gets silently wrong data.
Adding the string is not an enum/schema change — triggered_by is a plain TEXT
column and this set only gates the query filter.
After: triggered_by=room -> 8 rows, all kinds=['room'].
The broader wart (an INVALID value silently returning everything rather than
422) is pre-existing and left alone.
Related to Abilityai/trinity-enterprise#169
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Resolve by running |
vybe
approved these changes
Jul 23, 2026
vybe
left a comment
Contributor
There was a problem hiding this comment.
Validated: thin server-authorized proxy tools with structured not-enabled fallback + a real allow-list filter fix with named test. Enterprise rooms backend (ent#210) merged with the enumeration-oracle fix.
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.
OSS half of Abilityai/trinity-enterprise#169 (enterprise module: Abilityai/trinity-enterprise#210).
Five MCP tools —
create_room,list_rooms,read_room,post_to_room,close_room— proxying the enterprise rooms API. Tool code ships in the public server even though the feature is gated (Invariant #13).Thin by design
All authorization is server-side and nothing here decides access:
senderparameter to spoof.Graceful fallback, verified
On an OSS build (or unentitled instance) the routes are absent, so the tools return:
{ "error": "shared_sessions_not_enabled", "message": "Shared sessions are not enabled on this Trinity instance." }Verified live in both directions: with the module unregistered → the fallback above; with it registered → real data.
Live verification
Real MCP JSON-RPC with an agent's own
TRINITY_MCP_API_KEY(tool count 100 → 105):list_rooms→ the agent's rooms with status,stop_reason, message and participant countsread_roomwithsince→ transcript tail + participantspost_to_room→ landed as#15 agent/portal-demo, i.e. recorded as the agent, resolved from auth contextKnown gap
TrinityClient.request()takes no headers argument, sopost_to_roomcannot send anIdempotency-Key. The endpoint accepts one — Invariant #18 is satisfied at the boundary — but wiring it through the MCP client needs a client-signature change I didn't want to make unasked. Left as a follow-up.Note for reviewers: the MCP server is a baked image, so
docker compose build mcp-serveris needed to pick these up;npm run buildon the host is not enough.🤖 Generated with Claude Code