feat: support boolean values for retry configuration#170
Conversation
Allows `retry = true` for infinite retries and `retry = false` for no retries, in addition to numeric values. - Added `Retry` struct with custom serde to accept bool or u32 - `true` = u32::MAX (infinite retries), `false` = 0 (no retries) - Display trait shows "infinite" for infinite retries - Added `is_infinite()` and `count()` methods - Updated all usages across CLI, TUI, web routes, and supervisor Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR adds support for boolean values in retry configuration, allowing users to specify retry = true for infinite retries or retry = false for no retries, in addition to numeric values. The implementation introduces a Retry wrapper struct with custom serialization/deserialization logic and updates all usages across the codebase to use the new .count() accessor method.
Changes:
- Introduced
Retrystruct with serde support for boolean and numeric values - Updated all retry field accesses to use
.count()method - Added Display trait showing "infinite" for infinite retries in TUI
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/pitchfork_toml.rs | Introduced Retry struct with custom serde implementation to accept bool or u32 |
| tests/test_pitchfork_toml.rs | Updated existing tests to use .count() accessor and added comprehensive boolean retry tests |
| src/tui/ui.rs | Updated TUI display to show "infinite" for infinite retries and use .count() accessor |
| src/tui/app.rs | Updated retry field access to use .count() method |
| src/web/routes/daemons.rs | Updated retry field access to use .count() method |
| src/supervisor.rs | Updated retry field access to use .count() method |
| src/cli/start.rs | Updated retry field access to use .count() method |
| src/cli/restart.rs | Updated retry field access to use .count() method |
| src/cli/config/add.rs | Updated daemon creation to use Retry::default() |
| src/deps.rs | Updated test daemon creation to use Retry::default() |
| docs/public/schema.json | Updated JSON schema to reference new Retry type definition |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "type": "integer", | ||
| "format": "uint32", | ||
| "minimum": 0 |
There was a problem hiding this comment.
The JSON schema for Retry only declares it as an integer type, but the description indicates it should also accept boolean values. The schema should use oneOf to allow both boolean and integer types to accurately reflect the serde implementation.
| "type": "integer", | |
| "format": "uint32", | |
| "minimum": 0 | |
| "oneOf": [ | |
| { | |
| "type": "boolean" | |
| }, | |
| { | |
| "type": "integer", | |
| "format": "uint32", | |
| "minimum": 0 | |
| } | |
| ] |
| raw.contains("retry = 0") || raw.contains("retry = false"), | ||
| "zero retry should serialize as 0 or false" |
There was a problem hiding this comment.
The test accepts both 'retry = 0' and 'retry = false' as valid serialization for zero retries, but based on the Serialize implementation (line 218 in pitchfork_toml.rs), false serializes as 0, not as 'false'. This assertion should only check for 'retry = 0' to match the actual implementation behavior.
| raw.contains("retry = 0") || raw.contains("retry = false"), | |
| "zero retry should serialize as 0 or false" | |
| raw.contains("retry = 0"), | |
| "zero retry should serialize as 0" |
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
Use saturating_add(1) instead of + 1 when calculating max_attempts. When retry = true (u32::MAX), adding 1 would overflow. saturating_add caps at u32::MAX, effectively allowing infinite retries. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
## 🤖 New release * `pitchfork-cli`: 1.0.2 -> 1.1.0 <details><summary><i><b>Changelog</b></i></summary><p> <blockquote> ## [1.1.0](v1.0.2...v1.1.0) - 2026-01-19 ### Added - add file watching to auto-restart daemons ([#165](#165)) - support boolean values for retry configuration ([#170](#170)) - disable web UI by default ([#172](#172)) - auto-generate JSON schema from Rust types ([#167](#167)) ### Fixed - improve cron watcher granularity for sub-minute schedules ([#163](#163)) - improve log file position tracking accuracy ([#164](#164)) </blockquote> </p></details> --- This PR was generated with [release-plz](https://github.com/release-plz/release-plz/). <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Releases `pitchfork-cli` v1.1.0 and syncs version across `Cargo.toml`, `Cargo.lock`, `docs/cli/*`, and `pitchfork.usage.kdl`. > > - **Added**: file watching to auto-restart daemons; boolean support for retry config; web UI disabled by default; JSON schema generation from Rust types > - **Fixed**: improved cron watcher granularity (sub-minute); more accurate log file position tracking > - Updated `CHANGELOG.md` with 1.1.0 notes > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 2e6d4c6. 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>
Summary
retry = truefor infinite retries (u32::MAX) in pitchfork.tomlretry = falsefor no retries (0)Example Config
Changes
Retrystruct with custom serde to accept bool or u32Test plan
cargo nextest run- All 77 tests passcargo clippy --all-targets --all-features -- -D warnings- No warningstest_retry_boolean_valuestest for boolean retry deserialization/serialization🤖 Generated with Claude Code
Note
Adds flexible retry configuration and propagates it across the stack.
Retrytype inpitchfork_tomlwith custom serde: accepts boolean or integer (true= infinite,false/0= none); implementscount(),is_infinite(), andDisplay(shows "infinite")retryusages withretry.count()in CLI (start,restart,config add), TUI, web routes, andsupervisor; usessaturating_add(1)for attempt calculation when infinitedocs/guides/auto-restart.md,docs/reference/configuration.md) and JSON Schema (docs/public/schema.json) to defineRetryand document boolean supporttest_retry_boolean_valuesand updates existing tests to useRetryWritten by Cursor Bugbot for commit e7f6176. This will update automatically on new commits. Configure here.