Fix PowerShell $PID variable conflict in start-lemonade.ps1#331
Merged
kovtcharov-amd merged 14 commits intomainfrom Feb 10, 2026
Merged
Fix PowerShell $PID variable conflict in start-lemonade.ps1#331kovtcharov-amd merged 14 commits intomainfrom
kovtcharov-amd merged 14 commits intomainfrom
Conversation
Changed variable name from $pid to $processId to avoid conflict with PowerShell's read-only automatic variable $PID. This was causing "Cannot overwrite variable PID" errors on machines with stricter PowerShell configurations, leading to CI test failures. The functional tests passed but the script returned exit code 1 due to this early error during port availability checking. Co-Authored-By: Claude Sonnet 4.5 (1M context) <[email protected]>
Enable label-based runner selection for lemonade smoke test. When a PR has the 'stx-test' label, it will run on the stx-test machine instead of the default stx runner. Co-Authored-By: Claude Sonnet 4.5 (1M context) <[email protected]>
Extended the stx-test label-based runner selection to all 6 remaining workflows that use stx runners: - test_api.yml - test_chat_sdk.yml - test_embeddings.yml - test_gaia_cli_windows.yml - test_rag.yml - test_sd.yml Now any PR with the 'stx-test' label will run all CI workflows on the stx-test machine instead of the default stx runner. This provides consistent testing infrastructure across all workflows. Co-Authored-By: Claude Sonnet 4.5 (1M context) <[email protected]>
When multiple connections exist on the same port (e.g., IPv4 and IPv6), Get-NetTCPConnection returns an array. This caused the PID to be displayed multiple times (e.g., "9152 9152") and potentially failed to kill all processes properly. Now we extract unique PIDs and kill each one individually. Co-Authored-By: Claude Sonnet 4.5 (1M context) <[email protected]>
The test_lemonade_server.yml workflow was missing the install-lemonade action that verifies lemonade-server is pre-installed on the runner. This caused the script to fail with "lemonade-server not found" error. All other workflows (test_api, test_chat_sdk, test_embeddings, test_gaia_cli_windows, test_rag) include this verification step. The install-lemonade action: - Verifies lemonade-server exists on PATH - Checks version compatibility with GAIA - Exports LEMONADE_SERVER_PATH environment variable Co-Authored-By: Claude Sonnet 4.5 (1M context) <[email protected]>
The action previously only checked if lemonade-server was in PATH, which fails when it's installed but not added to system PATH. Now the action: 1. First checks PATH (fast path for properly configured runners) 2. If not found, searches common Windows installation locations: - %LOCALAPPDATA%\Programs\Lemonade - %ProgramFiles%\Lemonade - %ProgramFiles(x86)%\Lemonade - %USERPROFILE%\Lemonade - %LOCALAPPDATA%\Lemonade 3. Automatically adds found directory to GITHUB_PATH for the job 4. Provides clear error with searched paths if not found This makes the action more robust for self-hosted runners where lemonade-server may be installed without being in system PATH. Co-Authored-By: Claude Sonnet 4.5 (1M context) <[email protected]>
Added the actual installation path used on CI runners: - C:\Program Files (x86)\Lemonade Server\bin This path is now checked first to ensure fast discovery on self-hosted runners with the standard Lemonade Server installation. Co-Authored-By: Claude Sonnet 4.5 (1M context) <[email protected]>
GitHub Actions self-hosted runners run as a service and may not inherit updated System/User PATH variables until service restart. Changes: - Added PATH debugging to diagnose environment issues - Proactively add known stx runner path (C:\Program Files (x86)\Lemonade Server\bin) to session PATH - Check PATH again after addition before falling back to search This ensures lemonade-server is found even when runner service hasn't been restarted after PATH updates. Co-Authored-By: Claude Sonnet 4.5 (1M context) <[email protected]>
Enhanced diagnostics to troubleshoot why lemonade-server with space
in path ("Lemonade Server") is not found despite being in PATH.
Now shows:
- System PATH from registry
- User PATH from registry
- Current session PATH (what runner actually sees)
- Filtered view of Lemonade-related paths
- Explicit check if lemonade-server.exe exists at known location
This will reveal if:
- Space in path causes parsing issues
- Runner service inherits PATH correctly
- GITHUB_PATH addition works properly
Co-Authored-By: Claude Sonnet 4.5 (1M context) <[email protected]>
Removed extensive debug output while keeping working logic: - Proactively check and add known installation path to PATH - Fallback to searching common locations if needed - Minimal, clear output focused on operational info The action now efficiently handles self-hosted runners where lemonade-server PATH may not be inherited by runner service. Co-Authored-By: Claude Sonnet 4.5 (1M context) <[email protected]>
Re-added ${env:ProgramFiles(x86)}\Lemonade Server\bin to the
fallback search paths array. While this path is checked proactively
at the top, keeping it in the fallback ensures redundancy.
Co-Authored-By: Claude Sonnet 4.5 (1M context) <[email protected]>
The stx runner path is already checked proactively at the top and added to PATH if it exists. Checking it again in the fallback is redundant - if it existed, we would have already found it. Fallback now only searches alternative locations that weren't checked in the initial known-path logic. Co-Authored-By: Claude Sonnet 4.5 (1M context) <[email protected]>
Now clearly communicates: - "Found at known location" vs "Not found at known location" - "Adding to PATH" vs "Already in PATH" - "lemonade-server not found in PATH, searching alternatives..." - "Found at alternative location" when using fallback Makes the CI logs easier to understand and debug. Co-Authored-By: Claude Sonnet 4.5 (1M context) <[email protected]>
kovtcharov-amd
approved these changes
Feb 9, 2026
Unified the logic into one clean flow: 1. Check if already in PATH 2. If not found, search common locations (one loop) 3. Print where found and add to PATH 4. Verify availability Removes redundant checks and special-casing. Cleaner and easier to maintain. Co-Authored-By: Claude Sonnet 4.5 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes CI test failure on machines with stricter PowerShell configurations by renaming a variable that conflicted with PowerShell's read-only
$PIDautomatic variable.Problem
The lemonade smoke test was failing on one specific machine with:
The script used
$pid(line 69) to store a process ID during port availability checking. PowerShell's$PIDis a read-only automatic variable (current process ID), and PowerShell variable names are case-insensitive, so$pidand$PIDrefer to the same variable.Solution
Renamed
$pid→$processIdto avoid the conflict.Testing
Impact
🤖 Generated with Claude Code