Skip to content

fix(watch): resolve install mode without PATH so launchd/cron auto-reinstall fires - #87

Merged
AndreJorgeLopes merged 1 commit into
mainfrom
fix/detect-install-mode-pathless
Jul 28, 2026
Merged

fix(watch): resolve install mode without PATH so launchd/cron auto-reinstall fires#87
AndreJorgeLopes merged 1 commit into
mainfrom
fix/detect-install-mode-pathless

Conversation

@AndreJorgeLopes

Copy link
Copy Markdown
Owner

TL;DR

Follow-up to #84. The launchd agent (and Linux cron) run with a minimal PATH lacking ~/.local/bin, so command -v devflow was empty, _detect_install_mode returned "none", and _auto_reinstall_check bailed early — the auto-update silently no-opped. The reliable trigger was useless because what it fired couldn't find devflow.

Fix

  • _detect_install_mode now falls back to resolving the installed launcher directly when it's not on PATH: DEVFLOW_ROOT-derived <prefix>/bin/devflow (copy install, honours custom PREFIX) -> ~/.local/bin/devflow -> brew paths. It inspects the BINDIR launcher, not the repo source, so a make link symlink still reads link and a copy install install.
  • The launchd plist gains EnvironmentVariables > PATH (launcher dir + standard dirs) so the agent's subprocess also finds devflow/git/curl.

Verification

  • Live: under an emptied PATH, _detect_install_mode now returns install (was none).
  • Tests: pathless copy/link/custom-prefix resolution + plist PATH injection; the "none" test tightened to a truly empty env. watch.bats 32/32; make test-unit 126/0; make test green.

Builds on v0.27.0. Without this, #84's launchd agent fires but never auto-updates on macOS.

🤖 Generated with Claude Code

…install fires

The launchd agent (and Linux cron) run with a minimal PATH that lacks ~/.local/bin, so
`command -v devflow` returned empty and _detect_install_mode resolved to "none" -
_auto_reinstall_check then returned early and the auto-update SILENTLY no-opped. The
reliable launchd trigger was therefore useless: it fired, but what it fired could not
find devflow to reinstall it.

Two fixes:
- _detect_install_mode now falls back to resolving the installed launcher directly when
  it is not on PATH: the DEVFLOW_ROOT-derived <prefix>/bin/devflow (copy install, honours
  a custom PREFIX), then ~/.local/bin/devflow, then the brew locations. It inspects the
  BINDIR launcher (not the repo source) so a `make link` symlink still reads as "link"
  and a copy install as "install". Verified live: under an emptied PATH it now returns
  "install" where it previously returned "none".
- The launchd plist gains EnvironmentVariables > PATH (the launcher dir + standard dirs),
  so the agent's own subprocess can also find devflow, git, curl under launchd's minimal
  environment.

Tests: pathless resolution for copy + link + custom-prefix-via-DEVFLOW_ROOT, plist PATH
injection, and the "none" test tightened to require a truly empty environment. watch.bats
32/32; full make test-unit 126/0; make test green.

Follow-up to #84 (launchd scheduler). Without this, #84's agent fires but never
auto-updates on macOS.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 28, 2026 18:37

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@AndreJorgeLopes
AndreJorgeLopes merged commit 709466e into main Jul 28, 2026
1 check passed
@AndreJorgeLopes
AndreJorgeLopes deleted the fix/detect-install-mode-pathless branch July 28, 2026 18:38
AndreJorgeLopes added a commit that referenced this pull request Jul 30, 2026
…er (#88)

command -v devflow can return a relative ./bin/devflow when PATH has a relative entry, so watch setup pinned the launchd/cron entry to the source checkout via WorkingDirectory instead of the stable launcher. _devflow_launcher now resolves an absolute stable target (DEVFLOW_ROOT-derived BINDIR launcher, else absolutized command -v). watch.bats 34/34. Follow-up to #84/#87.
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