Skip to content

mcpx daemons: prune dead records, find daemons in other state dirs - #279

Merged
dezren39 merged 3 commits into
mainfrom
creator/278-daemons-discovery
Oct 18, 2026
Merged

dezren39 merged 3 commits into
mainfrom
creator/278-daemons-discovery

Conversation

@dezren39

@dezren39 dezren39 commented Oct 18, 2026 •

Copy link
Copy Markdown
Member

Fixes #278 — ports dezren39/nix PR #381 (the fix for dezren39/darwin-nix#369) to this repo's pkgs/mcpx copy, whose pre-fix files were verified byte-identical to nix's pre-fix versions (issue references re-pointed to #278).

  • PruneStale: daemon records whose process is gone are removed from disk and from the listing; a killed daemon no longer shows forever with RUNNING false. ProcessAlive mirrors pool.keyPIDAlive (signal 0, EPERM counts as alive); records with no pid are kept.
  • Mirror records: a daemon in a custom state directory mirrors its record into the default state directory (WriteInfo/RemoveInfo), and mcpx daemons and stop --all search both directories, deduped by socket.
  • paths.config warning: entries that name a file now warn in adoptSettings, naming --config/MCPX_CONFIG, instead of being silently ignored; paths.config leaves the settings consumed-test allowlist.
  • docs/parity.md regenerated for the daemons help text.

Verification:

  • New daemon tests for ProcessAlive, PruneStale and the mirror; full internal/daemon, internal/settings and internal/cli suites pass; go build ./... and go vet clean.
  • Ablation: neutering PruneStale makes the new prune test fail; restored it passes.
  • End-to-end with a built binary: a dead record is pruned by mcpx daemons (file removed); a daemon started in a custom state dir writes a mirror into the default dir, is listed and stopped from a third state dir, and shutdown removes both records; the paths.config file-entry warning fires where the pre-fix binary stayed silent.

Summary by CodeRabbit

  • New Features
    • The daemons command now finds daemon records across the machine, including daemons using custom state directories. Records are mirrored to the default location, so these daemons are included in listings and stop-all operations.
  • Bug Fixes
    • Stale records for exited daemon processes are pruned, and daemon records are removed from both locations when applicable.
    • A warning now appears when a paths.config entry points to a file instead of a directory, with guidance on other configuration options.

…ixes #278)

Port of dezren39/nix PR #381 (fix for dezren39/darwin-nix#369), whose pre-fix
files were byte-identical to this repo's pkgs/mcpx copies; issue
references re-pointed to #278.

- PruneStale: daemon records whose process is gone are removed from
  disk and from the listing; a killed daemon no longer shows forever
  with RUNNING false. ProcessAlive mirrors pool.keyPIDAlive (signal 0,
  EPERM counts as alive); records with no pid are kept.
- A daemon in a custom state directory mirrors its record into the
  default state directory (WriteInfo/RemoveInfo), and 'mcpx daemons'
  and 'stop --all' search both directories, deduped by socket. The
  help promise 'every daemon on this machine' now holds for daemons
  started after this change.
- paths.config entries that name a file now warn in adoptSettings,
  naming --config/MCPX_CONFIG as the way to pick a file, instead of
  being silently ignored. paths.config leaves the settings
  consumed-test allowlist accordingly.
- Regenerate docs/parity.md for the daemons help text.

Tests: new daemon tests for ProcessAlive, PruneStale and the mirror;
full internal/daemon, internal/settings and internal/cli suites pass.
Verified end-to-end with a built binary: a dead record is pruned by
'mcpx daemons', a custom-state daemon's mirror is listed and stopped
from another state dir, and the paths.config warning fires where the
pre-fix binary stayed silent.
@dezren39
dezren39 requested a review from a team as a code owner October 18, 2026 11:40
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-18T11:40:44.754062Z bd515c5 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: fb46dfc2-c854-427b-9c6c-4efd069f523a
📥 Commits

Reviewing files that changed from the base of the PR and between 584d869 and efea2d0.

📒 Files selected for processing: 9
  • pkgs/mcpx/docs/parity.md
  • pkgs/mcpx/internal/cli/commands.go
  • pkgs/mcpx/internal/cli/manual.go
  • pkgs/mcpx/internal/cli/root.go
  • pkgs/mcpx/internal/daemon/paths.go
  • pkgs/mcpx/internal/daemon/paths_test.go
  • pkgs/mcpx/internal/daemon/server.go
  • pkgs/mcpx/internal/settings/consumed_test.go
  • treefmt.toml
+--------------------------------------------+
| Forcing bugs to surrender unconditionally. |
+--------------------------------------------+
  \
   \     /)/)
        ( '')
        /  |
      o(___)
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

Muse Sweep added 2 commits October 18, 2026 06:45
Two formatting traps this change trips over, both pre-existing on main:

- manual.go had a struct field misaligned by one space; treefmt checks
  whole changed files, so touching the file surfaces it. gofmt only.
- docs/parity.md is generated, and TestParityDocumentIsCurrent compares
  it byte-for-byte with the generator's output. Prettier (treefmt's md
  formatter) pads its tables, which the test can never accept -- main's
  parity.md was already prettier-dirty for this reason, and any PR
  regenerating it would fail one check or the other. Exclude the one
  generated file from treefmt, like pkgs/id and pkgs/dht already are.
@dezren39
dezren39 merged commit 469c749 into main Oct 18, 2026
25 of 27 checks passed
@dezren39
dezren39 deleted the creator/278-daemons-discovery branch October 18, 2026 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mcpx daemons: dead records listed forever, custom-state daemons missed, paths.config file entry silently ignored

1 participant