fix(providers): expand ${VAR_NAME} brace form in MCP config env vars#1725
Closed
coleam00 wants to merge 3 commits into
Closed
fix(providers): expand ${VAR_NAME} brace form in MCP config env vars#1725coleam00 wants to merge 3 commits into
coleam00 wants to merge 3 commits into
Conversation
…ixes #1612) The regex in expandEnvVarsInRecord only matched $VAR_NAME (bare form), silently passing through ${VAR_NAME} unexpanded. Add alternation to handle both forms, with 4 new tests and updated docs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Hoist URL_FORGE constant to module scope in clone.ts, consistent with FORGE_AUTH and SELF_HOSTED_FORGE which are already module-level. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Document `bun install` requirement for fresh worktrees in CLAUDE.md Running the App in Worktrees section, before `bun dev &`. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
expandEnvVarsInRecordinpackages/providers/src/mcp/config.tsonly expanded$VAR_NAME(bare form). Users who wrote${VAR_NAME}— following shell, Docker Compose, and most MCP server docs — had the literal string passed through unexpanded, silently breaking auth tokens, database URLs, and similar secrets.${VAR_NAME}). Every user who followed those docs had their env-var expansion silently fail.expandEnvVarsInRecordwas replaced with an alternation regex capturing both${VAR}and$VARforms. Four tests added. Docs updated to document both forms.$VAR_NAMEexpansion behavior is identical. No new files, no new imports, no schema changes.UX Journey
Before
After
Architecture Diagram
Before
After
Connection inventory:
expandEnvVarsInRecorddag-executor.test.tsloadMcpConfigmcp-servers.mdLabel Snapshot
risk: lowsize: XSproviders,tests,docsproviders:mcpChange Metadata
bugprovidersLinked Issue
Validation Evidence (required)
bun run validaterun — all six checks greenSecurity Impact (required)
process.env; behavior for missing vars (empty string +missingVarslist) is unchangedCompatibility / Migration
$VAR_NAMEexpansion is unchanged; brace form${VAR_NAME}was previously a no-op (literal passthrough), now it expands correctlyHuman Verification (required)
${FOOwithout closing}— regex does not match either branch, left as-is (safest behavior)Side Effects / Blast Radius (required)
packages/providers/src/mcp/config.ts)${UPPER}, group 2 captures only$UPPERmissingVarsreporting unchangedRollback Plan (required)
packages/providers/src/mcp/config.ts(single-function change)${VAR}strings instead of expanded valuesRisks and Mitigations
AI-Layer Changes (chore commit)
Four process improvements committed in
chore(ai-layer):bun installnote beforebun dev &in the "Running the App in Worktrees" section so fresh-worktree agents don't hit module-resolution failures.bun installprecondition check to Phase 1 LOAD.$BASE_BRANCH..HEAD) and added carry-over file identification to Phase 1 and the review template Stats block.INSERT ANCHORguidance to Task template requiring stable string anchors for code insertion points instead of fragile line numbers.