fix(connectors): make email AGENT_NOT_GRANTED message provider-aware#1757
Merged
Conversation
The installed:email grant-migration override returned a hardcoded Google reconnect message for any AGENT_NOT_GRANTED, shadowing the provider-aware generic branch. A Microsoft mailbox grant gap therefore told users to reconnect Google — useless for a Graph scope gap. Key the override map by (agent_id, provider) so Microsoft falls through to the generic message naming Microsoft and the missing Graph scopes. Closes #1751
3 tasks
itomek
approved these changes
Jun 19, 2026
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.
When the email agent hit a per-agent grant gap on a Microsoft/Outlook mailbox, the error told the user to grant Google scopes and reconnect Google — the wrong provider, so it wasn't actionable. The
installed:emailgrant-migration override returned a hardcoded Google string for anyAGENT_NOT_GRANTED, shadowing the provider-aware generic branch right below it. Now the override is keyed by(agent_id, provider): Google failures still get the tailored migration message, while a Microsoft failure falls through to the generic branch that names Microsoft and the actual missing Graph scopes. Grant-awareness stays entirely in the connectors layer — agents are unchanged.Closes #1751
Test plan
python -m pytest tests/unit/connectors/test_formatting.py -xpasses (new..._microsoft_falls_throughtest asserts no Google text leaks onto a Microsoft failure)python util/lint.py --allpassesinstalled:email, run a multi-mailboxpre_scan_inbox/triage_inboxand confirm themicrosoftentry inmailbox_errorsnames Microsoft + the missing Graph scopes (not Google/gmail.modify); re-grant to restore.