[GH-ISSUE #1498] fix(process): resolve scenario executables with the Windows environment key the child inherits #514

Closed
opened 2026-10-15 18:25:46 +00:00 by bsakaguchi · 1 comment
Owner

Originally created by @cursor[bot] on GitHub (Oct 10, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/1498

TL;DR: On Windows, resolving a scenario executable reads only environment.PATH. The child process is started from a snapshot that canonicalizes Path and PATH as one variable. The executable can be resolved with a different search path than the one the child inherits.

Area

Process capture

Observed behavior

resolveProcessScenarioRuntimePaths in src/process/capture/ProcessScenarioRuntimeValidation.ts passes:

scenario.environment.PATH ?? environment.PATH ?? ""

to resolveExecutable. Windows environment names are case-insensitive. A scenario that sets Path (the usual Windows spelling) does not satisfy scenario.environment.PATH, so resolution falls through to the ambient PATH.

snapshotEnvironment in src/process/snapshotEnvironment.ts is the other boundary. On win32 it upper-cases keys and keeps the first lexicographic spelling, which is what Node forwards to the child. The comment there records that rule. The resolver does not use it.

The captured process can therefore be a different executable than the one the scenario's Path would have selected, while the child still sees that Path.

Expected behavior

Executable resolution should use the same Windows key canonicalization as the child environment snapshot, before searching for the command.

Where

  • src/process/capture/ProcessScenarioRuntimeValidation.ts — resolveProcessScenarioRuntimePaths
  • src/process/snapshotEnvironment.ts — snapshotEnvironment
Originally created by @cursor[bot] on GitHub (Oct 10, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/1498 **TL;DR:** On Windows, resolving a scenario executable reads only `environment.PATH`. The child process is started from a snapshot that canonicalizes `Path` and `PATH` as one variable. The executable can be resolved with a different search path than the one the child inherits. ### Area Process capture ### Observed behavior `resolveProcessScenarioRuntimePaths` in `src/process/capture/ProcessScenarioRuntimeValidation.ts` passes: ```ts scenario.environment.PATH ?? environment.PATH ?? "" ``` to `resolveExecutable`. Windows environment names are case-insensitive. A scenario that sets `Path` (the usual Windows spelling) does not satisfy `scenario.environment.PATH`, so resolution falls through to the ambient `PATH`. `snapshotEnvironment` in `src/process/snapshotEnvironment.ts` is the other boundary. On `win32` it upper-cases keys and keeps the first lexicographic spelling, which is what Node forwards to the child. The comment there records that rule. The resolver does not use it. The captured process can therefore be a different executable than the one the scenario's `Path` would have selected, while the child still sees that `Path`. ### Expected behavior Executable resolution should use the same Windows key canonicalization as the child environment snapshot, before searching for the command. ### Where - `src/process/capture/ProcessScenarioRuntimeValidation.ts` — `resolveProcessScenarioRuntimePaths` - `src/process/snapshotEnvironment.ts` — `snapshotEnvironment`
bsakaguchi 2026-10-15 18:25:46 +00:00
Author
Owner

@morluto commented on GitHub (Oct 10, 2026):

Thanks for reporting this. Closing as resolved on main. Scenario executable resolution now uses snapshotEnvironment for both scenario and inherited PATH lookup, matching Windows environment-key selection for the child.

Merged fix. I checked the current source against this report; no tests or real-provider workflows were run for this closure pass.

<!-- gh-comment-id:6099802733 --> @morluto commented on GitHub (Oct 10, 2026): Thanks for reporting this. Closing as resolved on main. Scenario executable resolution now uses snapshotEnvironment for both scenario and inherited PATH lookup, matching Windows environment-key selection for the child. [Merged fix](https://github.com/morluto/rea/commit/b4db35f092d7166aebdf4387b48f7652b1d1c3b6). I checked the current source against this report; no tests or real-provider workflows were run for this closure pass.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#514
No description provided.