@devries-cameron20 / t3code-1 / commits / 68ea280388
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(server): recognize Bedrock-backed Claude as authenticated (#3931)

Pieter van Zyl committed Jul 20, 2026 at 10:35 UTC 68ea280388bed4cf9229a4667b4f8a7b5b076105
2 files changed +50 -5
apps/server/src/provider/Layers/ClaudeProvider.ts
+24 -5
@@ -480,9 +480,19 @@ function claudeAuthMetadata(input: {
480 return undefined;
481 }
482
483 +function apiProviderAuthMetadata(
484 + apiProvider: string | undefined,
485 +): { readonly type: string; readonly label: string } | undefined {
486 + return apiProvider === "bedrock" ? { type: "bedrock", label: "Amazon Bedrock" } : undefined;
487 +}
488 +
489 // ── SDK capability probe ────────────────────────────────────────────
490
485 -const CAPABILITIES_PROBE_TIMEOUT_MS = 8_000;
491 +// Amazon Bedrock initializes far slower than first-party auth: the SDK boots the
492 +// Bedrock backend and runs the `awsAuthRefresh` credential hook before returning
493 +// account info. The previous 8s budget expired mid-init, so the probe returned
494 +// `undefined` and left the provider unverified and unselectable in the picker.
495 +const CAPABILITIES_PROBE_TIMEOUT_MS = 25_000;
496
497 function nonEmptyProbeString(value: string): string | undefined {
498 const candidate = value.trim();
@@ -493,6 +503,12 @@ type ClaudeCapabilitiesProbe = {
503 readonly email: string | undefined;
504 readonly subscriptionType: string | undefined;
505 readonly tokenSource: string | undefined;
506 + /**
507 + * Active API backend reported by the SDK's `AccountInfo`. Anthropic OAuth
508 + * login only applies when `"firstParty"`; for Amazon Bedrock (`"bedrock"`)
509 + * the subscription/token fields are absent and auth is external AWS creds.
510 + */
511 + readonly apiProvider: string | undefined;
512 readonly slashCommands: ReadonlyArray<ServerProviderSlashCommand>;
513 };
514
@@ -618,12 +634,14 @@ const probeClaudeCapabilities = (
634 readonly email?: string;
635 readonly subscriptionType?: string;
636 readonly tokenSource?: string;
637 + readonly apiProvider?: string;
638 }
639 | undefined;
640 return {
641 email: account?.email,
642 subscriptionType: account?.subscriptionType,
643 tokenSource: account?.tokenSource,
644 + apiProvider: account?.apiProvider,
645 slashCommands: parseClaudeInitializationCommands(init.commands),
646 } satisfies ClaudeCapabilitiesProbe;
647 });
@@ -799,10 +817,11 @@ export const checkClaudeProviderStatus = Effect.fn("checkClaudeProviderStatus")(
817 });
818 }
819
802 - const authMetadata = claudeAuthMetadata({
803 - subscriptionType: capabilities.subscriptionType,
804 - authMethod: capabilities.tokenSource,
805 - });
820 + const authMetadata =
821 + claudeAuthMetadata({
822 + subscriptionType: capabilities.subscriptionType,
823 + authMethod: capabilities.tokenSource,
824 + }) ?? apiProviderAuthMetadata(capabilities.apiProvider);
825 return buildServerProvider({
826 presentation: CLAUDE_PRESENTATION,
827 enabled: claudeSettings.enabled,
apps/server/src/provider/Layers/ProviderRegistry.test.ts
+26
@@ -100,6 +100,7 @@ type TestClaudeCapabilities = {
100 readonly email: string | undefined;
101 readonly subscriptionType: string | undefined;
102 readonly tokenSource: string | undefined;
103 + readonly apiProvider: string | undefined;
104 readonly slashCommands: ReadonlyArray<ServerProviderSlashCommand>;
105 };
106
@@ -109,6 +110,7 @@ function claudeCapabilities(overrides: Partial<TestClaudeCapabilities> = {}) {
110 email: undefined,
111 subscriptionType: undefined,
112 tokenSource: undefined,
113 + apiProvider: undefined,
114 slashCommands: [],
115 ...overrides,
116 });
@@ -1492,6 +1494,30 @@ it.layer(Layer.mergeAll(NodeServices.layer, ServerSettingsModule.layerTest(), Te
1494 ),
1495 );
1496
1497 + it.effect("returns ready and labels Bedrock-backed Claude as authenticated", () =>
1498 + Effect.gen(function* () {
1499 + // Bedrock authenticates via external AWS credentials, so the SDK init
1500 + // reports only `apiProvider` with no subscription or token.
1501 + const status = yield* checkClaudeProviderStatus(
1502 + defaultClaudeSettings,
1503 + claudeCapabilities({ apiProvider: "bedrock" }),
1504 + );
1505 + assert.strictEqual(status.status, "ready");
1506 + assert.strictEqual(status.installed, true);
1507 + assert.strictEqual(status.auth.status, "authenticated");
1508 + assert.strictEqual(status.auth.type, "bedrock");
1509 + assert.strictEqual(status.auth.label, "Amazon Bedrock");
1510 + }).pipe(
1511 + Effect.provide(
1512 + mockSpawnerLayer((args) => {
1513 + const joined = args.join(" ");
1514 + if (joined === "--version") return { stdout: "1.0.0\n", stderr: "", code: 0 };
1515 + throw new Error(`Unexpected args: ${joined}`);
1516 + }),
1517 + ),
1518 + ),
1519 + );
1520 +
1521 it.effect("includes Claude Fable 5 on supported Claude Code versions", () =>
1522 Effect.gen(function* () {
1523 const status = yield* checkClaudeProviderStatus(