Skip to content

fix: merge platform_overrides env with base env instead of replacing#221

Open
bryan-anthropic wants to merge 1 commit intomainfrom
fix/platform-overrides-env-merge
Open

fix: merge platform_overrides env with base env instead of replacing#221
bryan-anthropic wants to merge 1 commit intomainfrom
fix/platform-overrides-env-merge

Conversation

@bryan-anthropic
Copy link
Collaborator

Summary

  • platform_overrides.*.env was replacing the entire mcp_config.env object instead of merging, causing base env vars (including ${user_config.*} references) to be silently dropped when platform overrides defined any env vars.
  • One-line fix: changed result.env = platformConfig.env || result.env to spread-merge { ...result.env, ...platformConfig.env }, so platform-specific env vars augment the base env rather than replacing it.
  • Added test case covering the merge behavior with both base env vars and platform override env vars.

Root Cause

In src/shared/config.ts:120, the platform override logic used simple assignment:

result.env = platformConfig.env || result.env;

When a manifest defines both mcp_config.env (e.g., LOCKSTEP_DATA_DIR: "${user_config.data_directory}") and platform_overrides.darwin.env (e.g., PATH: "..."), the darwin env completely replaced the base env, silently dropping LOCKSTEP_DATA_DIR.

This made it appear that ${user_config.*} interpolation was broken, but the variable was actually being resolved correctly — just discarded before it could reach the spawned process.

Test plan

  • New test: platform override env merges with base env (preserves DATA_DIR, EXISTING_VAR, adds PATH)
  • All 220 existing tests pass
  • Verified with reporter's exact manifest structure — both LOCKSTEP_DATA_DIR and PATH now resolve correctly

Fixes #217

🤖 Generated with Claude Code

platform_overrides.*.env was replacing the entire mcp_config.env object
instead of merging, causing base env vars (including ${user_config.*}
references) to be silently dropped when platform overrides defined any
env vars.

Fixes #217

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link

@claude claude bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Code review skipped — your organization's overage spend limit has been reached.

Code review is billed via overage credits. To resume reviews, an organization admin can raise the monthly limit in Settings → Usage.

Once credits are available, reopen this pull request to trigger a review.

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.

User Config Interpolation

1 participant