Skip to content

fix(daemon): verify IPC for discovery and process management - #221

Open
iuyo5678 wants to merge 1 commit into
mainfrom
fix/daemon-discovery-reliability
Open

fix(daemon): verify IPC for discovery and process management#221
iuyo5678 wants to merge 1 commit into
mainfrom
fix/daemon-discovery-reliability

Conversation

@iuyo5678

Copy link
Copy Markdown
Collaborator

Daemon discovery can reject a reachable daemon when its PID is not visible in the caller’s PID namespace. It can also treat IPC verification failures as a reason to start another instance.

This PR:

  • Shares a bounded IPC status probe across discovery, startup readiness, and doctor. Only missing discovery or missing/refused endpoints permit startup; other failures remain errors.
  • Verifies the kernel-reported IPC peer PID before signaling a process. Protects stale metadata cleanup with the daemon lock and rechecks instance identity.
  • Reuses the stop checks for CLI updates and preserves stopping without a daemon as a no-op.

Addresses the daemon discovery and lifecycle reliability portion of #214. Sandbox process persistence and runtime directory/permission adaptation remain outside this PR.

Validation:

  • Workspace tests run serially: 632 passed.
  • Final daemon-related regression tests: 24 passed.
  • Formatting and strict workspace Clippy checks passed.
  • An intermittent parallel skill-install test failure also reproduced on unmodified main.
  • Linux PID namespace coverage was added but not run on macOS. Changed Windows IPC/probe modules passed an isolated cross-compilation check; Windows runtime behavior remains untested.

Share a bounded IPC status probe across discovery, readiness and doctor.
Do not treat local PID visibility as daemon availability. Only a missing
or refused endpoint permits startup; preserve access, timeout and response
errors, and re-read discovery metadata once across replacement races.

Require the kernel's IPC peer PID before signaling a process. Hold the
daemon lock before stale metadata cleanup, preserve replacement records,
and keep stopping without discovery a no-op. Reuse the same stop checks
for CLI self-update.

Cover unavailable local PIDs, inconsistent replies, permission failures,
timeouts, stale locks, concurrent starts and restart. Include an optional
Linux PID namespace regression. This addresses the reliability portion
of #214; sandbox process persistence and runtime paths remain separate.

Validation: workspace tests pass serially (632 tests); final targeted
regressions pass (24 tests); cargo fmt and strict workspace Clippy pass.
An unrelated parallel skill-install test failure also reproduces on main.
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.

2 participants