Repository navigation
Post the tagged-agent heads-up from the writing process, and skip it when only room agents are tagged (CHOO-3667) - #1222
Closed
abeldantas wants to merge 2 commits into
Closed
abeldantas wants to merge 2 commits into
abeldantas wants to merge 2 commits into
Conversation
…when only room agents are tagged (CHOO-3667) The admin's consumer reads every message in a tenant on one process, and checked each message with an @ for a tagged agent not in the room or a role with no live holder: two sessions and a lookup by name for every tag. In a load test at 60 messages a second the database saw these checks for about 10 messages a second, so the consumer fell behind. The router has read the room's agents to decide the message, so it now runs the check after commit on the process that wrote the message, and only when the message tags a name that is none of the room's agents. The checks themselves moved unchanged to clients/mention_warnings.py.
abeldantas
requested review from
agent-runner353,
amaudruz,
christian-mcdermott,
lbangalosbt,
massimo-sandboxaq,
niall-sandboxaq,
petr-sandbox,
raullopez-sandbox and
simonflk-sb
as code owners
October 31, 2026 13:40
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
A moderate active issue remains because messages sent by the selected admin actor can trigger absent-agent or role warnings when they contain an @ mention for a non-member.
1 open issue
What changed in this PR
This pull request moves tagged-agent and unreachable-role warnings from the single admin consumer into the message router’s post-commit workflow, reducing database load while preserving command-consumer ownership.
Changes:
- Extracts mention-warning logic into
MentionWarningsand adds unmatched-mention filtering. - Schedules warning checks after successful message commits on the writing process.
- Skips checks when all mentions target agents already in the room.
- Updates routing, consumer tests, ownership coverage, allowlist tests, and changelog documentation.
This pull request requires changes.
| File | Summary |
|---|---|
core/tests/switch_core/delivery/test_mention_warnings.py |
Tests writer-side warnings, filtering, and system-message handling; includes a minor test-name typo. |
core/tests/switch_core/db/test_tenant_exemption_allowlist.py |
Removes the obsolete command-consumer exemption. |
core/tests/switch_core/clients/test_command_consumer.py |
Moves mention-warning tests to the extracted implementation. |
core/tests/switch_core/clients/test_command_consumer_ownership.py |
Verifies command responses remain single-owner operations. |
core/switch_core/main.py |
Connects tenant admin actors to the router. |
core/switch_core/delivery/router.py |
Schedules post-commit mention warnings; requires fixes for admin-authored messages and attachment events. |
core/switch_core/clients/mention_warnings.py |
Contains the extracted role and absent-agent warning logic. |
core/switch_core/clients/command_consumer.py |
Retains command handling while removing mention-warning responsibilities. |
CHANGELOG.md |
Documents the post-commit warning optimization and behavior change. |
Review effort: Lite
Comment on lines
+1681
to
+1683
| admin = self._admin_for(reads.tenant_id) | ||
| if admin is None: | ||
| return None |
This was referenced Oct 31, 2026
# Conflicts: # CHANGELOG.md
Collaborator
Author
|
Combined into #1307 with the other scaling PRs. |
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 admin's consumer reads every message in a workspace on one process, and checked each message with an @ for a tagged agent not in the room or a role with no live holder: two sessions and a lookup by name for every tag. In a load test at 60 messages a second the database saw these checks for about 10 messages a second, so the consumer fell behind.
In this PR we:
clients/mention_warnings.py; the consumer keeps the commandsThe ownership tests now use a
!helpanswer to show the consumer runs once, since it no longer posts the warning.