Repository navigation
Judge room invites by the invited agent's addressing policy - #1443
Open
Xuefeng-Zhu wants to merge 9 commits into
Open
Xuefeng-Zhu wants to merge 9 commits into
Xuefeng-Zhu wants to merge 9 commits into
Conversation
Xuefeng-Zhu
requested review from
abeldantas,
agent-runner353,
amaudruz,
christian-mcdermott,
lbangalosbt,
massimo-sandboxaq,
niall-sandboxaq,
petr-sandbox,
raullopez-sandbox and
simonflk-sb
as code owners
November 4, 2026 06:32
5 tasks
# Conflicts: # CHANGELOG.md
- AddressingResolver.judge is now the tail of permitted() exactly as it was: drop the open-policy shortcut in front of allows_on_behalf_of, which already answers an open policy itself. - Drop InviteOutcome.refused_ids, which nothing reads. - Drop the issue-number tags from code comments and test docstrings, as the codebase does not use them.
# Conflicts: # CHANGELOG.md # core/switch_core/bridges/agent/operations/definitions.py # core/switch_core/gateway/rooms.py # core/switch_core/template_runs.py # core/tests/switch_core/test_dm_rooms.py
This branch has not been deployed
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.
Closes #805
What this changes
Room invitations now use the invited agent's addressing policy, with a refusal that explains who can invite instead. A platform join with no identified adder can't be refused, so Switch tells the current owner in Console and Gateway.
How it was tested
At
57243689e, the live Gateway returned HTTP 403 when a guest invited Bluefin Helper. The refusal explained the addressing policy and directed the guest to the owner. Room membership stayed unchanged. A separate genuine Mattermost bot join without a reported inviter succeeded and produced a Console notice explaining that Switch could not verify who added the agent. The notice endpoint returned the notice to the current owner and did not expose it to the guest. A cold Core boot on an empty database hit expand-only merge2de54af6031b. The test used a scratch database pre-migrated with only that merge's rollout bookkeeping skipped. The migration scripts and exact-head Core runtime image stayed unchanged.57243689e, Core invite, room service, DM, owner notice, entry-point and migration tests passed against disposable PostgreSQL where required. Ruff and Core mypy passed.Done when
test_invite_command_policy.py,test_invite_addressing_policy.py,test_room_service_invites.pyandtest_invite_gateway_policy.pycover refusals by the shared gate.test_room_create_platform_error.pychecks that the Gateway returns the refusal wording.test_invites.pycovers allowed principals;test_room_service_invites.pyandtest_invite_addressing_policy.pyexercise accepted invitations.test_room_service_invites.pychecks that refusing a new invite preserves existing members and that existing members are not judged again.57243689e).docs/official/internals/identity-and-access.mdnow describes the invite rule and owner notices;test_room_service_invites.pycovers that behavior.How it works
InviteGateinRoomServicechecks the actual person, agent, template runner or platform-reported adder for new memberships. Existing room members keep their places.Known limitations
PR details
These commits are dated after the PR was closed and reopened on November 7, 2026.
5b644b0a3Merge remote-tracking branch 'upstream/main' into HEADb995ed4fftest: cover existing room members and invite policy (Room invites should respect who can talk to an agent #805)97e8f1aa7test: cover invitation policy at entry pointsb72e3c32ffeat(invites): notify owners of unverified platform joins0162c5f13Merge upstream main into room invite addressing57243689eReconcile invite tests and migrations with upstreamVideo
Console recordings at
57243689e. The guest clip shows the room invite refused under the agent's addressing policy. The Gateway returned HTTP 403. The owner clip shows the fresh private notice after a separate Mattermost bot join where the platform did not report who added it.Earlier recording
Service-level invite demo shows a stranger refused and the owner accepted. It predates the notice UI.
invitation-story-final.webm