You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
mcpx: daemon discovery and mirroring ignore MCPX_STATE_DIR — env-default daemon missed by custom listings and its record leaks into the real default dir #305
mcpx daemon discovery and mirroring ignore MCPX_STATE_DIR in this repo's pkgs/mcpx copy — the same defect fixed in dezren39/nix as #407 (PR #410), never ported here.
ResolvePaths honours MCPX_STATE_DIRfirst (pkgs/mcpx/internal/daemon/paths.go:39), so the daemon a plain invocation talks to lives in the env-named directory. But the two places that need to know that treat only the XDG default as "default":
DaemonSearchDirs(primary) (paths.go:248) returns only [primary, DefaultStateDir()]. A listing (mcpx daemons, mcpx stop --all — internal/cli/commands.go:1553) whose own state came from a config file or --paths-state flag therefore never searches the env directory.
mirrorInfoPath() (paths.go:308) returns a mirror path for the env directory, because it only exempts p.State == DefaultStateDir(). The env-default daemon — e.g. a sandboxed daemon whose MCPX_STATE_DIR points inside a sandbox/temp tree — therefore mirrors its record into the real XDG default directory, where a non-sandboxed listing can see it and stop it. That is exactly the leak mirroring was supposed to avoid for default daemons.
TestWriteInfoDoesNotMirrorTheEnvDefaultDaemon — FAIL: env-default daemon leaked a mirror into the default dir: [{PID:… Socket:<envDir>/daemon.sock …}] — a Paths{State: def}.ListDaemons() in the XDG default returns the env daemon's record.
Both tests pass in dezren39/nix on the fixed code.
Why it matters
Sandboxed / test daemons (the primary use of MCPX_STATE_DIR — see ResolvePaths' own comment: "for tests and sandboxes") leak into the user's real daemon listing and can be stopped by an unrelated non-sandboxed mcpx stop --all.
DaemonSearchDirs also includes the MCPX_STATE_DIR directory (deduplicated; empty when unset).
A daemon whose state directory is the MCPX_STATE_DIR directory does not mirror its record into the XDG default directory; a genuinely custom state directory still mirrors, env set or not.
Activity
Merge pull request #387 from developing-today/creator/386-roadmap-done