Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@spanishflu-est1918
Copy link
Contributor

Summary

  • Fixes config loading order so env section values are available during ${VAR} substitution
  • Previously, resolveConfigEnvVars() ran before applyConfigEnv(), causing "Missing env var" errors for vars defined in config

Problem

When config has:

{
  "env": { "MINIMAX_API_KEY": "sk-..." },
  "models": {
    "providers": {
      "minimax": { "apiKey": "${MINIMAX_API_KEY}" }
    }
  }
}

The substitution failed because the env section wasn't applied to process.env yet.

Test plan

  • Verified fix resolves the error locally
  • Build passes

The config loading was calling resolveConfigEnvVars() before applyConfigEnv(),
so environment variables defined in the config's `env` section weren't available
when ${VAR} references were being substituted.

This caused errors like "Missing env var MINIMAX_API_KEY" when the key was
defined in config.env but referenced via ${MINIMAX_API_KEY} in provider config.

Fix by calling applyConfigEnv() immediately after resolving $include directives,
before the env var substitution pass.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
thewilloftheshadow added a commit that referenced this pull request Jan 26, 2026
@thewilloftheshadow
Copy link
Member

Squash-merged into main.

  • Squash commit: 1b598ad
  • Included: apply config.env before env-var substitution + changelog entry (thanks)
  • Tests: pnpm lint && pnpm build && pnpm test (lint failed in existing src/line/* types)

@thewilloftheshadow
Copy link
Member

Closed after squash-merge to main (commit 1b598ad).

steipete pushed a commit to mertcicekci0/clawdbot that referenced this pull request Jan 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants