fix(workspace): project Anthropic adapter creds for BYOK MiniMax on restart with workspace override (core#2712) #2735
Reference in New Issue
Block a user
Delete Branch "fix/2712-restart-byok-minimax-projection"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
fix(workspace): project Anthropic adapter creds for BYOK MiniMax on restart with workspace override (core#2712)
A claude-code workspace with a per-workspace BYOK billing-mode override short-circuits before it sets . The core#2709 projection block then skipped because fails, so after restart the container had but no / , and the Anthropic SDK 401'd — this is the restart-degraded / path observed in run 358077.
Derive the provider from inside the projection block when is missing, so BYOK MiniMax still gets its Anthropic-shaped adapter credentials projected after restart.
Fixes #2712.
Co-Authored-By: Claude noreply@anthropic.com
Test plan
SOP Checklist
A claude-code workspace with a per-workspace BYOK billing-mode override short-circuits ResolveLLMBillingModeDerived before it sets ProviderSelection. The core#2709 projection block then skipped because providerFromRegistry("") fails, so after restart the container had MINIMAX_API_KEY but no ANTHROPIC_AUTH_TOKEN / ANTHROPIC_BASE_URL, and the Anthropic SDK 401'd. Derive the provider from (runtime, effectiveModel, availableAuthEnv) inside the projection block when ProviderSelection is missing, so BYOK MiniMax (and any other third_party_anthropic_compat provider) still gets its Anthropic- shaped adapter credentials projected after restart. - Fixes the restart-degraded / _ResultError path observed in run 358077. - Adds regression test for workspace-override + bare MiniMax-M2.7 model. Co-Authored-By: Claude <noreply@anthropic.com>APPROVED: verified the BYOK workspace-override restart path at head
3b68bd6d.The fallback provider derivation is narrowly scoped to BYOK + Anthropic-native runtime + missing ProviderSelection, derives through the existing provider manifest from runtime/model/available auth env, and then still requires providerFromRegistry before projecting. That makes the MiniMax workspace-override path project MINIMAX_API_KEY into ANTHROPIC_AUTH_TOKEN plus the MiniMax Anthropic base URL without introducing a cross-provider credential path. The existing ProviderSelection-set path remains unchanged, and derivation failure is fail-safe/no-projection rather than misprojection.
The regression test covers the restart/override shape: claude-code + MiniMax model + BYOK workspace override + MINIMAX_API_KEY yields ANTHROPIC_AUTH_TOKEN and ANTHROPIC_BASE_URL while preserving MINIMAX_API_KEY. Required CI is green on this head. /sop-ack
/sop-ack
APPROVED (post-merge 2nd-review verification; PR was already merged when I fetched it).
5-axis: production change is narrowly scoped to
applyPlatformManagedLLMEnv; it fills the BYOK workspace-override ProviderSelection gap by deriving provider from runtime/model/auth env before Anthropic-adapter projection; regression coverage proves MiniMax BYOK projectsANTHROPIC_AUTH_TOKENandANTHROPIC_BASE_URLwhile preservingMINIMAX_API_KEY; no broad billing-mode behavior change beyond missing-provider fallback; no new secret exposure./sop-ack