Skip to content

Gateway: stabilize service entrypoint path resolution#28338

Closed
realriphub wants to merge 5 commits intoopenclaw:mainfrom
realriphub:codex/optimize-openclaw-service-installation-logic
Closed

Gateway: stabilize service entrypoint path resolution#28338
realriphub wants to merge 5 commits intoopenclaw:mainfrom
realriphub:codex/optimize-openclaw-service-installation-logic

Conversation

@realriphub
Copy link

This PR forwards commit 3cf852f from realriphub/openclaw.\n\n### Summary\n- stabilize service entrypoint path resolution for Gateway\n\nPlease review and merge into upstream main.

@openclaw-barnacle openclaw-barnacle bot added gateway Gateway runtime commands Command implementations size: S labels Feb 27, 2026
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 27, 2026

Greptile Summary

This PR stabilizes Gateway service entrypoint path resolution to prevent spurious service configuration updates and improve stability across package manager updates.

Key changes:

  • Prioritizes global openclaw binary paths over current execution paths for more stable service configs
  • Resolves symlinks when comparing entrypoints to avoid false mismatches with pnpm global installs
  • Both changes include comprehensive test coverage

How it works:
The new resolveCliEntrypointFromGlobalBinary() function in src/daemon/program-args.ts:61 uses which/where to find the global openclaw binary and builds stable dist candidates from that path. This is tried first before falling back to the existing process.argv[1] logic.

The updated normalizeExecutablePath() in src/commands/doctor-gateway-services.ts:54 now resolves symlinks via fs.realpath() before comparing paths, preventing unnecessary service reinstalls when pnpm symlinks (e.g., node_modules/openclaw) point to version-specific paths (e.g., node_modules/.pnpm/openclaw@X.Y.Z/...).

Confidence Score: 5/5

  • This PR is safe to merge with no identified issues.
  • The changes are well-implemented with clear intent, comprehensive test coverage, and proper error handling. The logic correctly handles symlinks and prioritizes stable paths for service configurations. No bugs, security issues, or breaking changes were found.
  • No files require special attention.

Last reviewed commit: 3cf852f

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3cf852f976

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e16c4704d8

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +40 to +41
if (globalEntrypoint) {
return globalEntrypoint;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Re-throw argv entrypoint failures before PATH fallback

If resolveCliEntrypointFromArgvPath() fails (for example, running from a checkout where dist/ is not built), this branch silently falls back to which openclaw and installs the service against that PATH binary instead of the invoking CLI. That means gateway install can bind to an unrelated global version while the user is executing a different checkout/runtime, which is a regression from the previous explicit error and is hard to diagnose.

Useful? React with 👍 / 👎.

@realriphub
Copy link
Author

Potentially related issue from another reporter: #28423 (macOS LaunchAgent entrypoint stale from entry.js to index.js until manual doctor).\n\nThis PR improves service entrypoint resolution and doctor path comparison via symlink/real path normalization, which appears in the same failure family.\n\nLinking for maintainer triage and reporter verification (not auto-closing).

@openclaw-barnacle
Copy link

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle bot added the stale Marked as stale due to inactivity label Mar 6, 2026
@ngutman
Copy link
Contributor

ngutman commented Mar 12, 2026

Closing this as superseded.

The remaining useful piece from this branch, the narrow doctor realpath normalization for gateway entrypoint comparison, landed via #43882:

The broader program-args changes from this older branch were not needed on current main, so we carried forward just the doctor fix in a fresh PR.

Thanks @realriphub for the original groundwork here.

@ngutman ngutman closed this Mar 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations gateway Gateway runtime size: M stale Marked as stale due to inactivity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants