Skip to content

ci(windows): fix Lemonade port binding for the two integration jobs - #1867

Merged
kovtcharov merged 6 commits into
mainfrom
fix/windows-lemonade-ci-port-serialize
Jun 25, 2026
Merged

kovtcharov merged 6 commits into
mainfrom
fix/windows-lemonade-ci-port-serialize

Conversation

@kovtcharov

@kovtcharov kovtcharov commented Jun 25, 2026 •

Copy link
Copy Markdown
Contributor

Why this matters

The two Windows integration jobs — Test Agent SDK on Windows and Test GAIA CLI on Windows — went intermittently red on main starting 06-24, failing at Lemonade startup (Lemonade server not ready) before any test ran. Root cause is runner state, not a code regression: the pinned LemonadeServer.exe binary is correctly v10.7.0 (CI verifies "no reconcile needed"), but a stale config.json in the runner's SYSTEM profile pins the server to the old default port 8000, while the health check polls 13305. It only looked like "flaky infra a re-run clears" because a previous run's healthy 13305 server was sometimes still alive. No PR caused it — the startup script has been unchanged since #1733 (06-18); the trigger was a v10.8.x install touching the runner's config.

The fix makes the server bind 13305 deterministically: launch LemonadeServer.exe --port 13305 (in v10.x the port is a bare flag — there's no serve subcommand, and the old lemonade-server shim was removed in v10.5) and clear the stale config.json so the documented 13305 default regenerates. Also broadens the pre-start process cleanup to the full Lemonade/llama-server set so a wedged child can't survive a retry.

A second change adds installer/scripts/** and these workflows' own files to their paths triggers, so changes to the Lemonade startup script actually re-run the jobs they govern (previously they only triggered on src/**/tests/**, so this very fix couldn't validate itself).

Test plan

These jobs run only on the self-hosted Windows runner, so CI is the verification:

  • Test GAIA CLI on Windows passes — server binds 13305 (validated on an earlier push of this branch).
  • Test Agent SDK on Windows passes with the same Server binary: …LemonadeServer.exe → Healthy after attempt 1 signature.
  • Re-run from a cold runner (no pre-existing 13305 server) self-heals to 13305 instead of getting stuck on 8000.

…gration jobs

The two Windows integration jobs (Agent SDK, GAIA CLI) have been red on main
because ensure-lemonade-running.ps1 registered a scheduled task running
LemonadeServer.exe bare. In Lemonade v10.x that binary is a tray launcher that
ignores `serve --port`, so the server came up on its default 8000 while the
health check polled 13305 — four 60s retries, then "Lemonade server not ready".
A re-run only passed when a previous run's persistent 13305 server happened to
still be alive, which read as flaky infra.

Two fixes:
- Launch the `lemonade-server.exe` shim with `serve --no-tray --port $Port`
  (the shim translates those args correctly; the bare exe does not), so a cold
  restart deterministically rebinds 13305 and self-heals off 8000. Broaden the
  pre-start kill to the full Lemonade/llama-server process set so a wedged
  inference child can't survive a retry.
- Give both workflows a constant shared concurrency group with
  cancel-in-progress: false. They share one persistent Lemonade scheduled task
  on the single self-hosted stx runner, so any two concurrent runs (across both
  workflows and across branches) force-restart and evict each other's server.
  A constant group makes that shared server a true mutex.
@github-actions github-actions Bot added installer Installer changes devops DevOps/infrastructure changes labels Jun 25, 2026
…changes

The Lemonade startup script and these workflows' own definitions live outside
src/**, tests/**, so changes to them never re-ran the jobs they govern — the
PR fixing the startup script couldn't validate itself. Add installer/scripts/**
and the self workflow path so launch-path changes exercise these integration jobs.
@github-actions

Copy link
Copy Markdown
Contributor

Verdict: Approve

This fixes two compounding causes of the intermittently-red Windows integration jobs: the scheduled task was launching the bare tray launcher (which ignores serve --port and binds 8000 while the health check polled 13305), and the two workflows could mutually evict each other's shared server. The fix switches to the lemonade-server shim with explicit --no-tray --port, widens the pre-start process kill to the full Lemonade/llama-server set, and makes both workflows share one constant concurrency mutex. The reasoning checks out and the shim invocation matches the established working pattern in start-lemonade.ps1. No blocking issues; no tests required (PowerShell CI scripts). The author has already flagged the one assumption worth confirming — that stx is a single shared runner.

🔍 Technical details

Correctness — verified, no issues

  • The shim invocation serve --no-tray --port $Port (ensure-lemonade-running.ps1:82) matches the proven pattern in start-lemonade.ps1:142-146 (serve --port N --no-tray) — same args, order-insensitive. The "must use the shim, not the tray exe" rationale is documented identically in both scripts, so this is consistent, not a guess.
  • Shim resolution (:61-75) is robust: null-guarded $shimNextToExe when $ServerExe is unresolved, then PATH (Get-Command), then repo venv, then the install-dir globs. Good fallback ordering.
  • Expanded kill list (:101-102) correctly covers the orphan case: the shim spawns llama-server children that Stop-ScheduledTask won't necessarily reap, so killing them explicitly before each retry is the right fix for the "wedged inference child survives a re-run" symptom. Get-Process names (no .exe) are correct.

Strengths

  • Excellent root-cause writeup in both the PR body and the inline comments — the "tray exe ignores serve --port" failure mode and the cross-workflow eviction are each explained where a future maintainer will read them.
  • Reuses the exact shim-vs-tray pattern already validated in start-lemonade.ps1 rather than inventing a new one.
  • The author proactively flagged the single-stx-runner assumption behind the constant concurrency group, with the correct mitigation (relax to branch-keyed if there are multiple boxes).

🟢 Minor (non-blocking, no change required)

  • Constant group + cancel-in-progress: false: GitHub keeps at most one pending run per group, so a burst of pushes will cancel intermediate queued runs (latest-pending wins) rather than queue all of them. That's fine and arguably desirable for these slow integration jobs — just worth being aware of if you ever expect every commit's run to execute.

…him is gone)

First CI attempt failed: the lemonade-server shim no longer exists. Lemonade
v10.5 deprecated and removed the `lemonade-server.exe` shim, so v10.7.0 ships
only LemonadeServer.exe (verified present on the runner via LEMONADE_SERVER_PATH).
There is no `serve` subcommand — the listen port lives in config.json. The runner
binds 8000 because a stale config.json in the SYSTEM profile (left when the box
drifted onto a v10.8.x install) pins the old port; the binary itself is the
correct 10.7.0 and needs no reconcile.

Launch LemonadeServer.exe with bare `--no-tray --port $Port` (overrides + persists
the port) and clear the stale config.json first so the 13305 default regenerates.
@github-actions

Copy link
Copy Markdown
Contributor

🟡 The new global concurrency mutex (windows-lemonade-stx) with cancel-in-progress: false has no job-level timeout to bound worst-case queue blockage. If a test step hangs, GitHub's default 6-hour job timeout kicks in — freezing CI for every PR and branch across both workflows until it expires. Previously, a new push to the same branch would cancel the stale run; that escape valve is gone.

Adding timeout-minutes at the job level (e.g. 45–60 min) on both jobs would cap the block without affecting normal runs.

🔍 Technical details

.github/workflows/test_agent_sdk.yml, job test-agent-sdk-windows (line 45): only the "Start Lemonade Server" step has timeout-minutes: 15; the "Run Agent SDK Integration Tests with Lemonade" step has none.

.github/workflows/test_gaia_cli_windows.yml, job test-gaia-cli-windows (line 49): "Start Lemonade Server and Run Tests" has timeout-minutes: 20, but the follow-on "Run Unit Tests" and "Run Lemonade Client Integration Tests" steps have no timeout. Neither job has a top-level timeout-minutes.

Suggested fix — add at the job level in both workflows:

jobs:
  test-agent-sdk-windows:
    timeout-minutes: 60   # caps worst-case mutex hold

Under the old cancel-in-progress: true + per-branch group, a new push cleared a hung run on the same branch. With the constant group + cancel-in-progress: false, nothing preempts a stuck test step — all queued runs wait up to 6 h.

The bare LemonadeServer.exe is proven to start under the SYSTEM scheduled task
(it always came up, just on the wrong port), so --port alone is the minimal,
evidence-backed delta. --no-tray was unverified for the direct exe and could
hard-fail startup for no port-binding benefit.
…jobs)

A constant group shared by both workflows hit GitHub's 1-running+1-pending
limit, so the second Windows job on a commit was cancelled, not queued — worse
than the original flakiness and a merge blocker if required. The real fix is the
--port/config-clear change (CLI Windows now passes); on a single stx runner the
two jobs already run back-to-back, so no concurrency-level serialization is
needed. Restore the original per-workflow group.
@kovtcharov kovtcharov changed the title ci(windows): fix Lemonade port binding + serialize the two integration jobs ci(windows): fix Lemonade port binding for the two integration jobs Jun 25, 2026
@kovtcharov
kovtcharov added this pull request to the merge queue Jun 25, 2026
Merged via the queue into main with commit c1bb70f Jun 25, 2026
38 checks passed
@kovtcharov
kovtcharov deleted the fix/windows-lemonade-ci-port-serialize branch June 25, 2026 23:19
pull Bot pushed a commit to bhardwajRahul/gaia that referenced this pull request Jun 26, 2026
…d in v10.5) (amd#1868)

## Why this matters

The **Lemonade Server Smoke Test** has been red since Lemonade v10.5
removed the `lemonade-server` shim. `start-lemonade.ps1` hard-exits at
`lemonade-server not found on PATH or in .venv` before it can even start
the server, and `reset-lemonade.ps1`'s direct-exe fallback launched
`LemonadeServer.exe` with **no `--port`**, so it bound whatever the
stale `config.json` said instead of the requested port. Both now resolve
`LemonadeServer.exe` directly and launch it with a bare `--port` (there
is no `serve` subcommand in v10.x).

This is the follow-up to amd#1867, which fixed the same shim-removal
breakage in the two Windows integration jobs. That PR's passing run
**empirically verified on the `stx` runner** that `LemonadeServer.exe
--port N` binds N — so this applies the proven pattern to the remaining
two scripts.

## Test plan

- [ ] **Lemonade Server Smoke Test (stx)** passes — log shows `[OK]
Found server: …LemonadeServer.exe` then `Server ready`, not
`lemonade-server not found`.
- [ ] `reset-lemonade.ps1` brings the server up on the requested port
(no silent fallback to the config port).
pull Bot pushed a commit to bhardwajRahul/gaia that referenced this pull request Jun 26, 2026
## Why this matters

**Upgrades GAIA's pinned Lemonade Server from 10.7.0 to 10.8.1
(latest).** The repo was stuck on 10.7.0 because the auto-bump workflow
failed and every Lemonade entry point assumed the `lemonade-server` shim
that v10.5 removed (fixed in amd#1867 + amd#1868, both now on main). This PR
is the version bump itself: `LEMONADE_VERSION` 10.7.0 → 10.8.1 in
`src/gaia/version.py` plus the matching docs version references.

Validated on a real `stx` runner that **genuinely reconciled 10.7.0 →
10.8.1** (`Post-reconcile version: 10.8.1`, health
`"version":"10.8.1"`): the shim-free `LemonadeServer.exe --port` scripts
start it, the model loads, and the Windows + smoke integration jobs all
pass on 10.8.1.

## Test plan

Validated end-to-end on the self-hosted `stx` runner (the run reconciled
it 10.7.0 → 10.8.1):

- [x] **Test Agent SDK on Windows** — green on 10.8.1
- [x] **Test GAIA CLI on Windows** — green on 10.8.1
- [x] **Lemonade Server Smoke Test** — green (MSI reconcile + model pull
+ load + completion on 10.8.1)
- [x] **Docs Validation** — green (Lemonade version refs bumped in
`docs/cpp/setup.mdx`, `docs/guides/npu.mdx`, `cpp/README.md`)

---------

Co-authored-by: kovtcharov-amd <[email protected]>
kovtcharov-amd pushed a commit that referenced this pull request Sep 14, 2026
The two `TestStartRemedyIsRunnable` cases still expected
`LEMONADE_CTX_SIZE=<n>` in the remedy. On a systemd-managed install there is
no such variable to set: restarting the unit does not re-read one, which is
why `start_hint` now tells the user to set the size in Lemonade's model
settings and reload the model instead.

Both assertions move to what the remedy is actually responsible for — naming
the size the profile needs, and where to set it — so they still fail if the
size goes missing, which is what #1867 put them there for.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

devops DevOps/infrastructure changes installer Installer changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants