Skip to content

Fix error related to case sensitivity for email routing#992

Open
Muhammad-Bin-Ali wants to merge 1 commit intomainfrom
fix/case-insensitive-email-routing
Open

Fix error related to case sensitivity for email routing#992
Muhammad-Bin-Ali wants to merge 1 commit intomainfrom
fix/case-insensitive-email-routing

Conversation

@Muhammad-Bin-Ali
Copy link
Contributor

Resolves #988

Fix email routing for mail-server-lowercased agent names

Closes the case-sensitivity gap in routeAgentEmail where email infrastructure lowercases addresses before delivery, causing PascalCase agent bindings to fail lookup.

Problem

Email servers normalize addresses to lowercase. When a user sends to SomeAgent+123@domain.com, the Worker receives someagent+123@domain.com. The router's lookup map only contained:

  • SomeAgent (original binding name)
  • some-agent (kebab-case, added in v0.0.106)
    The plain-lowercase someagent had no match, producing:

Agent namespace 'someagent' not found in environment. Available agents: SomeAgent

Fix

Register a third key — key.toLowerCase() — in the agent map alongside the existing original and kebab-case entries. The map now contains:

  • SomeAgent → namespace
  • some-agent → namespace
  • someagent → namespace
    Also refactored the cache to store original binding names separately, so the error message lists only original names without lowercase/kebab duplicates.

Generated by Opencode

@changeset-bot
Copy link

changeset-bot bot commented Feb 25, 2026

🦋 Changeset detected

Latest commit: eabdf7a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
agents Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 25, 2026

Open in StackBlitz

npm i https://pkg.pr.new/cloudflare/agents@992
npm i https://pkg.pr.new/cloudflare/agents/@cloudflare/ai-chat@992
npm i https://pkg.pr.new/cloudflare/agents/@cloudflare/codemode@992
npm i https://pkg.pr.new/cloudflare/agents/hono-agents@992

commit: eabdf7a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

createAddressBasedEmailResolver is case-sensitive

1 participant