Claude Code. Any Model. The most powerful AI coding agent now speaks every language.
fix(advisor): say a rejected subscription login moves on to metered hops
Jack Rudenko2f28210178ad
diff --git a/ai-docs/architecture/advisor.md b/ai-docs/architecture/advisor.mdindex 134e0693..feaf5c8a 100644--- a/ai-docs/architecture/advisor.md+++ b/ai-docs/architecture/advisor.md@@ -443,9 +443,13 @@ Deliberate deviations from main routing:`FallbackHandler` starts each call at the last hop that served (`lastSuccessIndex`). After onetransient subscription failure that a metered hop answered, every later call of that member-starts at the metered hop, exactly as on main (R3). A rejected subscription LOGIN is never routed-onto a metered hop (only subscription hops are tried after a terminal credential verdict), which-the notice says when a member's chain mixes the two. When a call is served by a hop whose billing+starts at the metered hop, exactly as on main (R3). A rejected subscription credential (expired,+wrong or revoked) moves the call on to the next hop, metered included, the same rule as a main+request (owner, 2026-10-21; `routing.md`): the panel uses the advisor handler set's+`FallbackHandler`, so `announceCredentialRejection` prints its stderr line once per provider and+upstream status, and the startup notice says so when a member's chain mixes the two billings+(`(if the subscription login is rejected, calls move on to the metered hop)`). Until then a rejected+login was never routed onto a metered hop. When a call is served by a hop whose billingdiffers from the hop the notice named, one line is written per change(`warnWhenServedUnlikePlan`, `handlers/native-handler-advisor.ts:2771`):@@ -553,7 +557,7 @@ off the main status line by design.```[claudish] --advisor is on for this launchpanel (each model is routed like a main-model request):- gpt-6.1-sol -> OpenAI Codex (subscription); then OpenAI (metered, billed per token) (a rejected subscription login is reported, never routed onto a metered hop)+ gpt-6.1-sol -> OpenAI Codex (subscription); then OpenAI (metered, billed per token) (if the subscription login is rejected, calls move on to the metered hop)sonnet -> api.anthropic.com (subscription: your Claude Code login; if a request carries none: its x-api-key or ANTHROPIC_API_KEY, metered, billed per token)collector: none — haiku is a Claude model; this launch gives the advisor no Claude login (…), and no ANTHROPIC_API_KEY was found in env, config, keychain or 1Password. …; panel answers will be concatenatedmain model: your Claude Code sessiondiff --git a/packages/cli/src/advisor-startup.test.ts b/packages/cli/src/advisor-startup.test.tsindex 15a3a228..dc5b8703 100644--- a/packages/cli/src/advisor-startup.test.ts+++ b/packages/cli/src/advisor-startup.test.ts@@ -401,7 +401,7 @@ describe("decideAdvisorStartup", () => {expect(decision.notice).toContain(" panel (each model is routed like a main-model request):");expect(decision.notice).toContain(- " gpt-6.1-sol -> OpenAI Codex (subscription); then OpenAI (metered, billed per token) (a rejected subscription login is reported, never routed onto a metered hop)"+ " gpt-6.1-sol -> OpenAI Codex (subscription); then OpenAI (metered, billed per token) (if the subscription login is rejected, calls move on to the metered hop)");expect(decision.notice).toContain(" haiku -> api.anthropic.com (subscription: your Claude Code login; if a request carries none: its x-api-key or ANTHROPIC_API_KEY, metered, billed per token)"diff --git a/packages/cli/src/handlers/advisor-route-plan.ts b/packages/cli/src/handlers/advisor-route-plan.tsindex d9fbe7d6..4ee1ab3b 100644--- a/packages/cli/src/handlers/advisor-route-plan.ts+++ b/packages/cli/src/handlers/advisor-route-plan.ts@@ -691,8 +691,11 @@ export function describeAdvisorPlan(plan: AdvisorModelPlan, build?: AdvisorChain.map((hop) => hop.displayName);for (const name of notBuilt) parts.push(` (not built: ${name}; see the debug log)`);+ // `FallbackHandler` moves past a rejected subscription credential to the+ // next hop, metered included (routing.md), so a mixed chain says so here;+ // the per-call warning (`warnWhenServedUnlikePlan`) names the hop that served.if (first.billing === "subscription" && laterMetered) {- parts.push(" (a rejected subscription login is reported, never routed onto a metered hop)");+ parts.push(" (if the subscription login is rejected, calls move on to the metered hop)");}return parts.join("");}diff --git a/packages/cli/src/handlers/native-handler-advisor.ts b/packages/cli/src/handlers/native-handler-advisor.tsindex f855b8e8..38b1f408 100644--- a/packages/cli/src/handlers/native-handler-advisor.ts+++ b/packages/cli/src/handlers/native-handler-advisor.ts@@ -2794,8 +2794,9 @@ async function runRoutedMember(* The hop that last served each routed member, when its billing differs from* the hop the startup notice named, keyed `"<role>:<spec>"`. `FallbackHandler`* starts every later call at the last hop that served (`lastSuccessIndex`), so- * after one transient subscription failure that a metered hop answered, every- * later call of that member is metered too — exactly as on main routing (R3).+ * after one transient subscription failure or one rejected subscription+ * credential that a metered hop answered, every later call of that member is+ * metered too — exactly as on main routing (R3).* That is accepted, but never silent: one line per change.*/const servedUnlikePlan = new Map<string, string>();