fix: forward ENABLE_OPENAI_CUSTOM_PROVIDER to container env#81
Conversation
Worker env vars are not automatically inherited by the container process. ENABLE_OPENAI_CUSTOM_PROVIDER and OPENAI_CUSTOM_REQUIRE_WSS were missing from buildContainerEnvVars() and env.d.ts, so the openai_custom provider was always unavailable regardless of the Worker setting. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
PR ReviewSummary: Clean, minimal fix for a real bug — CorrectnessThe defaults in
The OrderingThe two vars appear between Pre-existing unrelated issue (out of scope for this PR)While reviewing the surrounding context I noticed that VerdictLGTM. The fix is correct, the defaults are right, and no tests are needed for this type of env-forwarding wiring. The test plan in the PR description is appropriate. |
Summary
ENABLE_OPENAI_CUSTOM_PROVIDERandOPENAI_CUSTOM_REQUIRE_WSSwere missing frombuildContainerEnvVars()inworker/index.ts, so they were never forwarded to the container processworker/env.d.ts(Worker type declarations) andbuildContainerEnvVars()(container env forwarding)Root cause
Worker environment variables are not automatically inherited by the container — they must be explicitly passed via
buildContainerEnvVars(). SettingENABLE_OPENAI_CUSTOM_PROVIDER=truein the CF dashboard had no effect because the container never received it.Test plan
ENABLE_OPENAI_CUSTOM_PROVIDER=truein CF Worker settings?provider=openai_custom— should no longer get "Provider 'openai_custom' is not available"🤖 Generated with Claude Code