Skip to content

feat: daemon starts in background with local-only workflow support - #38

Merged
RevCBH merged 6 commits into
mainfrom
RevCBH/daemon-start-background
Jan 22, 2026
Merged

feat: daemon starts in background with local-only workflow support#38
RevCBH merged 6 commits into
mainfrom
RevCBH/daemon-start-background

Conversation

@RevCBH

@RevCBH RevCBH commented Jan 22, 2026

Copy link
Copy Markdown
Owner

Enables the daemon to start jobs in the background with proper feature mode configuration. Adds support for local-only workflows where workers skip remote operations when no remote tracking exists. Fixes orchestrator PR creation when all units are pre-completed, and ensures feature branch is pushed with PR at workflow end.

Changes:

  • Pass FeatureMode, FeatureBranch, and ClaudeCommand to orchestrator config
  • Workers auto-detect local vs remote and skip fetch for local-only branches
  • Orchestrator creates PR at end regardless of remote tracking state
  • Improved web UI with unit status tracking for resume scenarios

Depends on #36 (daemon mode foundation).

🤖 Generated with Claude Code

Test User and others added 6 commits January 21, 2026 14:05
- `choo daemon start` now starts the daemon in the background by default
- Added `--foreground` flag for blocking mode (useful for debugging)
- Daemon checks if already running before starting (via PID file)
- Integrated web server into daemon (serves on :8080 by default)
- `choo daemon stop` properly shuts down daemon via gRPC callback
- `choo daemon stop` handles "not running" case gracefully
- Added job manager adapter to bridge jobManagerImpl to gRPC JobManager interface
- Registered DaemonService with gRPC server for status/stop commands

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Fix daemon backgrounding with proper process group separation
  (Setpgid=true prevents Ctrl+C from killing daemon)
- Add `daemon logs` command with -f/--follow and -n/--lines flags
- Auto-start daemon when running `choo run` if not already running
- Support CLI attach to existing running workflows (get-or-create pattern)
- Make event forwarding order-independent (Store always updated,
  Hub late-bindable)
- Fix UNIQUE constraint error by cleaning up completed runs before
  creating new ones (DeleteNonActiveRunByBranch)
- Reorder graceful shutdown to cancel jobs first, then stop servers

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add EnsureBranchOnRemote check to daemon's job manager, matching inline
  mode behavior. The check auto-pushes the target branch if it doesn't
  exist on remote, or fails early with a clear error message.

- Add cleanup of non-active runs in gRPC StartJob to prevent UNIQUE
  constraint violations when restarting jobs for the same branch.

- Add ErrJobNotFound sentinel error and nil check in job manager adapter.

- Implement transitive edge reduction in DAG visualization for cleaner
  graph display. Removes redundant edges where a dependency is already
  reachable through another path.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Workers now auto-detect local vs remote workflow:
- Check if origin/<target> exists locally before fetching
- Use local branch ref for rebase when no remote tracking
- Skip fetch for local-only branches

Daemon job manager no longer checks/pushes target branch on startup.

Orchestrator still pushes feature branch and creates PR at the end
(unless NoPR config is set), which works regardless of whether the
target branch initially had remote tracking.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The daemon job manager was not passing FeatureBranch, FeatureMode, or
ClaudeCommand to the orchestrator config. This caused the orchestrator
to skip PR creation even when all units were complete.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Validate target branch and tasks dir before attaching to existing job
  to prevent mis-attachment to jobs with different configurations
- Use reference counting for connection state tracking to correctly
  handle multiple concurrent jobs (SetConnected now increments/decrements)
- Replace fixed 500ms sleep with exponential backoff polling loop for
  daemon startup verification (5 retries with backoff up to ~3s total)
- Optimize log reading to read from end of file instead of loading
  entire file into memory (efficient tail-like implementation)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@RevCBH
RevCBH merged commit a298a0b into main Jan 22, 2026
2 checks passed
@RevCBH
RevCBH deleted the RevCBH/daemon-start-background branch January 22, 2026 02:29
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