Repository navigation
feat(sources): shared routing rules for an email account - #597
Merged
Merged
Conversation
An IMAP or Gmail account can carry routing rules every watch on it uses,
tried after the watch's own rules and before its namespace. PUT
/api/v1/sources/{id}/routes saves them, the routes preview takes
shared_routes and says which list decided, and the MCP tools
mail_routing and set_mail_routing read and change every account's and
watch's rules as lines.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UyrGrwCVGT6fLPEubx5puU
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UyrGrwCVGT6fLPEubx5puU
…-kxg3y5 # Conflicts: # docs/mcp.md
…-kxg3y5 # Conflicts: # README.md
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.
Requested by Adeel · project thread
Description
Before: routing rules for a shared inbox (#153, #184) lived only on each watch, so an account watched in several mailboxes needed the same rules copied onto every watch, and agents had no way to read or change any of them.
After: an IMAP or Gmail account can carry shared routing rules that every watch on it uses. A watch tries its own rules first, then the account's, then sends the message to its namespace, so a watch's rule can still make an exception. With no shared rules nothing changes.
How:
storage_source.routes(email accounts only), checked withmail_routes.checklike a watch's rules;mail_routes.decidetries the watch's list, then the account's.poll_watchrecordsshared: trueon a file a shared rule decided.PUT /api/v1/sources/{id}/routessaves them (auditedsource.routes);GET /sourcesshows them. The routes preview takesshared_routes(else the saved ones) and each row saysshared; itsnamespacenow defaults to "".mail_routinglists every email account's shared rules and each watch's own, as lines (from: *@acme.com = finance, the formatmailbox.routesalready uses), andset_mail_routingreplaces an account's shared rules or one watch's own.Motivation and Context
The queued item "Global admin-level routing rules for a shared source (one IMAP inbox to namespaces)" in the feature list (#153 #184).
Types of changes
!in the title)Checklist:
make hookschecks it on commit).docs/accordingly.changelog.d/imap-shared-routes.md.Done questions (AGENTS.md)
mail_routing/set_mail_routing(test_agents_read_and_change_routing_rules).openapi.jsonand the client regenerated with tooling).mail_routes, the watch rules editor and the line format from the assistant's mailbox.Local CI (
ci/local-ci.sh): backend (embedded SurrealDB), Next.js, pre-commit and title pass; server and upgrade jobs re-running after Docker was started.Generated by Claude Code