You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Room invites should respect who can talk to an agent #805
An agent's addressing policy ("who can talk to my agent", e.g. owner only) should also control who can invite that agent into a room.
Why
Today someone the owner hasn't allowed to talk to an agent can still pull it into their room. The agent then sits there, replying only that it can't act. That's confusing, and it lets anyone see where an agent is used.
How
The policy lives on the agent (addressing_policy; see core/switch_core/addressing.py). Invites come in through several paths, and all of them need the same check:
the !invite-agent chat command and /invite-agent slash command (core/switch_core/bridges/agent/commands.py)
the invite_agent_to_room MCP tool (bridges/agent/operations/definitions.py, protocol/agent_core.py)
the agent-bridge API (bridges/agent/api/handlers.py)
room creation with agents, and the gateway's room page
Put the check in one shared place, so a future invite path can't skip it. A refused invite must say why and who can do it (the owner).
Done when
Every invite path refuses someone the agent's policy doesn't allow, with a clear message
The owner (and anyone the policy allows) can still invite it
Agents already in rooms aren't kicked out (or the PR documents and justifies a different choice)
Tests for each path, against a real Postgres for store logic
Docs updated where addressing policies are described
Out of scope
Changing the addressing policy options themselves.
Hi @petr-sandbox! I'd like to take this one for the hackathon.
In short: check the agent's addressing policy once, inside RoomService, where every invite path already ends up, so no path (current or future) can skip it. A refused invite says why and that the owner can add the agent.
What I found tracing the invite paths (in core/switch_core/):
The invite_agent_to_room MCP tool and the agent API route (operations/definitions.py, api/handlers.py) -> AgentCore.invite_agent_to_room -> add_agents_to_room. I see Remove the legacy agent moderation routes #993 removes the legacy moderation routes, so I'll build on whatever is left after it.
The gateway's room page (gateway/rooms.py, POST /{room_id}/agents) -> add_agents_to_room
Creating a room with agents (gateway, agent API, MCP create_room, rooms_yaml.py templates) -> RoomService.create_room
The policy lives in addressing.py (pure rules: rooms, groups, users, agents, owner, owner_agents). delivery/addressing.py resolves who a sender is and answers permitted(...).
So two RoomService methods cover every path.
Plan:
One check: a may_invite(inviter, agent, room) built on the same rules and sender resolution as permitted, so "who may invite" always means "who may talk to it". An open policy keeps its fast path.
Who invites becomes a required argument of add_agents_to_room and create_room (a person, an agent, or the system acting for a person). Every caller has to say who is inviting, which is what stops a future path from skipping the check.
A clear refusal, e.g. "Only @owner (or someone their policy allows) can add @agent to a room." It shows up in chat, as an MCP/API error (403) and in the gateway.
Agents already in rooms stay there. The check only runs on new invites.
Docs: update the Switch skill (switch-skill/SKILL.md), so agents know an invite can be refused and why, and the switch-buddy / switch-expert instructions where they explain addressing policies. The published pages under docs/official/ come from the docs repo, so I'll note what needs changing there in the PR.
Two questions before I start:
System joins: when someone adds the bot to a channel on the platform itself (collaboration_core.py, added_by_kind="system"), should that be judged as the person who did it where the platform reports them, and allowed otherwise?
Templates: should a template run be judged as the person running it?
Done when:
Item
How I'll show it
Every invite path refuses a disallowed person, with a clear message
A test per path: chat command, MCP tool, API, gateway, room creation
Owner and anyone the policy allows can still invite
Tests for owner, an allowed user, owner_agents and an open policy
Agents already in rooms aren't removed
Test with an agent added before its policy was tightened
Tests against real Postgres for store logic
In core/tests/switch_core/, using the existing Postgres fixtures
Docs updated
Switch skill and switch-buddy / switch-expert instructions; the docs/official/ changes listed in the PR for the docs repo
No AI model is needed to test any of this. Before opening the PR I'll run just check, just typecheck and just test.
I haven't written any code yet and will only start once this is assigned to me. I've also asked for #806; I'll work on whichever one I'm assigned first, and only start the other once that PR is up.
Hi @amaudruz and @petr-sandbox — Room invites should not bypass the same permission that controls addressing the agent. I see another contributor has expressed interest; if you are still considering candidates, I'd be happy to be considered.
Put one shared policy check in core/switch_core/room_service.py, covering both add_agents_to_room() and creation with initial agents, before membership/channel side effects. Reuse addressing.py and delivery/addressing.py semantics rather than inventing a separate invite allow-list.
Pass verified inviter identity through chat/slash commands, MCP/API, gateway and templates. Resolve owner/owner-agent and room/group rules consistently; do not treat an unresolved external sender as the platform or grant an implicit admin bypass. Confirm the policy for platform-origin joins before coding; existing members stay untouched, and refusals explain that the owner or an allowed person can invite.
Planned tests: each entry path, owner/allowed/denied/unclaimed senders, scoped rules, no membership side effects on denial, and existing members retained, using real Postgres for store behavior. Update addressing-policy docs. No tests have been run yet.
flowchart LR
A[Verified inviter] --> B[Shared addressing check]
B --> C[Invite or clear refusal]
Loading
I would start implementation only after assignment and within the allowed hackathon window.
Thank you all for your interest and participation in our hackathon! In the interest of fairness, we will not be assigning issues to individual participants but instead let anyone try and solve any number of them.
Joins made on the platform (someone adds the bot to a channel directly, today recorded as added_by_kind="system"): judge them as the person who added the bot whenever the platform reports who did it. InboundAgentJoin carries no inviter yet, so add one for adapters that can report it (Slack does, for example). When the platform doesn't report who it was, let the join through, but say so:
post a notice in the room that Switch couldn't verify who added the agent and that its owner can remove it;
log a warning;
tell the owner.
Nobody gets an implicit admin bypass, and an unknown inviter is never treated as trusted.
Template runs: judge them as the person running the template. Agents the template creates belong to that person; existing agents owned by others are checked against the runner.
Agent invites (invite_agent_to_room): judge them as the inviting agent, which the owner_and_owner_agents policy already covers.
The check should still live in one shared place that every path, including platform joins, goes through.
I'd like to contribute to #805 for the Flip the Switch Hackathon.
The issue is important because an agent's addressing policy should protect not only who can communicate with it, but also who can invite it into a room. I would focus on enforcing that rule at the shared room-service layer, so the different entry points cannot accidentally bypass it.
Proposed implementation
Centralize authorization: Introduce a reusable invitation-policy check in the shared room-service path, using the existing addressing_policy rules instead of creating a separate permission model.
Cover every invitation path: Apply the check to chat/slash commands, the invite_agent_to_room MCP operation, agent-bridge APIs, Gateway room management, and room creation with initial agents.
Preserve inviter identity: Evaluate ordinary invitations against the verified requester, template invitations against the template runner, and agent-origin invitations against the inviting agent.
Handle platform-origin joins correctly: Following the latest maintainer clarification, use the actual inviter when the platform provides it. If a platform cannot identify who added the agent, allow the join with a visible room notice, owner notification, and warning log—without silently treating the unknown inviter as trusted.
Avoid regressions: Reject unauthorized new invitations before membership side effects while leaving existing room membership unchanged.
Proposed architecture
flowchart TD
A["Chat / MCP / Gateway / Templates / Platform"] --> B["Shared Room Service"]
B --> C["Resolve inviter identity"]
C --> D{"Known inviter?"}
D -->|Yes| E{"Addressing policy allows?"}
E -->|Yes| F["Complete invitation"]
E -->|No| G["Reject with clear explanation"]
D -->|Unknown platform join| H["Allow + notify owner and room + log"]
Loading
Verification
I'll add tests for owner, owner-agent, permitted and denied users, templates, platform-origin joins with missing identity, and every supported invitation entry point.
I'll also check that rejected invitations have no database side effects, using real PostgreSQL-backed integration tests where required, and update the addressing-policy documentation.
I understand the updated open-participation policy, so I'm not requesting an exclusive assignment. I'd appreciate confirmation that this approach matches the expected authorization boundary, particularly for unidentified platform-origin joins.
Thanks @petr-sandbox, that’s clear. I’ve built it to that policy: platform joins are judged as whoever added the bot (Slack and Telegram report it), an unknown adder is let in with a notice in the room and a logged warning, templates are judged as the runner, and agent invites as the inviting agent, all through one shared check. I’ll open the PR in the hackathon window.
Hi @petr-sandbox, I'm in the Flip the Switch hackathon and would like to take this one. I've gone through the invite flow in create_room / invite_agent_to_room and the agent DM-permission settings, and plan to enforce the target agent's allowlist on room invites with tests. Could you assign it to me?
@petr-sandbox the PR is up: #1043. It follows your policy above. Platform joins are judged as whoever added the bot when the platform says (Slack and Telegram do). An unknown adder is let in with a room notice, a warning log and an @-mention of the owner. Templates are judged as the runner, and agent invites as the inviting agent. Everything goes through one gate.
One thing to flag: Switch has no direct way to notify an owner today, so if the owner hasn't linked a chat account, the room notice and the warning log are all there is. The PR says more, and I'm happy to add a direct notification if you want one.
Hi @petr-sandbox, I'd like to work on this by putting the permission check where all invite paths share it. I'll follow your clarification about checking the actual inviter, including template runs and agents inviting other agents. When a platform can't tell us who added the bot, I'll keep the join but make that uncertainty visible to the room and owner, with no implicit admin bypass.
One shared check, not four. A single function beside the addressing rules (core/switch_core/addressing.py / delivery/addressing.py) answers "may this actor put this agent in this room", and every invite path calls it: the !invite-agent chat command and /invite-agent slash command (bridges/agent/commands.py), the invite_agent_to_room MCP tool (bridges/agent/operations/definitions.py and protocol/agent_core.py), the agent-bridge API (bridges/agent/api/handlers.py), room creation with agents, and the gateway's room page. The point is that a future invite path has one obvious thing to call rather than a rule to remember.
The check reuses the existing addressing_policy evaluation rather than reimplementing it, so the two can't drift: whoever may address the agent may invite it, and nobody else.
A refusal says why and who can do it (the owner), in the same words on every path, rather than a bare 403. Following the repo's error philosophy, it raises rather than returning a boolean the caller can ignore.
Agents already in rooms are left alone: the check gates the invite, not membership, so nothing gets kicked out by an upgrade. I'll say so explicitly in the PR.
Tests per path, with the store-level ones against a real Postgres as the repo requires — owner invites succeed, a non-allowed member is refused on every path, owner_agents and named-agent policies behave, and an agent already in a room stays.
Docs updated where addressing policies are described.
One thing I'd like your call on: whether an agent sender inviting on someone's behalf should count as that someone. The connections design note already flags that an agent is not the person, and owner_agents makes "others can address it" true — I'll follow that existing reading (treat the agent sender by the same policy) unless you want the stricter one.
Update: PR #1443 implements the shared invitation check. The decision flow is shown below.
Invitation decision flow
flowchart TD
subgraph Boundary["Callers and external platforms"]
User["Signed-in Switch user<br/>or agent tool"]
Chat["Chat command sender"]
Platform["Platform join event<br/>adder may be unknown"]
end
subgraph Switch["Switch service"]
Room["RoomService<br/>create_room / add_agents_to_room"]
Gate["InviteGate<br/>checks agents to be added"]
Resolve["Resolve named inviter<br/>to a sender principal"]
Policy["AddressingResolver.judge<br/>applies agent addressing policy"]
Decision{"Policy permits<br/>the inviter?"}
Add["Create room if needed;<br/>add permitted agents"]
Refuse["Refuse invite;<br/>return message with owner guidance"]
Partial["New platform channel only:<br/>exclude refused agents and retry rest"]
Unverified["No platform adder reported:<br/>restricted agents marked unverified"]
Notice["Bridge posts channel notice<br/>and logs a warning"]
Result["Return room / invite outcome"]
DB[("Database:<br/>room and agent membership")]
end
User --> Room
Chat --> Room
Platform --> Room
Room --> Gate
Gate -- "named inviter" --> Resolve --> Policy --> Decision
Decision -- "allowed" --> Add
Decision -- "refused" --> Refuse
Refuse -- "new platform channel" --> Partial --> Room
Gate -- "platform adder absent" --> Unverified --> Add
Add --> DB
Add --> Result
Unverified --> Notice
Loading
The owner is allowed by an owner-only policy, but other policies may authorize other actors. An agent can invite itself; administrator status is not an implicit bypass. Existing members are not re-judged. A regular refused create does not provision the room; the partial retry shown is specific to a newly discovered platform channel. The unverified path does not authenticate the absent adder.
RoomService.create_room and add_agents_to_room require an inviter and use InviteGate, which resolves the actor and applies the invited agent's existing addressing policy through AddressingResolver.judge. Refusals explain why and point to the owner; existing room members are not re-checked. There is no implicit admin bypass.
For platform joins, a reported adder is evaluated as that person. If the platform does not report an adder, the join is allowed; restricted agents are marked unverified, the bridge posts a room notice and logs a warning. The owner is mentioned in the room when they have a linked account on that bridge; there is no direct owner DM.
Focused verification: at commit 9505b6f07f0941dd059cffbefd64389cb915d69a, 34 tests passed across test_invites.py, test_room_service_invites.py, and test_bridge_invite_gate.py on Linux ARM. The room-service tests used real PostgreSQL 16; gate and bridge tests use fakes. The run used a loopback-only test-container guard.
These are focused tests, not a full-suite run or a live Slack/Telegram verification. The service-level rehearsal uses synthetic identities and simulated transport/provisioning; it is not a live UI demo. The tests also do not establish atomicity against a concurrent policy change.
@petr-sandbox I'd like to take #805 for Track 03. I can see it is at GitHub's 10-assignee limit; per your notes on #842 and #770 I'll proceed and link the PR here, but please add me if a slot opens.
Approach: one gate, with the inviter required by type.
RoomService.add_agents_to_room and create_room(agents=...) stay the only membership choke points. The inviter becomes a required argument (a person, an inviting agent, a template runner, or a platform-reported adder), so a new call site cannot quietly omit it. The gate reuses AddressingResolver/addressing.py, so "may invite" is exactly "may address" — no second permission model. It runs before any membership or channel side effect, re-reads the policy and membership in the same transaction as the insert, and leaves existing members untouched. There is no implicit admin bypass.
Path coverage
!invite-agent / /invite-agent → the person sending it.
invite_agent_to_room MCP tool and agent-bridge API → the inviting agent (owner_and_owner_agents already covers this).
Gateway room page and room creation with agents → the requesting person.
rooms.yaml / template runs → the person running the template.
Platform joins → the adder the adapter reports (Slack and Telegram first). When the platform reports nobody, allow the join but make the uncertainty visible: room notice, warning log, and the owner told. An unknown adder is never treated as trusted.
A refusal names the agent and says only its owner (or someone its policy allows) can add it, in the same words on every surface.
Tests
Path-by-path matrix (owner / allowed / denied / unclaimed), no membership or channel side effects on refusal, existing members retained, unknown-adder disclosure, and real-Postgres store tests including a policy change racing the invite. Docs updated where addressing policy is described.
@anuj-kadu this issue has reached GitHub's limit of 10 assignees, so I couldn't add you. You don't need to be assigned to work on it, and your PR counts the same, as does #1732.
Activity
afreenorbit commentedon Oct 21, 2026
Hi @petr-sandbox! I'd like to take this one for the hackathon.
In short: check the agent's addressing policy once, inside
RoomService, where every invite path already ends up, so no path (current or future) can skip it. A refused invite says why and that the owner can add the agent.What I found tracing the invite paths (in
core/switch_core/):!invite-agent//invite-agent(bridges/agent/commands.py) ->RoomService.add_agents_to_roominvite_agent_to_roomMCP tool and the agent API route (operations/definitions.py,api/handlers.py) ->AgentCore.invite_agent_to_room->add_agents_to_room. I see Remove the legacy agent moderation routes #993 removes the legacy moderation routes, so I'll build on whatever is left after it.gateway/rooms.py,POST /{room_id}/agents) ->add_agents_to_roomcreate_room,rooms_yaml.pytemplates) ->RoomService.create_roomaddressing.py(pure rules: rooms, groups, users, agents,owner,owner_agents).delivery/addressing.pyresolves who a sender is and answerspermitted(...).So two
RoomServicemethods cover every path.Plan:
may_invite(inviter, agent, room)built on the same rules and sender resolution aspermitted, so "who may invite" always means "who may talk to it". An open policy keeps its fast path.add_agents_to_roomandcreate_room(a person, an agent, or the system acting for a person). Every caller has to say who is inviting, which is what stops a future path from skipping the check.switch-skill/SKILL.md), so agents know an invite can be refused and why, and the switch-buddy / switch-expert instructions where they explain addressing policies. The published pages underdocs/official/come from the docs repo, so I'll note what needs changing there in the PR.Two questions before I start:
collaboration_core.py,added_by_kind="system"), should that be judged as the person who did it where the platform reports them, and allowed otherwise?Done when:
owner_agentsand an open policycore/tests/switch_core/, using the existing Postgres fixturesdocs/official/changes listed in the PR for the docs repoNo AI model is needed to test any of this. Before opening the PR I'll run
just check,just typecheckandjust test.I haven't written any code yet and will only start once this is assigned to me. I've also asked for #806; I'll work on whichever one I'm assigned first, and only start the other once that PR is up.
ANAMASGARD commentedon Oct 21, 2026
Hi @amaudruz and @petr-sandbox — Room invites should not bypass the same permission that controls addressing the agent. I see another contributor has expressed interest; if you are still considering candidates, I'd be happy to be considered.
core/switch_core/room_service.py, covering bothadd_agents_to_room()and creation with initial agents, before membership/channel side effects. Reuseaddressing.pyanddelivery/addressing.pysemantics rather than inventing a separate invite allow-list.I would start implementation only after assignment and within the allowed hackathon window.
petr-sandbox commentedon Oct 22, 2026
Thank you all for your interest and participation in our hackathon! In the interest of fairness, we will not be assigning issues to individual participants but instead let anyone try and solve any number of them.
petr-sandbox commentedon Oct 22, 2026
Thanks @afreenorbit and @ANAMASGARD. Here is the policy:
Joins made on the platform (someone adds the bot to a channel directly, today recorded as
added_by_kind="system"): judge them as the person who added the bot whenever the platform reports who did it.InboundAgentJoincarries no inviter yet, so add one for adapters that can report it (Slack does, for example). When the platform doesn't report who it was, let the join through, but say so:Nobody gets an implicit admin bypass, and an unknown inviter is never treated as trusted.
Template runs: judge them as the person running the template. Agents the template creates belong to that person; existing agents owned by others are checked against the runner.
Agent invites (
invite_agent_to_room): judge them as the inviting agent, which theowner_and_owner_agentspolicy already covers.The check should still live in one shared place that every path, including platform joins, goes through.
jmass-ggg commentedon Oct 22, 2026
Hi @petr-sandbox and @amaudruz,
I'd like to contribute to #805 for the Flip the Switch Hackathon.
The issue is important because an agent's addressing policy should protect not only who can communicate with it, but also who can invite it into a room. I would focus on enforcing that rule at the shared room-service layer, so the different entry points cannot accidentally bypass it.
Proposed implementation
Centralize authorization: Introduce a reusable invitation-policy check in the shared room-service path, using the existing
addressing_policyrules instead of creating a separate permission model.Cover every invitation path: Apply the check to chat/slash commands, the
invite_agent_to_roomMCP operation, agent-bridge APIs, Gateway room management, and room creation with initial agents.Preserve inviter identity: Evaluate ordinary invitations against the verified requester, template invitations against the template runner, and agent-origin invitations against the inviting agent.
Handle platform-origin joins correctly: Following the latest maintainer clarification, use the actual inviter when the platform provides it. If a platform cannot identify who added the agent, allow the join with a visible room notice, owner notification, and warning log—without silently treating the unknown inviter as trusted.
Avoid regressions: Reject unauthorized new invitations before membership side effects while leaving existing room membership unchanged.
Proposed architecture
flowchart TD A["Chat / MCP / Gateway / Templates / Platform"] --> B["Shared Room Service"] B --> C["Resolve inviter identity"] C --> D{"Known inviter?"} D -->|Yes| E{"Addressing policy allows?"} E -->|Yes| F["Complete invitation"] E -->|No| G["Reject with clear explanation"] D -->|Unknown platform join| H["Allow + notify owner and room + log"]Verification
I'll add tests for owner, owner-agent, permitted and denied users, templates, platform-origin joins with missing identity, and every supported invitation entry point.
I'll also check that rejected invitations have no database side effects, using real PostgreSQL-backed integration tests where required, and update the addressing-policy documentation.
I understand the updated open-participation policy, so I'm not requesting an exclusive assignment. I'd appreciate confirmation that this approach matches the expected authorization boundary, particularly for unidentified platform-origin joins.
Thank you!
afreenorbit commentedon Oct 22, 2026
Thanks @petr-sandbox, that’s clear. I’ve built it to that policy: platform joins are judged as whoever added the bot (Slack and Telegram report it), an unknown adder is let in with a notice in the room and a logged warning, templates are judged as the runner, and agent invites as the inviting agent, all through one shared check. I’ll open the PR in the hackathon window.
Kulraj69 commentedon Oct 23, 2026
Hi @petr-sandbox, I'm in the Flip the Switch hackathon and would like to take this one. I've gone through the invite flow in
create_room/invite_agent_to_roomand the agent DM-permission settings, and plan to enforce the target agent's allowlist on room invites with tests. Could you assign it to me?afreenorbit commentedon Oct 24, 2026
@petr-sandbox the PR is up: #1043. It follows your policy above. Platform joins are judged as whoever added the bot when the platform says (Slack and Telegram do). An unknown adder is let in with a room notice, a warning log and an @-mention of the owner. Templates are judged as the runner, and agent invites as the inviting agent. Everything goes through one gate.
One thing to flag: Switch has no direct way to notify an owner today, so if the owner hasn't linked a chat account, the room notice and the warning log are all there is. The PR says more, and I'm happy to add a direct notification if you want one.
9 remaining items
BUTTERFINGERS7498 commentedon Nov 4, 2026
Hi @petr-sandbox, I'd like to work on this by putting the permission check where all invite paths share it. I'll follow your clarification about checking the actual inviter, including template runs and agents inviting other agents. When a platform can't tell us who added the bot, I'll keep the join but make that uncertainty visible to the room and owner, with no implicit admin bypass.
Aryan-Techie commentedon Nov 4, 2026
@petr-sandbox I'd like to pick this one up.
Plan
core/switch_core/addressing.py/delivery/addressing.py) answers "may this actor put this agent in this room", and every invite path calls it: the!invite-agentchat command and/invite-agentslash command (bridges/agent/commands.py), theinvite_agent_to_roomMCP tool (bridges/agent/operations/definitions.pyandprotocol/agent_core.py), the agent-bridge API (bridges/agent/api/handlers.py), room creation with agents, and the gateway's room page. The point is that a future invite path has one obvious thing to call rather than a rule to remember.addressing_policyevaluation rather than reimplementing it, so the two can't drift: whoever may address the agent may invite it, and nobody else.owner_agentsand named-agent policies behave, and an agent already in a room stays.One thing I'd like your call on: whether an agent sender inviting on someone's behalf should count as that someone. The connections design note already flags that an agent is not the person, and
owner_agentsmakes "others can address it" true — I'll follow that existing reading (treat the agent sender by the same policy) unless you want the stricter one.Could you assign it to me?
Xuefeng-Zhu commentedon Nov 4, 2026
Update: PR #1443 implements the shared invitation check. The decision flow is shown below.
Invitation decision flow
flowchart TD subgraph Boundary["Callers and external platforms"] User["Signed-in Switch user<br/>or agent tool"] Chat["Chat command sender"] Platform["Platform join event<br/>adder may be unknown"] end subgraph Switch["Switch service"] Room["RoomService<br/>create_room / add_agents_to_room"] Gate["InviteGate<br/>checks agents to be added"] Resolve["Resolve named inviter<br/>to a sender principal"] Policy["AddressingResolver.judge<br/>applies agent addressing policy"] Decision{"Policy permits<br/>the inviter?"} Add["Create room if needed;<br/>add permitted agents"] Refuse["Refuse invite;<br/>return message with owner guidance"] Partial["New platform channel only:<br/>exclude refused agents and retry rest"] Unverified["No platform adder reported:<br/>restricted agents marked unverified"] Notice["Bridge posts channel notice<br/>and logs a warning"] Result["Return room / invite outcome"] DB[("Database:<br/>room and agent membership")] end User --> Room Chat --> Room Platform --> Room Room --> Gate Gate -- "named inviter" --> Resolve --> Policy --> Decision Decision -- "allowed" --> Add Decision -- "refused" --> Refuse Refuse -- "new platform channel" --> Partial --> Room Gate -- "platform adder absent" --> Unverified --> Add Add --> DB Add --> Result Unverified --> NoticeThe owner is allowed by an owner-only policy, but other policies may authorize other actors. An agent can invite itself; administrator status is not an implicit bypass. Existing members are not re-judged. A regular refused create does not provision the room; the partial retry shown is specific to a newly discovered platform channel. The unverified path does not authenticate the absent adder.
RoomService.create_roomandadd_agents_to_roomrequire an inviter and useInviteGate, which resolves the actor and applies the invited agent's existing addressing policy throughAddressingResolver.judge. Refusals explain why and point to the owner; existing room members are not re-checked. There is no implicit admin bypass.9505b6f07f0941dd059cffbefd64389cb915d69a, 34 tests passed acrosstest_invites.py,test_room_service_invites.py, andtest_bridge_invite_gate.pyon Linux ARM. The room-service tests used real PostgreSQL 16; gate and bridge tests use fakes. The run used a loopback-only test-container guard.These are focused tests, not a full-suite run or a live Slack/Telegram verification. The service-level rehearsal uses synthetic identities and simulated transport/provisioning; it is not a live UI demo. The tests also do not establish atomicity against a concurrent policy change.
Trim changes sandbox-quantum#805 does not need
fix(rooms): adding an agent to a room asks whether the person may tal…
anuj-kadu commentedon Nov 7, 2026
@petr-sandbox I'd like to take #805 for Track 03. I can see it is at GitHub's 10-assignee limit; per your notes on #842 and #770 I'll proceed and link the PR here, but please add me if a slot opens.
Approach: one gate, with the inviter required by type.
RoomService.add_agents_to_roomandcreate_room(agents=...)stay the only membership choke points. The inviter becomes a required argument (a person, an inviting agent, a template runner, or a platform-reported adder), so a new call site cannot quietly omit it. The gate reusesAddressingResolver/addressing.py, so "may invite" is exactly "may address" — no second permission model. It runs before any membership or channel side effect, re-reads the policy and membership in the same transaction as the insert, and leaves existing members untouched. There is no implicit admin bypass.Path coverage
!invite-agent//invite-agent→ the person sending it.invite_agent_to_roomMCP tool and agent-bridge API → the inviting agent (owner_and_owner_agentsalready covers this).rooms.yaml/ template runs → the person running the template.A refusal names the agent and says only its owner (or someone its policy allows) can add it, in the same words on every surface.
Tests
Path-by-path matrix (owner / allowed / denied / unclaimed), no membership or channel side effects on refusal, existing members retained, unknown-adder disclosure, and real-Postgres store tests including a policy change racing the invite. Docs updated where addressing policy is described.
I'll open the PR before the deadline.
gudboii21 commentedon Nov 7, 2026
@petr-sandbox I have implemented the agent addressing check for room invitations in PR #1732 .
RoomServicebefore adding agents to a room or creating rooms with agentsagent_store.get_many!invite-agentnaming the ownerReady for review!
petr-sandbox commentedon Nov 7, 2026
@anuj-kadu this issue has reached GitHub's limit of 10 assignees, so I couldn't add you. You don't need to be assigned to work on it, and your PR counts the same, as does #1732.
Invites: hold workspace admins to the agent's policy too
test: cover existing room members and invite policy (sandbox-quantum#805