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
fix(workspace): project Anthropic adapter creds for BYOK MiniMax on restart with workspace override (core#2712)
CI / Python Lint & Test (pull_request) Successful in 5s
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 7s
Harness Replays / detect-changes (pull_request) Successful in 6s
Lint forbidden tenant-env keys / Scan for repo-host token write into tenant workspace surface (pull_request) Successful in 5s
Lint forbidden tenant-env keys / Scan workspace_secrets writers for forbidden env keys (pull_request) Successful in 5s
E2E Peer Visibility (literal MCP list_peers) / detect-changes (pull_request) Successful in 10s
sop-checklist / review-refire (pull_request_target) Has been skipped
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 6s
Harness Replays / Harness Replays (pull_request) Successful in 2s
CI / Detect changes (pull_request) Successful in 16s
E2E Peer Visibility (literal MCP list_peers) / E2E Peer Visibility (local) (pull_request) Has been skipped
reserved-path-review / reserved-path-review (pull_request_target) Successful in 7s
E2E API Smoke Test / detect-changes (pull_request) Successful in 17s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 16s
E2E Peer Visibility (literal MCP list_peers) / E2E Peer Visibility (pull_request) Successful in 5s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 1s
CI / Canvas (Next.js) (pull_request) Successful in 3s
gate-check-v3 / gate-check (pull_request_target) Failing after 12s
sop-checklist / all-items-acked (pull_request_target) Successful in 8s
E2E Chat / detect-changes (pull_request) Successful in 20s
CI / Canvas Deploy Status (pull_request) Successful in 1s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 3s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 20s
lint-required-no-paths / lint-required-no-paths (pull_request) Successful in 17s
E2E Chat / E2E Chat (pull_request) Successful in 4s
Local Provision Lifecycle E2E / Local Provision Lifecycle E2E (stub) (pull_request) Successful in 28s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Successful in 42s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 2m35s
CI / Platform (Go) (pull_request) Successful in 2m41s
CI / all-required (pull_request) Successful in 4s
Local Provision Lifecycle E2E / Local Provision Lifecycle E2E (real image + MiniMax LLM, advisory) (pull_request) Failing after 4m35s
reserved-path-review / reserved-path-review (pull_request_review) Successful in 7s
qa-review / approved (pull_request_target) Approved via pull_request_review trigger
qa-review / approved (pull_request_review) Successful in 9s
sop-checklist / all-items-acked (pull_request) acked: 0/7 — missing: comprehensive-testing, local-postgres-e2e, staging-smoke, +4
security-review / approved (pull_request_target) Approved via pull_request_review trigger
sop-checklist / na-declarations (pull_request) N/A: (none)
security-review / approved (pull_request_review) Successful in 9s
E2E Staging SaaS (full lifecycle) / pr-validate (pull_request) Has been cancelled
E2E Staging SaaS (full lifecycle) / E2E Staging SaaS (pull_request) Has been cancelled
E2E Staging SaaS (full lifecycle) / E2E Staging Platform Boot (pull_request) Has been cancelled
E2E Staging SaaS (full lifecycle) / E2E Staging Concierge user_tasks (pull_request) Has been cancelled
E2E Staging SaaS (full lifecycle) / E2E Staging Workspace Requests (core#2606) (pull_request) Has been cancelled
E2E Staging SaaS (full lifecycle) / E2E Staging Concierge Creates Workspace (pull_request) Has been cancelled
E2E Staging SaaS (full lifecycle) / E2E Staging Concierge (compile+skip) (pull_request) Has been cancelled
E2E Staging SaaS (full lifecycle) / E2E Staging Concierge Platform Agent (pull_request) Has been cancelled
audit-force-merge / audit (pull_request_target) Successful in 7s
3b68bd6dfd
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