Claude Code. Any Model. The most powerful AI coding agent now speaks every language.
docs(routing): remove DEFAULT_ROUTING_RULES from code comments
Jack Rudenkoc78b57e37589
diff --git a/packages/cli/src/auth/credentials/prehydrate.ts b/packages/cli/src/auth/credentials/prehydrate.tsindex 2ad3d7c7..1b2b7f99 100644--- a/packages/cli/src/auth/credentials/prehydrate.ts+++ b/packages/cli/src/auth/credentials/prehydrate.ts@@ -366,7 +366,9 @@ export function joinPinnedChain(routes: Route[]): string | null {** i.e. handing that to `--model` produces a bare name again and the child* re-routes — the pin silently does nothing for every OpenRouter primary, which- * is the most common primary in the default rules. Prefixing fixes it:+ * a chain has whenever OpenRouter is its first credentialed hop (it is a+ * gateway candidate for many catalog models and the default fallback hop).+ * Prefixing fixes it:* `or@x-ai/grok-4.20` parses as provider "openrouter", explicit.** The `?? r.provider` branch covers runtime-registered custom endpoints, whichdiff --git a/packages/cli/src/providers/provider-definitions.ts b/packages/cli/src/providers/provider-definitions.tsindex 47ccd92b..92eed3b5 100644--- a/packages/cli/src/providers/provider-definitions.ts+++ b/packages/cli/src/providers/provider-definitions.ts@@ -492,14 +492,15 @@ export const BUILTIN_PROVIDERS: TieredProviderDefinition[] = [// EXPLICIT (`dv@claude-opus-5`), same as Alibaba Token Plan.//// `swe-*` is different in kind: it is Cognition's own model line, no other- // provider in the catalog carries it, and it collides with nothing. Without- // a pattern here, `parseModelSpec` sends every unrecognised bare name to- // native-anthropic (model-parser.ts, "No '/' - treat as native Anthropic- // model"), so `swe-1.7` never even reached the routing rules — it was- // silently rewritten to `claude-opus-4-1` and answered by a different- // vendor's model, probing byte-identically to a nonsense string while- // `[email protected]` served fine. A DEFAULT_ROUTING_RULES entry alone cannot fix- // that, because the native-anthropic catch-all preempts rule matching.+ // provider in the catalog carries it, and it collides with nothing. The+ // pattern is Devin's namespace claim: `gatherFromNamespaceClaims`+ // (route-candidates.ts) makes Devin a route candidate for a bare `swe-*`+ // name, which the catalog cannot list because the account decides what the+ // seat serves. It was added when `parseModelSpec` still sent every+ // unrecognised bare name to native-anthropic: `swe-1.7` never reached+ // routing, was silently rewritten to `claude-opus-4-1` and answered by a+ // different vendor's model, probing byte-identically to a nonsense string+ // while `[email protected]` served fine.//// Do NOT extend this list to Devin's re-served families.nativeModelPatterns: [{ pattern: /^swe-/i }],diff --git a/packages/cli/src/providers/route-candidates.ts b/packages/cli/src/providers/route-candidates.tsindex ac02569a..9f6f728f 100644--- a/packages/cli/src/providers/route-candidates.ts+++ b/packages/cli/src/providers/route-candidates.ts@@ -1,13 +1,11 @@/*** Every way claudish could call one model, gathered from the catalog and ordered.*- * This is the replacement for the FIRST step of the bare-name path- * (`explainBareName`) — the 24-entry- * hand-written table in `default-routing-rules.ts`, which named providers per- * model family and had to be edited whenever a vendor, a plan or a gateway- * changed. That file is now DELETED and this module is wired in:- * `explainBareName` calls `explainCatalogChain` (also behind `buildCatalogChain`),- * which calls {@link gatherRouteCandidates} for every bare name no USER rule matches.+ * The step of the bare-name path (`explainBareName`) that runs when no USER rule+ * matches: `explainCatalogChain` (also behind `buildCatalogChain`) calls+ * {@link gatherRouteCandidates}. It replaced a hand-written table that named+ * providers per model family and had to be edited whenever a vendor, a plan or+ * a gateway changed.** WHAT THIS MODULE IS NOT. It does not decide whether a candidate can be USED.* Two filters already own that question and neither is duplicated here:diff --git a/packages/cli/src/providers/routing-rules.ts b/packages/cli/src/providers/routing-rules.tsindex 60612dee..a2257645 100644--- a/packages/cli/src/providers/routing-rules.ts+++ b/packages/cli/src/providers/routing-rules.ts@@ -37,12 +37,11 @@ export interface RoutingRuleSources {** Local overwrites global by exact key match — no glob-vs-glob interleaving.*- * THERE ARE NO BUILT-IN RULES. The 24-entry `DEFAULT_ROUTING_RULES` table this- * used to merge under the user's rules is gone: the providers that can serve a- * bare name are now GATHERED from the cloud models catalog- * (`route-candidates.ts`), which publishes every tier — subscriptions, native- * APIs and gateways — for every model, and which the table could only- * approximate by hand. So the result here is frequently `{}`, and `explainBareName`+ * THERE ARE NO BUILT-IN RULES. The providers that can serve a bare name are+ * GATHERED from the cloud models catalog (`route-candidates.ts`), which+ * publishes every tier — subscriptions, native APIs and gateways — for every+ * model; a hand-written table merged under the user's rules could only+ * approximate that. So the result here is frequently `{}`, and `explainBareName`* treats "no rule matched" as "ask the catalog" rather than as an error.** What a user rule now MEANS is therefore stronger than it was: a match is used@@ -218,7 +217,7 @@ export function describeRoutingRuleProblem(problem: RoutingRuleProblem): string* underlying APIs accept any case, so users get bitten when copy-paste* casing doesn't exactly match a lowercase rule key.*- * Priority: exact → longest glob → "*" catch-all → null (use default chain).+ * Priority: exact → longest glob → "*" catch-all → null (the catalog decides).** NOTE: only the rule LOOKUP is lowered. The original `modelName` casing is* preserved when the route is built and sent to provider APIs (some are@@ -778,13 +777,10 @@ export interface CatalogChain {* `explainBareName`, which owns them, and duplicating either here would create* the second oracle `route-candidates.ts` exists to avoid.*- * Exported because `--probe` reconstructs the chain it is about to test rather- * than calling `route()` (it needs per-hop credential provenance that a- * `RoutePlan` does not carry). Before this existed, the probe read the same- * hand-written table `route()` did; with that table gone, a probe that only- * consulted user rules would have shown an EMPTY chain for every model the user- * had not written a rule for — a display that says "nothing routes this" about- * models that route fine.+ * Exported for `route-candidates.test.ts`, which checks the gathered chain and+ * the fallback append apart from the two filters. No display calls it: `--probe`+ * and the config TUI render `explainRoute`, which runs these two steps+ * (`explainCatalogChain`) and then the filters, exactly as `route()` does.*/export function buildCatalogChain(model: string,diff --git a/packages/cli/src/proxy-server.ts b/packages/cli/src/proxy-server.tsindex c61ae166..5c402890 100644--- a/packages/cli/src/proxy-server.ts+++ b/packages/cli/src/proxy-server.ts@@ -807,10 +807,12 @@ export async function createProxyServer(}}- // 2c. Provider fallback chain for auto-routed models- // When no explicit provider@ prefix is given, consult the routing engine- // (defaults + user overrides merged in loadRoutingRules), filter to- // credentialed providers, and wrap them in a FallbackHandler.+ // 2c. The routing chain for a bare name+ // When no explicit provider@ prefix is given, `route()` calculates the chain:+ // the user's own rules (loaded once above), else the candidates the cloud+ // models catalog publishes plus the fallback hop, each kept only when it has+ // a credential and the account does not deny the model. The kept hops are+ // wrapped in a FallbackHandler.// `proxyRouteDecision` IS this gate: only a `bare` target is routed. Every// other decision falls through to steps 3-7 below.{