Skip to content

daemon: prefer symlinked paths over realpath for stable service configs - #1505

Merged
steipete merged 1 commit into
openclaw:mainfrom
odysseus0:fix/stable-launchagent-path
Jan 23, 2026
Merged

steipete merged 1 commit into
openclaw:mainfrom
odysseus0:fix/stable-launchagent-path

Conversation

@odysseus0

Copy link
Copy Markdown
Contributor

Summary

  • Fix LaunchAgent/systemd service breaking after pnpm package updates
  • Prefer the original symlinked path (e.g. node_modules/clawdbot/dist/entry.js) over the realpath-resolved versioned path (e.g. .pnpm/[email protected]/.../dist/entry.js)

Problem

When installing the LaunchAgent/systemd service, the CLI was using fs.realpath() to resolve the entry.js path. This converted stable symlinked paths into version-specific paths.

After a pnpm update:

  1. pnpm updates the symlink to point to the new version
  2. pnpm removes the old version's files
  3. The LaunchAgent plist still points to the old version's path → service fails to start

Solution

Now we check if the original (non-realpath-resolved) path is valid and prefer it when:

  • It looks like a dist path (/dist/*.js)
  • It exists and is accessible

This keeps service configs stable because pnpm automatically updates the symlink during package updates.

Test plan

  • Added unit test for new behavior
  • All existing tests pass
  • Lint passes

🤖 Generated with Claude Code

When installing the LaunchAgent/systemd service, the CLI was using
fs.realpath() to resolve the entry.js path, which converted stable
symlinked paths (e.g. node_modules/clawdbot) into version-specific
paths (e.g. .pnpm/[email protected]/...).

This caused the service to break after pnpm updates because the old
versioned path no longer exists, even though the symlink still works.

Now we prefer the original (symlinked) path when it's valid, keeping
service configs stable across package version updates.
@steipete

Copy link
Copy Markdown
Contributor

TIL. That is smart!

@steipete steipete self-assigned this Jan 23, 2026
@steipete
steipete merged commit bfbeea0 into openclaw:main Jan 23, 2026
@steipete

Copy link
Copy Markdown
Contributor

Landed via temp rebase onto main.

  • Gate: pnpm lint && pnpm build && pnpm test
  • Land commit: 9bba80a
  • Merge commit: bfbeea0

Thanks @odysseus0!

@odysseus0
odysseus0 deleted the fix/stable-launchagent-path branch January 23, 2026 12:15
dustin-olenslager pushed a commit to dustin-olenslager/ironclaw-supreme that referenced this pull request Mar 24, 2026
lovewanwan pushed a commit to lovewanwan/openclaw that referenced this pull request Apr 28, 2026
…gs (openclaw#1505)

When installing the LaunchAgent/systemd service, the CLI was using
fs.realpath() to resolve the entry.js path, which converted stable
symlinked paths (e.g. node_modules/clawdbot) into version-specific
paths (e.g. .pnpm/[email protected]/...).

This caused the service to break after pnpm updates because the old
versioned path no longer exists, even though the symlink still works.

Now we prefer the original (symlinked) path when it's valid, keeping
service configs stable across package version updates.
ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
…gs (openclaw#1505)

When installing the LaunchAgent/systemd service, the CLI was using
fs.realpath() to resolve the entry.js path, which converted stable
symlinked paths (e.g. node_modules/clawdbot) into version-specific
paths (e.g. .pnpm/[email protected]/...).

This caused the service to break after pnpm updates because the old
versioned path no longer exists, even though the symlink still works.

Now we prefer the original (symlinked) path when it's valid, keeping
service configs stable across package version updates.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026
…gs (openclaw#1505)

When installing the LaunchAgent/systemd service, the CLI was using
fs.realpath() to resolve the entry.js path, which converted stable
symlinked paths (e.g. node_modules/clawdbot) into version-specific
paths (e.g. .pnpm/[email protected]/...).

This caused the service to break after pnpm updates because the old
versioned path no longer exists, even though the symlink still works.

Now we prefer the original (symlinked) path when it's valid, keeping
service configs stable across package version updates.
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
zeekay pushed a commit to Dream-AI-4444/clawdbot that referenced this pull request Sep 11, 2026
…gs (openclaw#1505)

When installing the LaunchAgent/systemd service, the CLI was using
fs.realpath() to resolve the entry.js path, which converted stable
symlinked paths (e.g. node_modules/clawdbot) into version-specific
paths (e.g. .pnpm/[email protected]/...).

This caused the service to break after pnpm updates because the old
versioned path no longer exists, even though the symlink still works.

Now we prefer the original (symlinked) path when it's valid, keeping
service configs stable across package version updates.
zooqueen pushed a commit to zooqueen/openclaw that referenced this pull request Sep 11, 2026
lhfer pushed a commit to lhfer/openclaw that referenced this pull request Oct 11, 2026
…gs (openclaw#1505)

When installing the LaunchAgent/systemd service, the CLI was using
fs.realpath() to resolve the entry.js path, which converted stable
symlinked paths (e.g. node_modules/clawdbot) into version-specific
paths (e.g. .pnpm/[email protected]/...).

This caused the service to break after pnpm updates because the old
versioned path no longer exists, even though the symlink still works.

Now we prefer the original (symlinked) path when it's valid, keeping
service configs stable across package version updates.
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