Skip to content

fix(mcpx): treat EPERM as alive in pool keyPIDAlive (#2336) - #4149

Merged
dezren39 merged 1 commit into
mainfrom
queue/5270-2336-keypidalive-eperm
Nov 2, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/5270-2336-keypidalive-eperm

Conversation

@dezren39

@dezren39 dezren39 commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

Fixes #2336.

keyPIDAlive in pkgs/mcpx/internal/pool/pool.go returned proc.Signal(syscall.Signal(0)) == nil, so an EPERM pid — a live process owned by another user — read as dead. The reaper, the execwatch replaceable path, and Restart's "owning process has exited" skip all acted on that wrong answer: live foreign-owned callers' pid-scoped instances were reaped, never replaced, and skipped on restart.

Change (pool-local, per triage task 3497's pinned shape)

  • keyPIDAlive now delegates to keyPIDAliveProbed(key, signalProcess): a probe error that errors.Is(err, syscall.EPERM) means alive, mirroring daemon.ProcessAlive (pkgs/mcpx/internal/daemon/paths.go); any other error (ESRCH above all) means dead. Unparseable keys still read as alive.
  • The signal-0 probe is an injected seam (signalProcess / keyPIDAliveProbed), not a global fake, so tests are deterministic. No change to daemon.ProcessAlive / PruneStale, pid-scope key production, or X-Mcpx-Pid intake.
  • Restart consequence: an EPERM-only pid is now alive at the Restart skip check, so it no longer reports "owning process has exited" for it.

Tests

New pkgs/mcpx/internal/pool/keypidalive_test.go (internal package, like the existing oauthwait_test.go):

  • probe nil → alive; EPERM → alive; wrapped EPERM → alive; ESRCH → dead; other error → dead; unparseable key (global, pid:abc) → alive
  • real-probe self test: own pid reads alive

Verified on the laptop: go test ./internal/pool/ -run TestKeyPIDAlive -v — all pass; full go test ./internal/pool/ -count=1 — PASS (52.8s). gofmt/go vet clean.

Queue: task 5270 (triage: task 3497).


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

@dezren39
dezren39 requested a review from a team as a code owner November 2, 2026 03:16
@coderabbitai

coderabbitai Bot commented Nov 2, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 57 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f3c9182c-b6d0-4a3d-94d9-d5ee6b93ad20
Commits

Reviewing files that changed from the base of the PR and between ac77716 and c78d8c5.

Files selected for processing: 2
  • pkgs/mcpx/internal/pool/keypidalive_test.go
  • pkgs/mcpx/internal/pool/pool.go
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 2, 2026 •

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 ✅ Completed 2026-11-02T03:17:41.858339Z c78d8c5 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant