Skip to content

feat: implement daemon dependency resolution#135

Merged
jdx merged 3 commits intomainfrom
feat/daemon-dependencies
Jan 19, 2026
Merged

feat: implement daemon dependency resolution#135
jdx merged 3 commits intomainfrom
feat/daemon-dependencies

Conversation

@jdx
Copy link
Owner

@jdx jdx commented Jan 19, 2026

Summary

  • Implement the depends field for daemon configuration that was documented but not functional
  • Add dependency resolution using topological sort (Kahn's algorithm)
  • Auto-start dependencies when starting a daemon
  • Start daemons level-by-level (parallel within levels, sequential between)

Changes

  • Add depends: Vec<String> to PitchforkTomlDaemon, Daemon, and RunOptions structs
  • Create new src/deps.rs module with dependency resolution logic
  • Modify cli/start.rs to resolve dependencies and start in correct order
  • Add comprehensive unit tests in deps.rs and E2E tests in test_e2e_depends.rs

Behavior

  • pitchfork start api where api depends on postgres will start postgres first, then api
  • Circular dependencies are detected and reported with clear error messages
  • Already-running dependencies are skipped (not restarted)
  • Force flag (-f) only affects explicitly requested daemons, not their dependencies

Test plan

  • Unit tests for dependency resolution (cargo nextest run deps)
  • Config parsing tests (cargo nextest run test_daemon_with_depends)
  • E2E tests for dependency behavior (cargo nextest run test_e2e_depends)
  • Manual test with real config file

🤖 Generated with Claude Code


Note

Enables dependency-aware startup across the CLI, supervisor, TUI, and web paths.

  • Introduces depends to pitchfork.toml parsing and threads it through Daemon and RunOptions
  • New deps module performs topological resolution (Kahn) returning parallelizable levels
  • start command resolves transitive deps, skips already-running deps, honors -f only for explicitly requested daemons, and aborts on failed deps
  • Supervisor, TUI, web routes updated to propagate depends; one-off run sets empty deps
  • Docs expanded for depends behavior and examples; added unit tests for resolver and E2E tests for start behavior
  • Minor: include src/web/assets/**/* in package manifest

Written by Cursor Bugbot for commit 180eb92. This will update automatically on new commits. Configure here.

jdx and others added 3 commits January 18, 2026 20:31
The rust-embed assets folder was not being included in the crate
package because the include path was wrong (assets/**/* instead of
src/web/assets/**/*). This was causing Release-plz to fail.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add support for the `depends` field in daemon configuration, allowing
daemons to declare dependencies on other daemons. When starting a daemon,
its dependencies are automatically started first in the correct order.

- Add `depends: Vec<String>` field to daemon config and state
- Implement topological sort (Kahn's algorithm) for dependency resolution
- Start daemons level-by-level (parallel within levels, sequential between)
- Detect and report circular dependencies
- Skip already-running dependencies (don't restart them)
- Force flag only affects explicitly requested daemons, not their deps
- Add comprehensive unit and E2E tests for dependency behavior

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add detailed explanation of dependency behavior including auto-start,
parallel execution, circular detection, and force flag behavior.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@jdx jdx merged commit c03690d into main Jan 19, 2026
4 checks passed
@jdx jdx deleted the feat/daemon-dependencies branch January 19, 2026 03:18
jdx added a commit that referenced this pull request Jan 19, 2026
## Summary

- Add missing `depends` field to `RunOptions` in restart command

## Problem

The restart command (PR #134) was merged after the daemon dependencies
feature (PR #135), causing a build failure on main due to the missing
`depends` field in `RunOptions`.

## Test plan

- [x] `cargo build` passes

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Ensures the restart command constructs `RunOptions` with an explicit
empty `depends` list when calling `ipc.run`, aligning with the updated
`RunOptions` struct.
> 
> - Update `src/cli/restart.rs` to set `depends: vec![]` in `RunOptions`
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
6874f15. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
jdx added a commit that referenced this pull request Jan 19, 2026
## 🤖 New release

* `pitchfork-cli`: 0.3.0 -> 0.3.1

<details><summary><i><b>Changelog</b></i></summary><p>

<blockquote>

## [0.3.1](v0.3.0...v0.3.1) -
2026-01-19

### Added

- implement daemon dependency resolution
([#135](#135))
- add restart command to CLI
([#134](#134))

### Fixed

- restart command preserves daemon dependency configuration
([#142](#142))
- add missing depends field to restart command
([#136](#136))
- set IPC socket permissions to 0600 for security
([#133](#133))
- handle shell command parsing errors instead of silently failing
([#132](#132))

### Other

- reduce unnecessary daemon cloning in loops
([#144](#144))
- use periodic log flushing instead of per-line
([#139](#139))
- refresh only tracked PIDs instead of all processes
([#141](#141))
- cache compiled regex patterns
([#143](#143))

### Security

- add rate limiting to IPC server
([#137](#137))
- canonicalize config paths to prevent symlink exploitation
([#138](#138))
- add centralized daemon ID validation
([#140](#140))
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/release-plz/release-plz/).

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Prepares the 0.3.1 release and updates metadata/documentation
accordingly.
> 
> - **Changelog**: Adds `0.3.1` entry detailing added dependency
resolution, new `restart` command, fixes, performance tweaks, and
security hardening
> - **Version bumps**: Updates `version` to `0.3.1` in `Cargo.toml`,
`Cargo.lock`, `docs/cli/commands.json`, `docs/cli/index.md`, and
`pitchfork.usage.kdl`
> - **Docs regen**: Refreshes CLI docs/spec to reflect the new version
(no behavioral changes in this diff)
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
9f9d386. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
@jdx jdx mentioned this pull request Jan 19, 2026
jdx added a commit that referenced this pull request Jan 19, 2026
## 🤖 New release

* `pitchfork-cli`: 1.0.0

<details><summary><i><b>Changelog</b></i></summary><p>

<blockquote>

## [1.0.0](https://github.com/jdx/pitchfork/releases/tag/v1.0.0) -
2026-01-19

### Added

- implement daemon dependency resolution
([#135](#135))
- add restart command to CLI
([#134](#134))

### Fixed

- restart command preserves daemon dependency configuration
([#142](#142))
- add missing depends field to restart command
([#136](#136))
- set IPC socket permissions to 0600 for security
([#133](#133))
- handle shell command parsing errors instead of silently failing
([#132](#132))

### Other

- bump version to 1.0.0
([#147](#147))
- release v0.3.1 ([#121](#121))
- reduce unnecessary daemon cloning in loops
([#144](#144))
- use periodic log flushing instead of per-line
([#139](#139))
- refresh only tracked PIDs instead of all processes
([#141](#141))
- cache compiled regex patterns
([#143](#143))

### Security

- add rate limiting to IPC server
([#137](#137))
- canonicalize config paths to prevent symlink exploitation
([#138](#138))
- add centralized daemon ID validation
([#140](#140))
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/release-plz/release-plz/).

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Prepares the 1.0.0 release and updates `CHANGELOG.md` with the
finalized notes.
> 
> - Adds `1.0.0` section: daemon dependency resolution, new CLI
`restart` command, fixes for dependency preservation and shell parsing,
secure IPC socket perms, plus performance/maintenance updates
> - Documents security hardening: IPC rate limiting, config path
canonicalization, centralized daemon ID validation
> - Retains prior `0.3.1` notes for historical context
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
4182984. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
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