fix(env): preserve CLAUDE_CODE_USE_FOUNDRY through the SDK env sanitizer#3166
Open
jimweller wants to merge 1 commit into
Open
fix(env): preserve CLAUDE_CODE_USE_FOUNDRY through the SDK env sanitizer#3166jimweller wants to merge 1 commit into
jimweller wants to merge 1 commit into
Conversation
The supervisor env sanitizer strips all CLAUDE_CODE_* / CLAUDECODE_* vars except those in ENV_PRESERVE. CLAUDE_CODE_USE_FOUNDRY selects the Microsoft Foundry provider for the spawned SDK subprocess, exactly as CLAUDE_CODE_USE_BEDROCK and CLAUDE_CODE_USE_VERTEX already do. Without preserving it, Foundry-backed installs lose provider selection when claude-mem spawns the SDK, breaking observation capture. Adds the var to ENV_PRESERVE alongside the sibling provider selectors, with matching tests (dedicated case + selective-preserve assertion).
Contributor
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
sanitizeEnv(src/supervisor/env-sanitizer.ts) strips everyCLAUDE_CODE_*/CLAUDECODE_*variable before the SDK subprocess is spawned, unless the name is inENV_PRESERVE. The provider selectorsCLAUDE_CODE_USE_BEDROCKandCLAUDE_CODE_USE_VERTEXare already preserved;CLAUDE_CODE_USE_FOUNDRY(Microsoft Foundry) is not, so it gets stripped and the subprocess loses provider selection on Foundry-backed installs.This adds
CLAUDE_CODE_USE_FOUNDRYtoENV_PRESERVE, alongside the sibling selectors.Why
Foundry users set
CLAUDE_CODE_USE_FOUNDRY=1the same way Bedrock/Vertex users set their selector. Without preservation, the observer/worker SDK subprocess cannot reach the Foundry endpoint and observation capture breaks. This is parity with the existing Bedrock/Vertex handling, not a new mechanism.Changes
src/supervisor/env-sanitizer.ts: addCLAUDE_CODE_USE_FOUNDRYtoENV_PRESERVEtests/supervisor/env-sanitizer.test.ts: dedicated preserve test plus an assertion in the selective-preserve testSafety
BLOCKED_ENV_VARSinEnvManager.ts) is unchanged; no credential or effort var is affected.CLAUDE_CODE_EFFORT_LEVEL/CLAUDE_CODE_ALWAYS_ENABLE_EFFORTstrip is untouched.Test
bun test tests/supervisor/env-sanitizer.test.ts-> 12 pass / 0 fail.