Skip to content

fix(plan): run synthetic requests in the handler's cwd - #1005

Open
jong-kyung wants to merge 2 commits into
voidzero-dev:mainfrom
jong-kyung:fix/synthetic-honors-script-cwd
Open

jong-kyung wants to merge 2 commits into
voidzero-dev:mainfrom
jong-kyung:fix/synthetic-honors-script-cwd

Conversation

@jong-kyung

Copy link
Copy Markdown
Contributor

Motivation

In Vite+, a cached task whose command starts with vp -C <dir> ignores the cache settings of its subcommand, as reported in voidzero-dev/vite-plus#3503. For example, vp -C . lint does not track OXLINT_TSGOLINT_PATH, so changing it replays the cache, and the variable never reaches the command. The Vite+ command handler returns Verbatim for a leading -C because it has no way to run a synthesized command in another directory. A handler can already change ScriptCommand.cwd, and verbatim commands and nested vp run queries use the changed cwd. Synthetic requests ignored it and always ran in the task's cwd.

Change

Synthetic requests now run in script_command.cwd, so a handler that changes the cwd gets the same result for all three kinds of request. The cwd change applies only to that command, which means later commands in the same && chain keep the task's cwd. Input globs based on the package still resolve against the task's package, as they do after cd.

The test handler in vt_bin gains vt tool -C <dir> so that a plan snapshot can cover a handler that changes the cwd.

Planned follow-up in Vite+

After this merges, the Vite+ handler will remove a leading -C <dir> from the command, set command.cwd to the target directory, and then handle the rest of the command exactly as it would without -C. This makes vp -C <dir> <command> in a task behave like cd <dir> && vp <command>. Every subcommand then uses its own cache settings, package manager commands are no longer cached, and vp -C <dir> run expands in the same session. When the directory does not exist or is outside the workspace, the handler keeps the current verbatim behavior so that vp reports the error the same way as a direct invocation.

A command handler can change `ScriptCommand.cwd`, and verbatim commands
and nested `vp run` queries already use the changed cwd. Synthetic
requests ignored it and ran in the task's cwd, so a handler could not
synthesize a command for another directory, such as `vp -C <dir> lint`.

Co-authored-by: Claude Opus 5.5 <[email protected]>
@jong-kyung

Copy link
Copy Markdown
Contributor Author

cc @fengmk2

@jong-kyung

Copy link
Copy Markdown
Contributor Author

@codex review

@jong-kyung
jong-kyung marked this pull request as ready for review November 21, 2026 04:59
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-21T05:03:44.763654Z e572e2d Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Comment thread crates/vt_plan/src/plan_request.rs Resolved
@fengmk2 fengmk2 self-assigned this Nov 22, 2026

This branch has not been deployed

No deployments
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.

2 participants