fix(mcp): honor CONFIG_PATH env var instead of clobbering it with the --config default (#1736) - #1737
Open
Anai-Guo wants to merge 1 commit into
Open
fix(mcp): honor CONFIG_PATH env var instead of clobbering it with the --config default (#1736)#1737Anai-Guo wants to merge 1 commit into
Anai-Guo wants to merge 1 commit into
Conversation
… --config default (getzep#1736) The --config CLI argument carried a non-empty Path default, which argparse populates on every run even when the flag is not passed. The startup code then unconditionally did os.environ['CONFIG_PATH'] = str(args.config), so the bundled demo config path always overwrote whatever CONFIG_PATH the deployment environment set, before GraphitiConfig() read it. The documented CONFIG_PATH env-var pattern for container deployments therefore never took effect, silently. Change the flag default to None and only write CONFIG_PATH when --config was actually passed; otherwise fall back to the bundled default only if CONFIG_PATH is not already set in the environment. Precedence is now: explicit --config > CONFIG_PATH env var > bundled default, preserving the previous no-argument behavior while restoring the env-var path.
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
Fixes #1736. The documented
CONFIG_PATHenv-var pattern for pointing the MCP server at a customconfig.yamlin container deployments was silently ignored on every boot.Root cause
The
--configCLI argument carried a non-emptyPathdefault:Since that default is always truthy,
args.configis populated even when--configis never passed. The startup code then ran unconditionally:so the bundled demo config path always overwrote whatever
CONFIG_PATHthe deployment environment had set, beforeGraphitiConfig()(and itsYamlSettingsSource, which readsos.environ.get('CONFIG_PATH', 'config/config.yaml')) ever ran. Net effect: the env-var path never took effect, with no error or warning.Fix
--configdefault toNoneso an explicitly-passed flag can be distinguished from the default.CONFIG_PATHwhen--configwas actually passed; otherwise fall back to the bundled default only ifCONFIG_PATHis not already set in the environment.Precedence is now: explicit
--config>CONFIG_PATHenv var > bundled default. This restores the documented env-var behavior while preserving the previous no-argument default (the bundled absolute path), so nothing regresses for users who rely on neither.Testing
python -m astparse check on the modified module.config/schema.py:303(os.environ.get('CONFIG_PATH', 'config/config.yaml')).🤖 Generated with Claude Code