Skip to content

fix(dev-install): detect OpenClaw CLI entrypoint dynamically#39

Merged
alauppe merged 2 commits intoopenclaw:mainfrom
ninjaa:fix/dev-entrypoint-detection
Mar 11, 2026
Merged

fix(dev-install): detect OpenClaw CLI entrypoint dynamically#39
alauppe merged 2 commits intoopenclaw:mainfrom
ninjaa:fix/dev-entrypoint-detection

Conversation

@ninjaa
Copy link
Contributor

@ninjaa ninjaa commented Mar 5, 2026

Summary

  • detect CLI entrypoint in priority order: openclaw.mjs, bin/openclaw.js, dist/index.js
  • fail fast with a clear error if none exist
  • use resolved path for symlink/chmod/debug instead of hardcoded bin/openclaw.js

Why

Phantastic-AI/openclaw on deploy/mattermost-latest ships openclaw.mjs and does not include bin/openclaw.js, which breaks dev source installs with the current hardcoded path.

Validation

  • ansible-playbook --syntax-check playbook.yml

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: 2c6e22e746

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

exit 0
fi
done
exit 1

Choose a reason for hiding this comment

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

P2 Badge Handle missing entrypoints without shell task failure

When none of the candidate files exist, this probe exits with code 1 and ansible.builtin.shell fails the play immediately, so the following Fail if openclaw CLI entrypoint is missing task (with the clearer error message) never runs. This makes the new error-handling path unreachable in exactly the failure scenario it is meant to cover (for example, if upstream layout changes again or build artifacts are missing), so the probe should be made non-fatal (e.g., failed_when: false) and let the explicit fail task report the issue.

Useful? React with 👍 / 👎.

Co-authored-by: Aditya Advani <aditya@moltpod.com>
@alauppe
Copy link
Member

alauppe commented Mar 11, 2026

Thanks for the fix here. The underlying issue is real, and the intent is aligned with the project: development installs should not hardcode a single CLI entrypoint path when different source branches can ship different layouts.

I pushed a follow-up commit onto your branch before merging. The main changes were:

  • resolve the CLI entrypoint from package.json metadata first when possible
  • fall back to known file candidates (openclaw.mjs, bin/openclaw.js, dist/index.js)
  • fix the current error path so we fail with an explicit Ansible message instead of a generic shell-task failure when nothing is found

Appreciate the contribution.

@alauppe alauppe merged commit f0a2735 into openclaw:main Mar 11, 2026
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: 4cc27b4993

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +106 to +110
openclaw_package_json.bin
if openclaw_package_json.bin is string else
(
openclaw_package_json.bin.openclaw
if openclaw_package_json.bin is mapping and 'openclaw' in openclaw_package_json.bin else

Choose a reason for hiding this comment

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

P2 Badge Guard missing package.json bin before dereferencing

This expression dereferences openclaw_package_json.bin repeatedly without an is defined/default guard, so if package.json exists but has no bin key (or sets bin: null), the task can fail during templating before fallback probes run. In that case the intended fallback paths (openclaw.mjs, bin/openclaw.js, dist/index.js) are never evaluated even if one exists, causing avoidable install failures.

Useful? React with 👍 / 👎.

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