Skip to content

allow opt-in autolaunch of the daemon - #558

Draft
hanabel1 wants to merge 1 commit into
chunk-validate-to-daemonfrom
opt-in-autolaunch
Draft

allow opt-in autolaunch of the daemon#558
hanabel1 wants to merge 1 commit into
chunk-validate-to-daemonfrom
opt-in-autolaunch

Conversation

@hanabel1

@hanabel1 hanabel1 commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds an autoLaunchDaemon user setting (default false) — users opt in rather than being surprised by a background process
  • Adds --daemon / --no-daemon global flags to override the setting on any individual run
  • Fixes a 404 stop-hook error caused by delegating to a stale daemon from an older build

Events

  • chunk config set autoLaunchDaemon true enables auto-launch globally
  • chunk validate --no-daemon skips the daemon for that run even when the setting is on
  • chunk validate --daemon forces daemon launch for that run even when the setting is off

Not collected

  • Auto-launch is not attempted for: shell completions, chunk watch (manages its own daemon), the _daemon subcommand, and receive-telemetry

Implementation

  • IsDaemonCompatible() added to watchd — checks reachability and build ID match; shouldUseDaemon and tryHookDelegate now use this instead of IsDaemonRunning(), so a stale daemon from a previous build is skipped rather than delegated to
  • RunValidate treats a 404 response as ErrDaemonUnavailable (belt-and-suspenders fallback to inline execution)
  • --no-daemon moved from a hidden local validate flag to a persistent root flag so it applies to all commands; validate reads it via cmd.Flags().GetBool

Test plan

  • task build && task test passes
  • chunk config set autoLaunchDaemon true → subsequent commands start the daemon if not running
  • chunk validate --no-daemon skips daemon even when setting is on
  • Stopping the running daemon and running the stop hook with a stale (pre-/validate) daemon no longer errors with 404

🤖 Generated with Claude Code

Adds an autoLaunchDaemon user setting (default false) so users can opt
into having chunk commands automatically start the watch daemon when it
isn't running, without surprising anyone by default.

- chunk config set autoLaunchDaemon true/false to enable/disable
- --daemon / --no-daemon global flags override the setting per-run
- auto-launch is skipped for shell completions, watch (starts its own
  daemon), the _daemon subcommand itself, and receive-telemetry
- IsDaemonCompatible() checks both reachability and build ID so stale
  daemons from older builds are not delegated to; fixes a 404 error
  that surfaced when a pre-/validate daemon was still running

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@hanabel1
hanabel1 changed the base branch from main to chunk-validate-to-daemon September 3, 2026 22:01
@linear-code

linear-code Bot commented Sep 3, 2026

Copy link
Copy Markdown

FACT-457

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.

1 participant