happy icon indicating copy to clipboard operation
happy copied to clipboard

`happy daemon install` appears to generate a macOS plist for a non-existent `happy-daemon` entrypoint

Open zhls-ayl opened this issue 8 months ago • 2 comments

Summary

happy daemon install appears to generate a macOS launchd plist that targets a happy-daemon entrypoint, but the installed happy-coder package does not expose a matching executable or CLI subcommand.

This makes the built-in daemon installation path look inconsistent and likely non-functional in happy-coder 0.13.0.

This is separate from feature request #434. That issue asks for launchd/systemd support in general. This issue is about the current built-in macOS install implementation appearing to generate an invalid service definition.

Environment

  • Happy CLI version: 0.13.0
  • Install method: global install via Homebrew/npm package happy-coder
  • OS: macOS darwin arm64
  • Node.js: v25.9.0

What I Observed

In the installed 0.13.0 package:

  1. happy daemon install exists and requires sudo

  2. the macOS install implementation writes a plist under /Library/LaunchDaemons/com.happy-cli.daemon.plist

  3. that plist uses ProgramArguments ending in:

    <string>happy-daemon</string>
    
  4. the same implementation also sets:

    <key>HAPPY_DAEMON_MODE</key>
    <string>true</string>
    
  5. however, the installed package only exposes these binaries:

    • happy
    • happy-mcp
  6. I could not find a separate happy-daemon executable in the installed package

  7. I also verified that running happy happy-daemon does not enter daemon mode; it behaves like an unknown/default CLI path rather than daemon start-sync

  8. the installed bundle appears to identify daemon mode from argv matching daemon start-sync, not from happy-daemon or HAPPY_DAEMON_MODE

Expected Behavior

One of the following should be true:

  1. happy daemon install should generate a launchd plist that invokes a real daemon entrypoint, such as:

    happy daemon start-sync
    
  2. or the package should expose a real happy-daemon executable/subcommand that enters daemon mode correctly

Actual Behavior

The built-in macOS install path appears to generate a plist that references an entrypoint that is not present in the installed package.

As a result, happy daemon install looks unsafe to rely on as the official persistent-daemon setup path.

Why This Matters

  • users may assume the built-in install command is the recommended production path
  • if the generated plist targets a non-existent or non-daemon entrypoint, persistent daemon setup will fail or behave unpredictably
  • this is especially confusing because there is already an open request for official launchd support, and 0.13.0 appears to ship an implementation that may not actually match the runtime entrypoints

Workaround

A manual LaunchAgent / launchd setup that runs:

happy daemon start-sync

seems more consistent with the runtime behavior than relying on happy daemon install.

Additional Notes

If maintainers investigate this area, there may also be a second macOS-specific concern:

  • the generated plist is written to /Library/LaunchDaemons
  • its stdout/stderr paths are derived from os.homedir()

Depending on how the service runs under launchd, that may resolve to a system/root home rather than the intended user home. I did not verify this separately, so I am mentioning it only as a possible follow-up concern, not as the primary bug in this issue.

zhls-ayl avatar Apr 02 '26 17:04 zhls-ayl

Related issue: #967

I opened that separately because it looks like a different user-facing bug in the session startup path:

  • happy codex can start a usable session without ensuring the daemon is already running
  • as a result, the session is not daemon-tracked unless the daemon was started manually first

Keeping them separate should make triage easier:

  • #967: happy codex missing daemon bootstrap
  • this issue: happy daemon install may generate a macOS service definition that points at a non-existent daemon entrypoint

zhls-ayl avatar Apr 02 '26 17:04 zhls-ayl

I can reproduce this on Windows and the behavior looks consistent with a CLI-side daemon startup gap rather than only a web UI issue.

Environment

  • OS: Windows
  • Shell: cmd
  • Happy CLI: 0.12.0
  • Node.js: v22.15.1

Repro

  1. Run happy codex
  2. Open https://app.happy.engineering/new
  3. Web app shows No active sessions
  4. Send button is disabled/greyed out

Diagnostics

happy doctor reports:

Authenticated (credentials found)
Daemon is not running
No happy processes found

Codex log shows the session starts, but reporting to daemon fails:

[START] Reporting session ...
[CONTROL CLIENT] No daemon running, no state file found
[START] Failed to report to daemon (may not be running): No daemon running, no state file found

In another run I also saw:

[CONTROL CLIENT] Daemon is not running, file is stale
[START] Failed to report to daemon (may not be running): Daemon is not running, file is stale

Additional investigation

From the installed CLI code, the default happy / Claude path ensures the daemon is running before launching the session, but the happy codex path appears to call runCodex(...) directly without the same daemon startup step.

That matches what I am seeing locally:

  • Codex session starts
  • daemon is not started
  • session cannot be reported
  • Web/App shows no active session

If useful, I can also open a PR for the codex entrypoint to reuse the same daemon ensure/start logic as the Claude path.

wang-kaopu avatar Apr 03 '26 11:04 wang-kaopu