Repository navigation
mcpx: paths.config governs the config chain (two-pass, #1842) #2477
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,6 +12,7 @@ import ( | |
| "syscall" | ||
|
|
||
| "github.com/dezren39/mcpx/internal/cli" | ||
| "github.com/dezren39/mcpx/internal/config" | ||
| "github.com/dezren39/mcpx/internal/daemon" | ||
| ) | ||
|
|
||
|
|
@@ -93,6 +94,15 @@ func main() { | |
| case strings.HasPrefix(args[0], "--config="): | ||
| app.ConfigPath = strings.TrimPrefix(args[0], "--config=") | ||
| args = args[1:] | ||
| case args[0] == "--paths-config" && len(args) > 1: | ||
| // A bootstrap flag like --config: it decides which files | ||
| // the settings are read from, so it is captured here, | ||
| // before any settings exist (issue #1842). | ||
| config.SetPathsConfigSeed(splitList(args[1])) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
For Useful? React with 👍 / 👎.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| args = args[2:] | ||
| case strings.HasPrefix(args[0], "--paths-config="): | ||
| config.SetPathsConfigSeed(splitList(strings.TrimPrefix(args[0], "--paths-config="))) | ||
| args = args[1:] | ||
| case args[0] == "--version" || args[0] == "-v": | ||
| fmt.Println("mcpx", version) | ||
| return | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When
--paths-configadds a configuration file and a command needs to auto-start a daemon, the seed exists only in this process'sflagSeed.Connectkeys the expected socket from the expanded configuration, butClient.EnsureDaemon(internal/cli/client.go) forwards only--config, not this seed. Without an equivalentMCPX_PATHS_CONFIGenvironment variable, the child loads the default chain and listens on a different configuration fingerprint, so the client times out waiting for its socket. Propagate the bootstrap seed to the spawned process as well.Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed forward in PR #5165 (issue #2507, commit 2a88cd5): config.PathsConfigSeedEnv() serializes the flag seed as MCPX_PATHS_CONFIG, and the daemon autostart path in internal/cli/client.go now sets it as the child daemon's environment, so an auto-started daemon resolves the same chain as the invoking process. Covered by TestPathsConfigSeedEnvForwardsFlagSeed (internal/config).