Title: mcpx daemons: dead records listed forever, custom-state daemons missed, paths.config file entry silently ignored · Issue #278 · developing-today/code · GitHub
Open Graph Title: mcpx daemons: dead records listed forever, custom-state daemons missed, paths.config file entry silently ignored · Issue #278 · developing-today/code
X Title: mcpx daemons: dead records listed forever, custom-state daemons missed, paths.config file entry silently ignored · Issue #278 · developing-today/code
Description: Summary mcpx daemons promises "every daemon on this machine" (internal/cli/manual.go), but daemon discovery in this repo's pkgs/mcpx copy has three defects. All three were found and fixed in dezren39/darwin-nix#369 (PR dezren39/darwin-ni...
Open Graph Description: Summary mcpx daemons promises "every daemon on this machine" (internal/cli/manual.go), but daemon discovery in this repo's pkgs/mcpx copy has three defects. All three were found and fixed in dezren...
X Description: Summary mcpx daemons promises "every daemon on this machine" (internal/cli/manual.go), but daemon discovery in this repo's pkgs/mcpx copy has three defects. All three were found and f...
Opengraph URL: https://github.com/developing-today/code/issues/278
X: @github
Domain: github.com
IPv4 address: 140.82.113.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"mcpx daemons: dead records listed forever, custom-state daemons missed, paths.config file entry silently ignored","articleBody":"## Summary\n\n`mcpx daemons` promises \"every daemon on this machine\" (internal/cli/manual.go), but daemon discovery in this repo's `pkgs/mcpx` copy has three defects. All three were found and fixed in dezren39/nix#369 (PR dezren39/nix#381); the fix was never ported to this copy. The pre-fix files here are byte-identical to dezren39/nix's pre-fix versions (verified: `internal/daemon/paths.go`, `paths_test.go`, `server.go`, `internal/cli/manual.go`, `internal/settings/consumed_test.go`, `docs/parity.md`; `commands.go`/`root.go` differ only by this repo's already-ported #265/#274/#276 fixes, in unrelated hunks).\n\n## Defects (verified on main 584d8694)\n\n1. **Dead daemons are listed forever.** `Paths.ListDaemons` (internal/daemon/paths.go:229) returns every `daemon*.json` record in the state dir with no liveness check, and nothing ever removes a record whose daemon was killed or crashed (a clean exit removes its own record at server.go:488/1158; a killed one cannot). Reproduced with a binary built from main: a record with a dead PID is listed by `mcpx daemons` as `RUNNING false`, and the record file is still on disk after repeated listings. `stop --all` iterates the same stale records.\n\n2. **Daemons with their own state directory are invisible.** A daemon started with a custom state dir (`paths.state` in config, `--paths-state`, or `MCPX_STATE_DIR`) writes its record only there (`WriteInfo`, paths.go:284). `ListDaemons` scans only the caller's own state dir, so a normal `mcpx daemons` / `stop --all` never sees it. Reproduced: a live record placed only in a second state dir is listed from that dir but not from the first.\n\n3. **A `paths.config` entry naming a file is silently ignored.** The entries are directories searched for config files; pointing one at a file (a natural reading of the setting) silently loads the default config instead. `adoptSettings` (internal/cli/root.go:195) never inspects the entries, and `internal/settings/consumed_test.go` keeps `paths.config` on the unread-allowlist as \"circular by construction\".\n\n## Suggested fix (mirror dezren39/nix PR #381)\n\n- `Paths.PruneStale()`: remove records whose PID is gone (signal-0 liveness, EPERM = alive; pid-less records kept); `mcpx daemons` and `stop --all` prune before listing.\n- Mirror records: `WriteInfo` also publishes the record into the default state dir (keyed name, best-effort) when the daemon's state dir is custom; new `RemoveInfo()` removes primary + mirror and replaces the two `os.Remove(s.paths.Info)` calls in server.go. Listings search the caller's dir + the default dir, deduped by socket.\n- `adoptSettings` warns once when a `paths.config` entry names a file, naming `--config`/`MCPX_CONFIG` as the way to pick a file; `paths.config` leaves the consumed-test allowlist.\n- Update the `daemons` entry in internal/cli/manual.go and regenerate docs/parity.md.\n\n## Acceptance criteria\n\n- A daemon record with a dead PID no longer appears in `mcpx daemons` output and its file is removed; records with a live PID or no PID are untouched.\n- A daemon started in a custom state dir appears in a default-state-dir `mcpx daemons` listing (and `stop --all` reaches it), exactly once.\n- A `paths.config` entry naming a file produces one stderr warning naming `--config`/`MCPX_CONFIG`; directory entries stay silent.\n- New daemon tests cover ProcessAlive/PruneStale/mirroring; `go test ./internal/daemon/ ./internal/settings/ ./internal/cli/` passes.\n","author":{"url":"https://github.com/dezren39","@type":"Person","name":"dezren39"},"datePublished":"2026-10-18T11:33:31Z","url":"https://github.com/developing-today/code/issues/278"}
| 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:cdfa1e95-9fa9-092d-6fee-deb941270eb4 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CD36:1B0DA8:82D806:AAA12F:6B062C69 |
| html-safe-nonce | f73fd84d95a65428bc6c9ac918b8436f4b8922ded176d4505a1a8401406f390c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRDM2OjFCMERBODo4MkQ4MDY6QUFBMTJGOjZCMDYyQzY5IiwidmlzaXRvcl9pZCI6IjYwNTE1MjkwMzU0Njc4NjEwOTciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 959a5bc9c127c3afb876776b259d53d61b46b2d060e80dadfa501b554d8b372e |
| hovercard-subject-tag | issue:5909079311 |
| 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/278/issue_layout |
| twitter:image | https://opengraph.githubassets.com/862868bd0d63272217bccb079a92ab462e59bf275736c2c09095a08a34a6573c/developing-today/code/issues/278 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/862868bd0d63272217bccb079a92ab462e59bf275736c2c09095a08a34a6573c/developing-today/code/issues/278 |
| og:image:alt | Summary mcpx daemons promises "every daemon on this machine" (internal/cli/manual.go), but daemon discovery in this repo's pkgs/mcpx copy has three defects. All three were found and fixed in dezren... |
| 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 | 7f961de5dd5c5d4aca24d33f8b3ffb3fb8b2ef53d0a4f32f01f0a790e512f6d3 |
| 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 | 494ea0bb1e0feef734a83e2628697647755e8864 |
| 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