Scripts: preserve the calling shell environment after smoke runs #516

Closed
wileyGray wants to merge 1 commit from upstream-pr/521 into main
wileyGray commented 2026-11-24 01:14:44 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by wileyGray on 2026-11-24T01:14:44Z.


Running scripts/smoke.ps1 left networking disabled for later XCL runs in the same PowerShell session and erased the caller's time limit and activity setting. The child now inherits the smoke settings and the calling shell gets its original values back as soon as the child starts, including when launch fails.

What is in it

  • scripts/smoke.ps1 restores the three XCL_* values in finally around Process.Start. scripts/smoke-environment.tests.ps1 checks the child environment, set and absent parent variables, and a failed launch.

Tested

  • Windows build 26300, i9-14900K, RTX 4080 SUPER (32.0.16.2114) and Intel UHD 770 (32.0.101.7088). The script fixture launches a .cmd stand-in.
  • powershell.exe -NoProfile -NonInteractive -File scripts/smoke-environment.tests.ps1 and the same command with pwsh.exe. All three cases passed on Windows PowerShell 5.1.26100.9818 and PowerShell 7.6.9. The same test on base 7ebf1b8 failed on both because XCL_NETWORK was overwritten.
  • scripts/test-native-stderr.tests.ps1 also passed under both shells.
  • Debug build at 9bb6aa2 with Rust 1.93.0 MSVC and DXC 1.9.2609.5. cargo build --locked --workspace --offline passed. cargo test --workspace -- --test-threads=4 reported 677 passed, 0 failed, 41 ignored. Two GPU tests reported SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask and gpu_wave32_program_in_wave64_hardware.

Not tested

  • Retail titles, optional game samples (XCL_SAMPLE_* unset), and the D3D12 debug layer (unavailable).

AI use

  • Codex (gpt-6.2-astra) wrote the fix, regression test and description and ran the script checks.
<!-- greyfinch-sync:ivall/xcl:issue:5464198524 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/521). Originally posted by [wileyGray](https://github.com/wileyGray) on 2026-11-24T01:14:44Z. --- Running `scripts/smoke.ps1` left networking disabled for later XCL runs in the same PowerShell session and erased the caller's time limit and activity setting. The child now inherits the smoke settings and the calling shell gets its original values back as soon as the child starts, including when launch fails. **What is in it** - `scripts/smoke.ps1` restores the three `XCL_*` values in `finally` around `Process.Start`. `scripts/smoke-environment.tests.ps1` checks the child environment, set and absent parent variables, and a failed launch. **Tested** - Windows build 26300, i9-14900K, RTX 4080 SUPER (32.0.16.2114) and Intel UHD 770 (32.0.101.7088). The script fixture launches a `.cmd` stand-in. - `powershell.exe -NoProfile -NonInteractive -File scripts/smoke-environment.tests.ps1` and the same command with `pwsh.exe`. All three cases passed on Windows PowerShell 5.1.26100.9818 and PowerShell 7.6.9. The same test on base `7ebf1b8` failed on both because `XCL_NETWORK` was overwritten. - `scripts/test-native-stderr.tests.ps1` also passed under both shells. - Debug build at `9bb6aa2` with Rust 1.93.0 MSVC and DXC 1.9.2609.5. `cargo build --locked --workspace --offline` passed. `cargo test --workspace -- --test-threads=4` reported 677 passed, 0 failed, 41 ignored. Two GPU tests reported SKIPPED (no wave64): `gpu_geometry_wave32_prefix_count_over_a_mask` and `gpu_wave32_program_in_wave64_hardware`. **Not tested** - Retail titles, optional game samples (`XCL_SAMPLE_*` unset), and the D3D12 debug layer (unavailable). **AI use** - Codex (gpt-6.2-astra) wrote the fix, regression test and description and ran the script checks.
futurepro62 commented 2026-11-24 07:05:35 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-24T02:32:17Z.


Tested exact head 9bb6aa2.

Tested

  • Windows 11 Home 26300, Windows PowerShell 5.1.26100.9818 (no PowerShell 7 on this machine).
  • powershell -NoProfile -File scripts/smoke-environment.tests.ps1 on 9bb6aa2: passed (exit 0).
  • Control: the same test file against scripts/smoke.ps1 of the parent commit 7ebf1b8: fails (exit 1) with The smoke run changed XCL_NETWORK in the calling shell.. So the test catches what the PR fixes.
  • scripts/test-native-stderr.tests.ps1 on 9bb6aa2: passed.

Not tested

  • PowerShell 7 (pwsh), a real scripts/smoke.ps1 run on a title (no title on this machine), the Rust suite (the PR changes no Rust).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and the control and wrote this report. I checked it before posting.
<!-- greyfinch-sync:ivall/xcl:comment:7120241165 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/521#issuecomment-7120241165). Originally posted by [futurepro62](https://github.com/futurepro62) on 2026-11-24T02:32:17Z. --- Tested exact head `9bb6aa2`. **Tested** - Windows 11 Home 26300, Windows PowerShell 5.1.26100.9818 (no PowerShell 7 on this machine). - `powershell -NoProfile -File scripts/smoke-environment.tests.ps1` on `9bb6aa2`: passed (exit 0). - Control: the same test file against `scripts/smoke.ps1` of the parent commit `7ebf1b8`: fails (exit 1) with `The smoke run changed XCL_NETWORK in the calling shell.`. So the test catches what the PR fixes. - `scripts/test-native-stderr.tests.ps1` on `9bb6aa2`: passed. **Not tested** - PowerShell 7 (`pwsh`), a real `scripts/smoke.ps1` run on a title (no title on this machine), the Rust suite (the PR changes no Rust). **AI use** - Claude Code (Claude Opus 5.5) ran the tests and the control and wrote this report. I checked it before posting.
2968412091-ui commented 2026-11-24 07:05:55 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by 2968412091-ui on 2026-11-24T03:35:01Z.


Independent PowerShell 7 check on Windows x64 build 26200. I ran scripts/smoke-environment.tests.ps1 from 9bb6aa2e using -NoProfile -File.

smoke.ps1 revision Shell Result
main 91f9a5e9 PowerShell 7.6.9 Exit 1: The smoke run changed XCL_NETWORK in the calling shell.
PR 9bb6aa2e PowerShell 7.6.9 Exit 0
PR 9bb6aa2e Windows PowerShell 5.1.26100.9818 Exit 0

The synthetic fixture checked the child environment and restoration of the parent environment, including a failed launch. No GPU, retail title, or Rust workspace tests were run for this report.

AI use: Codex (GPT-6.2-astra) ran the tests and prepared this report.

<!-- greyfinch-sync:ivall/xcl:comment:7121232583 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/521#issuecomment-7121232583). Originally posted by [2968412091-ui](https://github.com/2968412091-ui) on 2026-11-24T03:35:01Z. --- Independent PowerShell 7 check on Windows x64 build 26200. I ran `scripts/smoke-environment.tests.ps1` from `9bb6aa2e` using `-NoProfile -File`. | smoke.ps1 revision | Shell | Result | |---|---|---| | main `91f9a5e9` | PowerShell 7.6.9 | Exit 1: `The smoke run changed XCL_NETWORK in the calling shell.` | | PR `9bb6aa2e` | PowerShell 7.6.9 | Exit 0 | | PR `9bb6aa2e` | Windows PowerShell 5.1.26100.9818 | Exit 0 | The synthetic fixture checked the child environment and restoration of the parent environment, including a failed launch. No GPU, retail title, or Rust workspace tests were run for this report. AI use: Codex (GPT-6.2-astra) ran the tests and prepared this report.
Alpha325 commented 2026-11-25 03:05:51 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Alpha325 on 2026-11-25T02:51:42Z.


I tested 9bb6aa2efcfcb80b58187da5dc9f39a8df3a9a74 against its parent 7ebf1b8 on Windows PowerShell 5.1.26100.9818 and PowerShell 7.6.9.

A synthetic child recorded XCL_NETWORK, XCL_RUN_SECONDS, and XCL_ACTIVITY, then waited for a release file. While it was still waiting, the child had the smoke settings (0 2 1) and the parent had its original settings (17 23 29). On the parent commit, the calling shell still exposed 0 2 1 at that same point. Both shells reproduced the difference.

I also temporarily deferred restoration until the child exited on the PR. On PowerShell 7.6.9, the bundled fixture still passed, while the new fixture failed as expected. I restored smoke.ps1 after that control.

AI use — OpenAI Codex (GPT-6) wrote and ran the synthetic fixture and drafted this report.

<!-- greyfinch-sync:ivall/xcl:comment:7151281863 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/521#issuecomment-7151281863). Originally posted by [Alpha325](https://github.com/Alpha325) on 2026-11-25T02:51:42Z. --- I tested `9bb6aa2efcfcb80b58187da5dc9f39a8df3a9a74` against its parent `7ebf1b8` on Windows PowerShell 5.1.26100.9818 and PowerShell 7.6.9. A synthetic child recorded `XCL_NETWORK`, `XCL_RUN_SECONDS`, and `XCL_ACTIVITY`, then waited for a release file. While it was still waiting, the child had the smoke settings (`0 2 1`) and the parent had its original settings (`17 23 29`). On the parent commit, the calling shell still exposed `0 2 1` at that same point. Both shells reproduced the difference. I also temporarily deferred restoration until the child exited on the PR. On PowerShell 7.6.9, the bundled fixture still passed, while the new fixture failed as expected. I restored `smoke.ps1` after that control. AI use — OpenAI Codex (GPT-6) wrote and ran the synthetic fixture and drafted this report.
DavidM1911 commented 2026-11-25 14:10:10 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T13:53:37Z.


Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7164443111 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/521#issuecomment-7164443111). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T13:53:37Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!
RavenCurseBurg commented 2026-11-25 21:05:21 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by RavenCurseBurg on 2026-11-25T20:36:47Z.


Tested on 9bb6aa2efcfcb80b58187da5dc9f39a8df3a9a74, Windows 11 build 26100.9711, Core i7-13700. A native fixture initialized a Windows environment variable to the empty string with SetEnvironmentVariableW. I rotated the empty, absent and non-ASCII values through XCL_NETWORK, XCL_RUN_SECONDS and XCL_ACTIVITY. For each rotation I ran scripts/smoke.ps1 -Seconds 2 once with a working fixture executable and once with a directory as -Xcl to make Process.Start fail. I compared the Windows environment block before and after.

Calling shell Empty value after the call Absent and non-ASCII values
Windows PowerShell 5.1 Became absent in all 6 cases Preserved
PowerShell 7.6.9 Preserved in all 6 cases Preserved

Every successful child saw 0 / 2 / 1. Invoking the script in a separate PowerShell process preserved all three values in the outer caller for every case on both editions. I added that verified invocation to the script help. Both shells also passed -NoProfile -ExecutionPolicy Bypass -File scripts/smoke-environment.tests.ps1.

Not tested — A retail launch, GPU execution, or the Rust workspace. OpenAI Codex (GPT-6) prepared and ran the fixtures, wrote the help text, and prepared this report.

<!-- greyfinch-sync:ivall/xcl:comment:7173928019 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/521#issuecomment-7173928019). Originally posted by [RavenCurseBurg](https://github.com/RavenCurseBurg) on 2026-11-25T20:36:47Z. --- **Tested** on `9bb6aa2efcfcb80b58187da5dc9f39a8df3a9a74`, Windows 11 build 26100.9711, Core i7-13700. A native fixture initialized a Windows environment variable to the empty string with `SetEnvironmentVariableW`. I rotated the empty, absent and non-ASCII values through `XCL_NETWORK`, `XCL_RUN_SECONDS` and `XCL_ACTIVITY`. For each rotation I ran `scripts/smoke.ps1 -Seconds 2` once with a working fixture executable and once with a directory as `-Xcl` to make `Process.Start` fail. I compared the Windows environment block before and after. | Calling shell | Empty value after the call | Absent and non-ASCII values | |---|---|---| | Windows PowerShell 5.1 | Became absent in all 6 cases | Preserved | | PowerShell 7.6.9 | Preserved in all 6 cases | Preserved | Every successful child saw `0 / 2 / 1`. Invoking the script in a separate PowerShell process preserved all three values in the outer caller for every case on both editions. I added that verified invocation to the [script help](https://github.com/RavenCurseBurg/xcl/commit/0232b8d6d4a7c2f2d5981e146b422eaabed26d03). Both shells also passed `-NoProfile -ExecutionPolicy Bypass -File scripts/smoke-environment.tests.ps1`. **Not tested** — A retail launch, GPU execution, or the Rust workspace. OpenAI Codex (GPT-6) prepared and ran the fixtures, wrote the help text, and prepared this report.
github-actions[bot] commented 2026-11-30 08:39:54 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-30T08:39:54Z.


Nothing has happened on this PR for 3 days, so it is marked stale and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto main if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.

<!-- greyfinch-sync:ivall/xcl:comment:7273188959 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/521#issuecomment-7273188959). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-11-30T08:39:54Z. --- Nothing has happened on this PR for 3 days, so it is marked `stale` and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto `main` if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.
Foniass commented 2026-12-01 03:38:42 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T03:38:42Z.


Triage (#1607) – head 9bb6aa2

Main already fixes this. Commit 50f2961 (#3460) sets XCL_PREPARE, XCL_NETWORK, XCL_RUN_SECONDS and XCL_ACTIVITY on $psi.EnvironmentVariables, and smoke.ps1 no longer sets or removes them in the calling shell. #2714 makes the same fix with the approach main took.
This PR saves and restores $env: around Process.Start instead. It avoids reading EnvironmentVariables, which on Windows PowerShell 5.1 can throw when both Path and PATH exist. If that case matters, it could be raised against main's version.
Recommendation: close (superseded by main commit 50f2961).

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

<!-- greyfinch-sync:ivall/xcl:comment:7299918662 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/521#issuecomment-7299918662). Originally posted by [Foniass](https://github.com/Foniass) on 2026-12-01T03:38:42Z. --- **Triage (#1607)** – head 9bb6aa2 Main already fixes this. Commit 50f2961 (#3460) sets `XCL_PREPARE`, `XCL_NETWORK`, `XCL_RUN_SECONDS` and `XCL_ACTIVITY` on `$psi.EnvironmentVariables`, and `smoke.ps1` no longer sets or removes them in the calling shell. #2714 makes the same fix with the approach main took. This PR saves and restores `$env:` around `Process.Start` instead. It avoids reading `EnvironmentVariables`, which on Windows PowerShell 5.1 can throw when both `Path` and `PATH` exist. If that case matters, it could be raised against main's version. Recommendation: close (superseded by main commit 50f2961). AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
throny commented 2026-12-01 12:38:19 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by throny on 2026-12-01T12:38:19Z.


Closing as superseded: this change is already on main (50f29611). PR only changes smoke.ps1 env handling (+ a test script); main 50f29611 sets XCL_NETWORK/XCL_RUN_SECONDS/XCL_ACTIVITY on $psi.EnvironmentVariables (scripts/smoke.ps1 lines 57-61), the caller's $env is untouched

Two independent checks found this: Foniass's close list on #1607 and ours against current main. If something here is still missing on main, say so and reopen it, or ask and I will.

AI use: Claude Code (Claude Opus 5.5); the per-PR comparison was done by Claude Sonnet 5.5 sub-agents.

<!-- greyfinch-sync:ivall/xcl:comment:7311427536 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/521#issuecomment-7311427536). Originally posted by [throny](https://github.com/throny) on 2026-12-01T12:38:19Z. --- Closing as superseded: this change is already on `main` (50f29611). PR only changes smoke.ps1 env handling (+ a test script); main 50f29611 sets XCL_NETWORK/XCL_RUN_SECONDS/XCL_ACTIVITY on $psi.EnvironmentVariables (scripts/smoke.ps1 lines 57-61), the caller's $env is untouched Two independent checks found this: Foniass's close list on #1607 and ours against current `main`. If something here is still missing on `main`, say so and reopen it, or ask and I will. AI use: Claude Code (Claude Opus 5.5); the per-PR comparison was done by Claude Sonnet 5.5 sub-agents.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
xcl-dev/xcl!516
No description provided.