fix: some issues related to sudo supervisor#323
Conversation
There was a problem hiding this comment.
Code Review
This pull request simplifies the port management documentation and enhances process termination logic. Key changes include updating the supervisor to provide more descriptive error messages when permission is denied and refactoring process killing functions to return Result for better error propagation. Documentation was streamlined by removing several sections, though feedback suggests retaining the "Why global config only?" explanation for better context. Additionally, the process group termination check in src/procs.rs may need to be more robust to ensure all child processes have exited.
I am having trouble creating individual review comments. Click here to see my feedback.
docs/guides/port-management.md (136-140)
The removal of the "Why global config only?" section removes valuable context that explains the design decisions behind Pitchfork's configuration model. This information helps users understand the benefits of the current approach, such as having a single source of truth and cross-directory resolution. Consider retaining this section to maintain documentation depth.
src/procs.rs (135)
Checking only the process group leader's status (is_terminated_or_zombie) might be insufficient to confirm that the entire process group has terminated. If the leader becomes a zombie but children are still running, this will return Ok(true) prematurely. While this is existing logic, consider if a more robust check (e.g., verifying if any processes remain in the PGID) is needed for process groups.
Greptile SummaryThis PR fixes several issues when running the pitchfork supervisor under Confidence Score: 5/5Safe to merge; the one code issue is a theoretical compile failure on unsupported platforms that won't affect any real target. All functional changes are well-reasoned and correctly implemented. The only finding is a P2 platform-portability issue (#[cfg(windows)] instead of #[cfg(not(unix))]) that does not affect any platform pitchfork actually targets. Prior review concerns (SUDO_USER without euid check, info! vs println! in status, hint specificity) are addressed or partially improved. src/procs.rs — the #[cfg(windows)] narrowing should be reverted to #[cfg(not(unix))]. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[pitchfork supervisor start/stop/run] --> B[resolve_existing_supervisor force]
B --> C{existing_pid in state file?}
C -- No --> D[AlreadyDead]
C -- Yes --> E[kill_or_stop pid force]
E --> F{PROCS.is_running?}
F -- No --> D
F -- Yes, force=false --> G[StillRunning]
F -- Yes, force=true --> H[kill_async pid]
H -- Ok true --> I[Killed]
H -- Ok false --> D
H -- Err EPERM --> J[Error: rerun with sudo]
G -->|start/run| K[warn + return]
I -->|start| L[wait for exit loop]
D -->|start| M[start_in_background]
L --> M
M --> N[IpcClient::connect autostart=false]
N --> O[Supervisor started]
I -->|stop| P[info: Stopped]
D -->|stop| Q[StateFile cleanup + warn stale]
Reviews (13): Last reviewed commit: "fix: sudo supervisor" | Re-trigger Greptile |
22619bb to
db8809d
Compare
db8809d to
d9b3e2f
Compare
f4c1339 to
8758767
Compare
9d49d24 to
cdaba87
Compare
be84e16 to
de56793
Compare
fix: error handling when trying to kill sudo supervisor fix: misc [autofix.ci] apply automated fixes fix: misc fix: misc Merge branch 'main' into fix-kill-sudo-sup
de56793 to
38708cf
Compare
|
@jdx ready for review! |
## 🤖 New release * `pitchfork-cli`: 2.5.0 -> 2.6.0 <details><summary><i><b>Changelog</b></i></summary><p> <blockquote> ## [2.6.0](v2.5.0...v2.6.0) - 2026-04-12 ### Added - *(proxy)* auto start when visiting the proxied URL ([#347](#347)) ### Fixed - some issues related to sudo supervisor ([#323](#323)) - *(port)* should fail when ready_port is in use ([#350](#350)) - *(deps)* update rcgen to 0.14 ([#349](#349)) - *(deps)* update reqwest to 0.13 ([#348](#348)) - detect port conflicts on loopback addresses, not just 0.0.0.0 ([#345](#345)) - narrow REAPED_STATUSES cfg to non-Linux unix only ([#346](#346)) - *(deps)* update rust crate ratatui to 0.30 ([#331](#331)) - *(deps)* update rust crate toml to v1 ([#344](#344)) - *(deps)* update rust crate strum to 0.28 ([#334](#334)) - *(deps)* update rust crate notify-debouncer-full to 0.7 ([#330](#330)) - *(deps)* update rust crate nix to 0.31 ([#329](#329)) - *(deps)* update rust crate listeners to 0.5 ([#328](#328)) - *(deps)* update rust crate sysinfo to 0.38 ([#335](#335)) - *(deps)* update rust crate cron to 0.16 ([#324](#324)) - *(deps)* update rust crate crossterm to 0.29 ([#325](#325)) ### Other - *(deps)* update rust crate rmcp to v1.4.0 ([#327](#327)) </blockquote> </p></details> --- This PR was generated with [release-plz](https://github.com/release-plz/release-plz/). <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Low risk: this PR only bumps the crate version and updates release notes, with no runtime code changes. > > **Overview** > Prepares the `pitchfork-cli` **v2.6.0** release by bumping the package version from `2.5.0` to `2.6.0` in `Cargo.toml`/`Cargo.lock`. > > Updates `CHANGELOG.md` with the `2.6.0` release notes (proxy auto-start behavior, several fixes, and dependency updates). > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit faea6c5. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
When launching supervisor with
sudo(I've never done this before until thehttps proxyfeature), there exists some issues to be fixed.