Title: 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 · Issue #305 · developing-today/code · GitHub
Open Graph Title: 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 · Issue #305 · developing-today/code
X Title: 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 · Issue #305 · developing-today/code
Description: Summary 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_DIR first (pkgs/mcpx/internal/d...
Open Graph Description: Summary 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 MC...
X Description: Summary 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 honour...
Opengraph URL: https://github.com/developing-today/code/issues/305
X: @github
Domain: github.com
IPv4 address: 140.82.113.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"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","articleBody":"## Summary\n`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.\n\n`ResolvePaths` honours `MCPX_STATE_DIR` **first** (`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\":\n\n1. **`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.\n2. **`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.\n\n## Reproduction (verified on main 8fc1fb32)\nPorted dezren39/nix PR #410's two regression tests to this copy, unmodified otherwise:\n\n- `TestDaemonSearchDirsIncludesTheEnvStateDir` — **FAIL**: `DaemonSearchDirs(custom) = [custom, \u003cxdg>/mcpx]`, missing the `MCPX_STATE_DIR` directory entirely.\n- `TestWriteInfoDoesNotMirrorTheEnvDefaultDaemon` — **FAIL**: `env-default daemon leaked a mirror into the default dir: [{PID:… Socket:\u003cenvDir>/daemon.sock …}]` — a `Paths{State: def}.ListDaemons()` in the XDG default returns the env daemon's record.\n\nBoth tests pass in dezren39/nix on the fixed code.\n\n## Why it matters\n- 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`.\n- Conversely, a custom-state listing can miss the machine's actual default (env) daemon, undermining the `mcpx daemons` \"every daemon on the machine\" promise established in #278.\n\n## Acceptance criteria\n- `DaemonSearchDirs` also includes the `MCPX_STATE_DIR` directory (deduplicated; empty when unset).\n- 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.\n- Regression tests equivalent to dezren39/nix PR #410's `TestDaemonSearchDirsIncludesTheEnvStateDir` and `TestWriteInfoDoesNotMirrorTheEnvDefaultDaemon` pass; the existing `internal/daemon` suite stays green.\n- Suggested fix: port dezren39/nix PR #410 (`envStateDir()` helper in `paths.go` + the two tests) — the surrounding code in this copy is identical except issue-number comments (#278 here vs #369 there).\n","author":{"url":"https://github.com/dezren39","@type":"Person","name":"dezren39"},"datePublished":"2026-10-18T19:36:50Z","url":"https://github.com/developing-today/code/issues/305"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:f3043f3c-b2a8-754e-5aa9-775f03350a9f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D500:3F83D3:AF9FFA:E3334B:6B0638F1 |
| html-safe-nonce | 15397956f73ea2df6f1becce3d0649f3a2fe38025b8eb3890884fd519699ea82 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENTAwOjNGODNEMzpBRjlGRkE6RTMzMzRCOjZCMDYzOEYxIiwidmlzaXRvcl9pZCI6IjkwNDQ2MzE2NTc0NTc3OTMyNjYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 2b8bc6c81ce9a6d925cfa8ced7409a511be7c96396311184adf7582c18f359c5 |
| hovercard-subject-tag | issue:5913364461 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/developing-today/code/305/issue_layout |
| twitter:image | https://opengraph.githubassets.com/04140a13cb7d71b18651c04ccd1bf7ec989cfd422d3188dd9b02e2d7d60ea20d/developing-today/code/issues/305 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/04140a13cb7d71b18651c04ccd1bf7ec989cfd422d3188dd9b02e2d7d60ea20d/developing-today/code/issues/305 |
| og:image:alt | Summary 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 MC... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dezren39 |
| hostname | github.com |
| expected-hostname | github.com |
| None | dcf72c457c022486d23c3cbb0dd21aba537a87611ca9ddabd1799cf2eaa9b297 |
| turbo-cache-control | no-preview |
| go-import | github.com/developing-today/code git https://github.com/developing-today/code.git |
| octolytics-dimension-user_id | 26439447 |
| octolytics-dimension-user_login | developing-today |
| octolytics-dimension-repository_id | 627308783 |
| octolytics-dimension-repository_nwo | developing-today/code |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 627308783 |
| octolytics-dimension-repository_network_root_nwo | developing-today/code |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 0f38f5735226749ec5e08a8649dce4cb2613d9ad |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width