Skip to content

fix: pass cwd to ready_cmd spawning#243

Merged
jdx merged 1 commit intojdx:mainfrom
gaojunran:fix/ready_cmd_cwd
Feb 21, 2026
Merged

fix: pass cwd to ready_cmd spawning#243
jdx merged 1 commit intojdx:mainfrom
gaojunran:fix/ready_cmd_cwd

Conversation

@gaojunran
Copy link
Contributor

fixes #240.

Copilot AI review requested due to automatic review settings February 21, 2026 10:00
@gemini-code-assist
Copy link

Summary of Changes

Hello @gaojunran, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a bug where readiness commands might not execute correctly due to an implicit or incorrect current working directory. By explicitly setting the working directory for these commands to the daemon's directory, it ensures reliable execution of readiness checks.

Highlights

  • Readiness Command Execution: The current working directory (CWD) is now explicitly passed to the ready_cmd when it is spawned, ensuring that readiness checks execute in the correct context and resolving issues where commands might fail due to an incorrect working directory.
Changelog
  • src/supervisor/lifecycle.rs
    • Captured the daemon's directory from opts.dir to be used for process spawning.
    • Applied the captured daemon directory as the current working directory for the ready_cmd process.
Activity
  • No activity has been recorded for this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The pull request addresses an issue where the ready_cmd was not being executed in the correct working directory, leading to potential failures in readiness checks. The changes correctly capture the daemon's working directory and apply it to the ready_cmd execution. This is a good fix for the reported bug.

let ready_http = opts.ready_http.clone();
let ready_port = opts.ready_port;
let ready_cmd = opts.ready_cmd.clone();
let daemon_dir = opts.dir.clone();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Cloning opts.dir here is good to ensure the daemon_dir is available within the tokio::spawn block, as opts itself might not live long enough or be moved.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes readiness-check command execution by ensuring ready_cmd is spawned with the daemon’s configured working directory (opts.dir), aligning command readiness checks with how the daemon process itself is launched.

Changes:

  • Capture the daemon working directory from RunOptions.
  • Set current_dir when spawning the ready_cmd readiness check command.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 431 to 436
let mut command = Shell::default_for_platform().command(cmd);
command
.current_dir(&daemon_dir)
.stdout(std::process::Stdio::null())
.stderr(std::process::Stdio::null());
let result: std::io::Result<std::process::ExitStatus> = command.status().await;
Copy link

Copilot AI Feb 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new behavior of running ready_cmd with the daemon’s working directory isn’t covered by existing tests. There is already an e2e test for ready_cmd, but it uses an absolute path so it wouldn’t catch regressions where the readiness command runs from the supervisor’s CWD. Please add/adjust an e2e test to use a relative path (e.g., have the daemon create ./ready in its configured dir and set ready_cmd = "test -f ./ready").

Copilot uses AI. Check for mistakes.
@jdx jdx merged commit ddaa0fc into jdx:main Feb 21, 2026
7 of 8 checks passed
@jdx jdx mentioned this pull request Feb 21, 2026
jdx added a commit that referenced this pull request Feb 21, 2026
## 🤖 New release

* `pitchfork-cli`: 1.5.0 -> 1.6.0

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

<blockquote>

## [1.6.0](v1.5.0...v1.6.0) -
2026-02-21

### Added

- *(web)* add PITCHFORK_WEB_PATH support for reverse proxy path prefixes
([#244](#244))
- add daemon lifecycle hooks and retry count env vars
([#245](#245))

### Fixed

- pass cwd to ready_cmd spawning
([#243](#243))
</blockquote>


</p></details>

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

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Release-only version/documentation updates; no functional code changes
are included in this diff.
> 
> **Overview**
> Prepares the `pitchfork-cli` **v1.6.0** release by bumping the
crate/version metadata from `1.5.0` to `1.6.0` (including `Cargo.toml`,
`Cargo.lock`, and generated CLI docs/spec files).
> 
> Updates `CHANGELOG.md` with the new `1.6.0` entry summarizing the
release’s added features and the `ready_cmd` working-directory fix.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
e00649e. 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>
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.

3 participants