← Back to PRs

#13477: routing: normalize account ID matching for agent bindings

by davidahmann open 2026-02-10 15:27 View on GitHub →
docker stale
## Summary - normalize `match.accountId` and runtime `accountId` using the same canonical account normalization - prevent fallback routing when binding and runtime account IDs differ only by case/formatting - add regression coverage for normalized account binding matches ## Validation - `pnpm vitest run src/routing/resolve-route.test.ts src/telegram/bot.create-telegram-bot.routes-dms-by-telegram-accountid-binding.test.ts` Fixes #13423 <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR updates routing account binding resolution so that accountId comparisons use the same canonical normalization as session key generation (`normalizeAccountId` from `src/routing/session-key.ts`). Concretely, `resolveAgentRoute` now normalizes the runtime accountId with the canonical normalizer, and `matchesAccountId` compares normalized forms instead of raw strings. A regression test was added to ensure bindings match when the configured accountId and runtime accountId differ only by case/formatting (e.g., `"Bot Main"` vs `"bot-main"`), preventing unintended fallback routing. <h3>Confidence Score: 5/5</h3> - This PR is safe to merge with minimal risk. - Changes are small, localized, and align routing-time accountId matching with the existing canonical normalization used for session keys. The added regression test covers the reported misrouting scenario. No call sites are broken because the public API is unchanged and behavior only becomes more permissive for equivalent account IDs. - No files require special attention <!-- greptile_other_comments_section --> <sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</sub> **Context used:** - Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8)) - Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13)) <!-- /greptile_comment -->

Most Similar PRs