Skip to content

Fix/settings json env override warning#211

Open
svd wants to merge 2 commits intocodemie-ai:mainfrom
svd:fix/settings-json-env-override-warning
Open

Fix/settings json env override warning#211
svd wants to merge 2 commits intocodemie-ai:mainfrom
svd:fix/settings-json-env-override-warning

Conversation

@svd
Copy link

@svd svd commented Mar 12, 2026

Summary

Detects when ~/.claude/settings.json contains env entries that silently override the environment variables CodeMie sets at spawn time (e.g. ANTHROPIC_BASE_URL,
ANTHROPIC_AUTH_TOKEN, ANTHROPIC_MODEL). When a conflict is found, a clear warning is printed before Claude launches so users understand why their CodeMie profile
settings are not taking effect.

Changes

  • Added conflict-detection logic to the Claude plugin's beforeRun lifecycle hook that reads ~/.claude/settings.json and compares its env keys against all vars defined in ClaudePluginMetadata.envMapping
  • Emits a user-visible console.warn (yellow, emoji-prefixed) listing each conflicting variable with its value (or REDACTED for sensitive keys), with actionable guidance to remove them
  • Sensitive values are automatically masked for env vars containing: TOKEN, KEY, SECRET, PASSWORD, or AUTH (case-insensitive)
  • Logs the conflict via logger.warn with sanitized args for debug traceability
  • No changes to settings.json are made — the fix is purely informational and non-destructive

Impact

Before: If ~/.claude/settings.json contained "env": { "ANTHROPIC_BASE_URL": "..." }, CodeMie would silently report the correct profile/model while Claude actually
connected to the wrong endpoint — no indication anything was wrong.

After: The user sees this warning before Claude starts:

 ⚠️  Warning: ~/.claude/settings.json contains env vars that will override CodeMie profile settings:
     - ANTHROPIC_AUTH_TOKEN: ***REDACTED***
     - ANTHROPIC_BASE_URL: "https://some-custom-endpoint.example.com"
     These settings.json values take precedence over your CodeMie profile.
     Remove them from ~/.claude/settings.json to allow CodeMie to control these settings.

Checklist

  • Self-reviewed
  • Manual testing performed
  • Documentation updated (if needed)
  • No breaking changes (or clearly documented)

Sviataslau Svirydau and others added 2 commits March 12, 2026 20:23
…e settings

Detect env vars in ~/.claude/settings.json that conflict with CodeMie's
envMapping (ANTHROPIC_BASE_URL, ANTHROPIC_AUTH_TOKEN, ANTHROPIC_MODEL, etc.)
and emit a clear warning before launching claude, so users know why their
CodeMie profile settings are being silently overridden.

Generated with AI

Co-Authored-By: codemie-ai <codemie.ai@gmail.com>
…warning

Prevent credential leakage by masking values for env vars containing:
TOKEN, KEY, SECRET, PASSWORD, AUTH (case-insensitive).

These display as ***REDACTED*** instead of showing the actual value.

Generated with AI

Co-Authored-By: codemie-ai <codemie.ai@gmail.com>
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.

1 participant