Repository navigation
fix(cli): one trusted PATH rule for the engine and CLI; say why a project copy was skipped - #7801
Conversation
…ject copy was skipped The Windows PATH rules (quoted entries, the %SystemRoot% folders) now live in the parsers' trustedPathDirs, so engine helper lookups and the CLI's PATH rewrite apply the same rule. When sam, aws, gcloud, docker, git or npx is not found but a copy sits in a project folder the rule skipped, the message names that copy by its path relative to the project and says why it was not used. cloudrun now reports a missing gcloud or docker as not found instead of "exited with null". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The shared trusted-folder rule now splits PATH on ';' whenever the platform is win32, as Windows does. Two tests that pretend to be Windows on Linux built PATH with ':', so the rule saw one folder instead of two. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jrusso1020
left a comment
There was a problem hiding this comment.
Reviewed at 79d5314
Merits verdict: APPROVE — no blocker found. Posted as COMMENT because this PR and the reviewer use the same GitHub account.
The shared parser retains Windows PATH splitting on semicolons, removes paired entry quotes, and preserves the existing SystemRoot-folder exceptions when those folders appear on PATH. POSIX tilde expansion and directory trust checks are unchanged. Both the CLI rewrite and engine helper lookup now use that implementation. The browser/whisper fixture changes correct the separator for the simulated platform while retaining rejection of the project copy and selection of the outside copy.
The new hint checks skipped PATH folders without running their programs. It emits a path relative to cwd only after excluding parent/sibling and absolute results. The SAM/AWS, Cloud Run, Docker and skills call sites append it to failure diagnostics; it does not change successful execution or authorize a skipped program.
Validation: frozen install and full bun run build passed. bun run --cwd packages/parsers test src/trustedExecutable.test.ts src/ffBinaries.test.ts --maxWorkers=1 passed 31 tests. The eight focused CLI suites for PATH filtering, hints, Docker errors, SAM, Cloud Run, skills, whisper and browser resolution passed 159 tests. Replacing trustedPathDirs with its base implementation caused exactly four Windows regression failures; removing the SAM hint caused its new assertion to fail. Both mutations were restored. Windows behavior was simulated on Linux; no native Windows or live cloud deployment test was run.
Nit: projectCopyHint.ts:26 interpolates a project-controlled filename into terminal text. Quote/escape control characters in the displayed relative path (for example, display JSON.stringify(copy)) so unusual folder names cannot alter the diagnostic's presentation. This does not affect the executable trust decision.
Need: yes · Size: ok · Reuse: shared trustedPathDirs, pathEntries and executableIn · Simpler: one PATH policy for CLI and engine · Structure: fine (checked the former CLI Windows policy, parser lookup and all hint consumers; no further split)
Risk: medium — shared executable discovery changes on Windows; native Windows validation remains limited.
Verdict: APPROVE on the merits (COMMENT only on this account's own PR).
Reasoning: The Windows rules are consolidated without widening POSIX trust, the new hint avoids absolute project paths, and the relevant regressions fail when the fixes are removed.
— Rames
miguel-heygen
left a comment
There was a problem hiding this comment.
Reviewed at 79d5314. The idea is right and every bare-name CLI call is covered once cli.ts:35 rewrites PATH, but the branch predates hf#7845 and rewrites the same file (mergeStateStatus DIRTY).
Blocking:
- As written it would undo hf#7845: main's trustedExecutable.ts:48-62 drops every ancestor node_modules (:39-45) and the whole project root (:31-37) and matches not-yet-existing folders by real location; this version (:27-34, :78-90) only drops folders inside the working directory. Rebase, fold the Windows system-folder rule and the quote handling into main's single rule, keep #7845's tests.
- projectCopyHint.ts:5-7,17 names only copies inside the working directory, so the common ../node_modules/.bin case (npm/pnpm scripts) gets no hint. Name any copy main's rule skipped, as a relative ../ path.
Not blocking:
3. trustedPathDirs (:78-90): platform changes how PATH is split but the trust check uses the real OS's rules; pass it through or drop the setting.
4. Windows system folders trusted by name (:63-75,87): fine.
Resolve trustedExecutable.ts onto main's single trust rule: trustedPathDirs filters PATH with main's trustRule() (project root and ancestor node_modules included) and adds this branch's Windows system folders and quoted-entry handling on top of it, rather than replacing it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ATH to the shared rule The not-found hint now names any copy the trusted PATH rule skipped, relative to the working folder, including ../node_modules/.bin when an npm or pnpm script runs from a subfolder. A Windows test pins that quoted PATH entries still go through the shared rule, so the project root's and ancestors' node_modules/.bin stay skipped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks. Main is merged in and both blockers are addressed at
Checks:
|
miguel-heygen
left a comment
There was a problem hiding this comment.
Approved at fc8dc18. Both blockers fixed: main's single rule in trustedExecutable.ts is unchanged (project root :42-48, ancestor node_modules :50-56, real location of not-yet-existing folders :21-33) with quote handling and the Windows system folders folded in at :89-130, the separate windowsExeSearch copy is gone, and every #7845 test is still there plus a Windows one. projectCopyHint.ts now names any skipped copy, ../node_modules/.bin included. One thing before merge: the Comments check is red on projectCopyHint.ts's comment share (5 of 35 lines vs the package's 9.3%); cut about two comment lines.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* chore: release v0.9.55 * chore: release v0.9.55 notes include heygen-com#7830 * chore: release v0.9.55 notes include heygen-com#7859 and heygen-com#7867 * chore: release v0.9.55 notes name the docs change and cloud render * chore: release v0.9.55 notes include heygen-com#7866 and heygen-com#7801 * chore: release v0.9.55 notes match the style bar
Engine helper lookups and the CLI's PATH rewrite now use one trusted-folder rule, including the Windows cases. When
sam,aws,gcloud,docker,gitornpxisn't found but the project holds a copy the rule skipped, the error now names that copy and says why it wasn't used.Claude Opus 5.5
One rule
The Windows PATH rules the CLI added (reading
"C:\Program Files\..."entries without their quotes, and always keeping the%SystemRoot%folders:Windows,System32,Wbem,WindowsPowerShell\v1.0) now live intrustedPathDirsinpackages/parsers/src/trustedExecutable.ts. It takes optionalplatformandenvarguments that default to the running process. The CLI'swithOnlyTrustedPathFolderscalls it directly, sofindTrustedExecutable(used by the engine fornvidia-smi,vm_stat,psandtasklist) can't disagree with the CLI.User effect: on Windows the engine now finds helpers in quoted PATH entries, and finds
tasklistwhen started from insideSystem32. Linux and macOS are unchanged.Why a project copy was skipped
New
projectCopyHint(name)inpackages/cli/src/utils/projectCopyHint.tslooks through the PATH the CLI started with for folders the trusted rule dropped. If one holdsname, it returns a sentence naming the copy by its path relative to the working directory (never an absolute path), for example:With no such copy the message is unchanged. Used in:
lambda(sam,aws)cloudrun(gcloud,docker): a missing program is now reported as not found instead of "exited with null"render --docker(the "Docker not available" hint)skills(git,npx)executableInandpathEntriesare exported from the parsers so the hint reuses the same program check and PATH parsing.Verification
trustedPathDirs on Windows(quoted entry, System32 kept, SystemRoot honoured) and the WindowsfindTrustedExecutablecase with a quoted entry; CLIprojectCopyHinttests (copy named relative to the project, relative PATH entry, no copy, never a copy outside the working directory) and alambdatest for thesammessage. With the parsers change reverted the 4 Windows tests fail; with thesamhint reverted its test fails.parsers: 1506 passed. CLI utils, lambda, doctor, skills, cloudrun: all non-browser tests pass.samin.venv/binandgcloudinnode_modules/.bin: both messages name the copy; from a project without them the messages are unchanged.Authored by Rames (api-platform).
🤖 Generated with Claude Code