fix: resolve YAML env placeholders for API keys and remote shell env
Fixes #12842
Description
Fixes config YAML env placeholder resolution for API keys such as ${env:OPENROUTER_API_KEY}.
Previously, hardcoding an API key in YAML worked, but using ${env:VAR} could fail to resolve in some environments, leading to missing API keys and 401 errors.
This PR makes two focused fixes:
- resolves
${env:VAR}placeholders while converting YAML config into runtime config - adds the same shell-environment fallback for
LocalPlatformClientsecret resolution, which helps in Remote-SSH / remote shell scenarios whereprocess.envmay not contain the expected variable
This is a minimal fix scoped to config/env resolution behavior.
AI Code Review
- Team members only: AI review runs automatically when PR is opened or marked ready for review
- Team members can also trigger a review by commenting
@continue-review
Checklist
- [x] I've read the contributing guide
- [x] The relevant docs, if any, have been updated or created
- [x] The relevant tests, if any, have been updated or created
Screen recording or screenshot
Not included, since this change affects config/env resolution rather than a visible UI flow.
If helpful for review, I can add a short repro note instead:
- hardcoded
apiKeyin YAML works ${env:OPENROUTER_API_KEY}now also works- Remote-SSH/remote shell resolution is covered by the same fallback path
Tests
No automated tests were added in this change.
Manual validation suggested:
- confirm hardcoded
apiKeyin YAML works - confirm
${env:OPENROUTER_API_KEY}works in local setup - confirm
${env:OPENROUTER_API_KEY}works in Remote-SSH / remote shell setup where the variable is available from the user shell
Summary by cubic
Fixes YAML ${env:VAR} resolution across the config (including request options) and adds a shell-environment fallback that preserves multiline values to prevent missing API keys and 401s in local and Remote-SSH setups. Fixes #12842.
- Bug Fixes
- Resolve env placeholders during YAML-to-runtime conversion across all fields, including
requestOptions. - Fallback to the user's login shell when
process.envis missing vars, preserving multiline values and working in Remote-SSH.
- Resolve env placeholders during YAML-to-runtime conversion across all fields, including
Written for commit 1bcea8676f07cfbdc5f46111571fe4a541a64fff. Summary will update on new commits.