a573066543
_redact_env already skips redaction when a KEY=value assignment's value is a programmatic env lookup (os.getenv(...), os.environ[...], process.env.X) per issue #2852 — masking it would corrupt a code snippet, not redact a secret. _redact_json (JSON "key": "value" syntax) and _redact_yaml (unquoted key: value syntax) are separate closures in the same function and never got the same check, so the identical code-snippet-in-config- syntax case still gets mangled: {"apiKey": "os.getenv('OPENAI_API_KEY')"} -> {"apiKey": "os.get...EY')"} api_key: os.getenv("OPENAI_API_KEY") -> api_key: os.get...EY") Fix: apply the same _ENV_LOOKUP_VALUE_RE.match(value) check in both closures before masking, mirroring _redact_env exactly. Real secret values in JSON/YAML syntax are still redacted (verified live and via new tests) — this only skips the case where the "value" already look like a code snippet.