fix(workspace): project Anthropic adapter creds for BYOK MiniMax on restart with workspace override (core#2712) #2735

Merged
devops-engineer merged 1 commits from fix/2712-restart-byok-minimax-projection into main 2026-06-13 08:55:19 +00:00
Member

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

  • passes (full suite, including new regression test).
  • New regression test asserts the exact repro shape: workspace override byok + bare model + → and projected.

SOP Checklist

  • Comprehensive testing performed: Full handler test suite passes; new regression test covers the workspace-override + MiniMax restart shape.
  • Local-postgres E2E run: N/A — change is confined to workspace-server Go provision logic; no Postgres handler surface changed.
  • Staging-smoke verified or pending: Local Provision Lifecycle E2E advisory lane exercises the restart path; this fix targets the root cause seen in run 358077.
  • Root-cause not symptom: Root cause is being nil on the billing path, causing the Anthropic-adapter credential projection to skip. Symptom was post-restart 401 / .
  • Five-Axis review walked: Correctness (derives provider only when needed for projection); readability (localized fallback with clear comment); architecture (reuses existing /); security (no new secret exposure, only projects existing workspace secret into adapter env); performance (one extra derive only on the BYOK claude-code projection path when ProviderSelection is missing).
  • No backwards-compat shim / dead code added: No shims. Minimal fallback derivation inside the existing projection block.
  • Memory consulted: No directly applicable prior memory; pattern follows existing effective-model / provider-derivation conventions.
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 - passes (full suite, including new regression test). - New regression test asserts the exact repro shape: workspace override byok + bare model + → and projected. ## SOP Checklist - [x] **Comprehensive testing performed**: Full handler test suite passes; new regression test covers the workspace-override + MiniMax restart shape. - [x] **Local-postgres E2E run**: N/A — change is confined to workspace-server Go provision logic; no Postgres handler surface changed. - [x] **Staging-smoke verified or pending**: Local Provision Lifecycle E2E advisory lane exercises the restart path; this fix targets the root cause seen in run 358077. - [x] **Root-cause not symptom**: Root cause is being nil on the billing path, causing the Anthropic-adapter credential projection to skip. Symptom was post-restart 401 / . - [x] **Five-Axis review walked**: Correctness (derives provider only when needed for projection); readability (localized fallback with clear comment); architecture (reuses existing /); security (no new secret exposure, only projects existing workspace secret into adapter env); performance (one extra derive only on the BYOK claude-code projection path when ProviderSelection is missing). - [x] **No backwards-compat shim / dead code added**: No shims. Minimal fallback derivation inside the existing projection block. - [x] **Memory consulted**: No directly applicable prior memory; pattern follows existing effective-model / provider-derivation conventions.
agent-dev-a added 1 commit 2026-06-13 08:45:27 +00:00
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>
agent-reviewer-cr2 approved these changes 2026-06-13 08:52:03 +00:00
agent-reviewer-cr2 left a comment
Member

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

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
Member

/sop-ack

/sop-ack
devops-engineer merged commit 329eae8dc1 into main 2026-06-13 08:55:19 +00:00
Member

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 projects ANTHROPIC_AUTH_TOKEN and ANTHROPIC_BASE_URL while preserving MINIMAX_API_KEY; no broad billing-mode behavior change beyond missing-provider fallback; no new secret exposure.

/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 projects `ANTHROPIC_AUTH_TOKEN` and `ANTHROPIC_BASE_URL` while preserving `MINIMAX_API_KEY`; no broad billing-mode behavior change beyond missing-provider fallback; no new secret exposure. /sop-ack
Sign in to join this conversation.
No Reviewers
3 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: molecule-ai/molecule-core#2735