Skip to content

Claude Code. Any Model. The most powerful AI coding agent now speaks every language.

fix(probe): a probe pick for Poe, retries for a slow list, and a 403 that is not the key

Jack Rudenko1512d665cc49
diff --git a/packages/cli/src/handlers/composed-handler.ts b/packages/cli/src/handlers/composed-handler.ts
index b1d5922a..9ebbe819 100644
--- a/packages/cli/src/handlers/composed-handler.ts
+++ b/packages/cli/src/handlers/composed-handler.ts
@@ -1843,9 +1843,19 @@ export function getRecoveryHint(
// format, so a prefix hint would confidently mislabel a working
// credential. The key's bytes are never read, which also keeps a failed
// secret operation out of a status line.
+ // "Access denied" for a MODEL is not a credential fault. Alibaba's Model
+ // Studio answers `403 Model.AccessDenied "Model access denied."` while the
+ // SAME key lists 169 models on the same host, and it answers that way for
+ // every model, including ids taken from the account's own list (measured
+ // 2026-09-19 on dashscope-intl). Sending the reader to check a key that the
+ // provider just accepted wastes the one clue they have: the account, not the
+ // credential, is what lacks access.
+ if (status === 403 && /access denied|accessdenied/i.test(lower)) {
+ return "The provider accepted the credential but denied access to this model — check model access or activation for this account in the provider's console, not the key.";
+ }
const siblingNote = providerUid ? describeSiblingKeys(getProviderByName(providerUid)) : "";
if (siblingNote) {
- return `Check API key / OAuth credentials. This vendor sells several plans whose keys are isolated, so a 401 can also mean the right key on the wrong plan's host.${siblingNote}`;
+ return `Check API key / OAuth credentials. This vendor sells several plans whose keys are isolated, so a ${status} can also mean the right key on the wrong plan's host.${siblingNote}`;
}
return "Check API key / OAuth credentials.";
}
diff --git a/packages/cli/src/providers/probe-catalog.ts b/packages/cli/src/providers/probe-catalog.ts
index 752cb795..635937f3 100644
--- a/packages/cli/src/providers/probe-catalog.ts
+++ b/packages/cli/src/providers/probe-catalog.ts
@@ -211,22 +211,43 @@ export interface DiscoveryResult {
reason?: string;
}
+/** Attempts for one discovery call: the first, plus two retries after a timeout. */
+const DISCOVERY_ATTEMPTS = 3;
+const DISCOVERY_TIMEOUT_MS = 8000;
+
export async function discoverProbeModelFromEndpoint(
proxyUrl: string,
providerSlug: string,
exclude?: ReadonlySet<string>
): Promise<DiscoveryResult> {
- let response: Response;
+ let response: Response | undefined;
+ let lastError = "fetch failed";
const excludeParam =
exclude && exclude.size > 0 ? `&exclude=${encodeURIComponent([...exclude].join(","))}` : "";
- try {
- response = await fetch(
- `${proxyUrl}/v1/probe-discover?provider=${encodeURIComponent(providerSlug)}${excludeParam}`,
- { signal: AbortSignal.timeout(8000) }
- );
- } catch (error) {
- return { model: null, reason: error instanceof Error ? error.message : "fetch failed" };
+ // Retry a TIMEOUT only, and nothing else: an answer means the provider spoke,
+ // and repeating a real "no model" wastes the probe's budget. Test All runs
+ // every provider at once, and under that load Devin's list — two protobuf
+ // calls, not a GET — ran past the 8s deadline and reported "no probe model:
+ // The operation timed out" for a subscription that answered in ~1s alone
+ // (measured 2026-09-19, 30 providers in parallel). A retry is cheap because
+ // the provider memoizes its list, so a call that finished late server-side is
+ // already warm for the next attempt.
+ for (let attempt = 1; attempt <= DISCOVERY_ATTEMPTS; attempt++) {
+ try {
+ response = await fetch(
+ `${proxyUrl}/v1/probe-discover?provider=${encodeURIComponent(providerSlug)}${excludeParam}`,
+ { signal: AbortSignal.timeout(DISCOVERY_TIMEOUT_MS) }
+ );
+ break;
+ } catch (error) {
+ const name = error instanceof Error ? error.name : "";
+ lastError = error instanceof Error ? error.message : "fetch failed";
+ const timedOut =
+ name === "TimeoutError" || name === "AbortError" || /timed? ?out/i.test(lastError);
+ if (!timedOut || attempt === DISCOVERY_ATTEMPTS) return { model: null, reason: lastError };
+ }
}
+ if (!response) return { model: null, reason: lastError };
let body: unknown;
try {
body = await response.json();
diff --git a/packages/cli/src/providers/provider-definitions.ts b/packages/cli/src/providers/provider-definitions.ts
index eec42914..96bfe977 100644
--- a/packages/cli/src/providers/provider-definitions.ts
+++ b/packages/cli/src/providers/provider-definitions.ts
@@ -919,6 +919,10 @@ export const BUILTIN_PROVIDERS: ProviderDefinition[] = [
transport: "poe",
baseUrl: "https://api.poe.com",
apiPath: "/v1/chat/completions",
+ // The catalog has no verified probe pick for Poe, so the account's own list
+ // is the only source of one. Measured 2026-09-19: /v1/models answers 200
+ // with 341 models.
+ modelDiscovery: { path: "/v1/models", format: "openai-models-list" },
apiKeyEnvVar: "POE_API_KEY",
apiKeyDescription: "Poe API Key",
apiKeyUrl: "https://poe.com/api_key",
diff --git a/packages/cli/src/providers/transport/poe.ts b/packages/cli/src/providers/transport/poe.ts
index 767f46cd..ee5457d4 100644
--- a/packages/cli/src/providers/transport/poe.ts
+++ b/packages/cli/src/providers/transport/poe.ts
@@ -8,6 +8,8 @@
*/
import { credentials } from "../../auth/credentials/authority.js";
+import type { DiscoveryOutcome } from "./probe-discovery.js";
+import { discoverProviderProbeModel } from "./provider-model-discovery.js";
import type { ProviderTransport, StreamFormat } from "./types.js";
const POE_API_URL = "https://api.poe.com/v1/chat/completions";
@@ -25,4 +27,16 @@ export class PoeProvider implements ProviderTransport {
const auth = await credentials.getRequestAuth("poe", { model: "" });
return auth.headers;
}
+
+ /**
+ * Pick a probe model from the account's own list.
+ *
+ * The catalog marks Poe `no_verified_probe_model`, so without this Test All
+ * reported "no probe model: transport does not support discovery" and never
+ * sent a request, although Poe answers normally: measured 2026-09-19, its
+ * /v1/models returns 341 models and a chat request returns 200.
+ */
+ async discoverProbeModel(exclude?: ReadonlySet<string>): Promise<DiscoveryOutcome> {
+ return discoverProviderProbeModel(this.name, this.displayName, exclude);
+ }
}