CLI: fix gateway restart health ownership for child listener pids#24696
Merged
gumadeiras merged 3 commits intomainfrom Feb 23, 2026
Merged
CLI: fix gateway restart health ownership for child listener pids#24696gumadeiras merged 3 commits intomainfrom
gumadeiras merged 3 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug in gateway restart health checks where the service could falsely report stale processes when using parent/child process models (common with launchd and systemd). The fix adds parent PID tracking to distinguish legitimately owned child listener processes from truly stale ones.
Changes:
- Add ppid (parent process ID) field to PortListener type for tracking process parent relationships
- Capture ppid during Unix port inspection via
ps -o ppid=command - Update restart health ownership checks to recognize child processes (listener.ppid === runtime.pid) as owned
- Add regression tests for child-owned vs non-owned listener scenarios
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/infra/ports-types.ts | Adds optional ppid field to PortListener type |
| src/infra/ports-inspect.ts | Implements resolveUnixParentPid function and integrates ppid lookup into listener inspection |
| src/cli/daemon-cli/restart-health.ts | Adds listenerOwnedByRuntimePid helper and updates ownership/stale detection logic to check both pid and ppid |
| src/cli/daemon-cli/restart-health.test.ts | Adds tests verifying child-owned listeners are healthy and non-owned listeners are marked stale |
d246b9c to
d6d4b43
Compare
Member
Author
|
Merged via squash. Thanks @gumadeiras! |
iamjulio
pushed a commit
to NeuroGym-Dev/openclaw
that referenced
this pull request
Feb 23, 2026
* upstream/main: (1467 commits) fix(doctor): use gateway health status for memory search key check (openclaw#22327) refactor: harden reset notice + cron delivery target flow refactor(exec): simplify env-prefixed wrapper modifier check fix(skills): support multiline frontmatter fallback without PyYAML fix(skills): make quick_validate work without PyYAML fix(exec): bind env-prefixed shell wrappers to full approval text fix(browser): derive relay auth token from gateway token in Chrome extension Browser relay: accept raw gateway token in extension auth fix(gateway): include platform and reason in node command rejection error CLI: fix gateway restart health ownership for child listener pids (openclaw#24696) docs: detail per-agent prompt caching configuration fix(config): tighten bedrock cache-retention type narrowing feat(agents): add per-agent stream params overrides for cache tuning (openclaw#17470) (thanks @rrenamed) fix(providers): support Bedrock Anthropic cacheRetention defaults/pass-through (openclaw#22303) (thanks @snese) fix(providers): disable Bedrock prompt caching for non-Anthropic models (openclaw#20866) (thanks @pierreeurope) docs(changelog): note /new and /reset auth-label removal (openclaw#24409) fix(reply): omit auth labels in /new and /reset docs(changelog): correct kimi issue references test(tools): fix kimi web_search mock typing feat(media): add moonshot video provider and wiring ... # Conflicts: # ui/src/ui/app-render.ts # ui/src/ui/controllers/agents.ts
carlosrivera
pushed a commit
to myascendai/meshiclaw
that referenced
this pull request
Feb 23, 2026
…enclaw#24696) Merged via /review-pr -> /prepare-pr -> /merge-pr. Prepared head SHA: d6d4b43 Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Reviewed-by: @gumadeiras
mreedr
pushed a commit
to mreedr/openclaw-custom
that referenced
this pull request
Feb 24, 2026
…enclaw#24696) Merged via /review-pr -> /prepare-pr -> /merge-pr. Prepared head SHA: d6d4b43 Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Reviewed-by: @gumadeiras
plgs2005
pushed a commit
to plgs2005/openclaw
that referenced
this pull request
Feb 24, 2026
…enclaw#24696) Merged via /review-pr -> /prepare-pr -> /merge-pr. Prepared head SHA: d6d4b43 Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Reviewed-by: @gumadeiras
margulans
pushed a commit
to margulans/Neiron-AI-assistant
that referenced
this pull request
Feb 25, 2026
…enclaw#24696) Merged via /review-pr -> /prepare-pr -> /merge-pr. Prepared head SHA: d6d4b43 Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Reviewed-by: @gumadeiras
brianleach
pushed a commit
to brianleach/openclaw
that referenced
this pull request
Feb 26, 2026
…enclaw#24696) Merged via /review-pr -> /prepare-pr -> /merge-pr. Prepared head SHA: d6d4b43 Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Reviewed-by: @gumadeiras
2 tasks
mylukin
pushed a commit
to mylukin/openclaw
that referenced
this pull request
Feb 26, 2026
…enclaw#24696) Merged via /review-pr -> /prepare-pr -> /merge-pr. Prepared head SHA: d6d4b43 Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Reviewed-by: @gumadeiras
r4jiv007
pushed a commit
to r4jiv007/openclaw
that referenced
this pull request
Feb 28, 2026
…enclaw#24696) Merged via /review-pr -> /prepare-pr -> /merge-pr. Prepared head SHA: d6d4b43 Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Reviewed-by: @gumadeiras
zooqueen
pushed a commit
to hanzoai/bot
that referenced
this pull request
Mar 6, 2026
…enclaw#24696) Merged via /review-pr -> /prepare-pr -> /merge-pr. Prepared head SHA: d6d4b43 Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Reviewed-by: @gumadeiras
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ppidin port inspection (ps -o ppid=) so restart checks can distinguish owned children from true stale listenersWhy
openclaw gateway restartcould falsely report stale gateway processes and time out when the service manager pid and the socket-listener pid differ (parent/child model), which happens on both launchd and systemd setups.Testing
pnpm test -- src/cli/daemon-cli/restart-health.test.ts src/cli/daemon-cli/lifecycle.test.ts src/infra/ports.test.tspnpm openclaw gateway restartpnpm openclaw gateway restart --jsonGreptile Summary
Fixed restart-health ownership checks to recognize child listener processes by capturing parent pid (
ppid) from Unixpsoutput. The restart command previously timed out when the service manager pid differed from the socket-listener pid (parent/child model common in launchd and systemd setups). The fix addsppidtoPortListener, captures it viaps -o ppid=, and updateslistenerOwnedByRuntimePid()to check both direct pid match and ppid match against the runtime pid.Key changes:
ppidfield toPortListenertyperesolveUnixParentPid()to capture parent process ID on Unix systemslistenerOwnedByRuntimePid()helper to check bothlistener.pid === runtimePidandlistener.ppid === runtimePidConfidence Score: 5/5
ppidfield is optional and backward-compatible. The logic correctly handles both direct ownership (pid match) and child process ownership (ppid match). Tests verify both the fixed scenario and the unchanged behavior for non-owned listeners.Last reviewed commit: a8d05ef