Thanks to visit codestin.com
Credit goes to github.com

Skip to content

ci(windows): run Gemma on a persistent Lemonade server (fix Windows integration jobs)#1733

Merged
itomek merged 4 commits into
mainfrom
tmi/ci-windows-gemma-fresh-server
Jun 18, 2026
Merged

ci(windows): run Gemma on a persistent Lemonade server (fix Windows integration jobs)#1733
itomek merged 4 commits into
mainfrom
tmi/ci-windows-gemma-fresh-server

Conversation

@itomek

@itomek itomek commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

The Windows Agent SDK and GAIA CLI integration jobs were failing because the runner couldn't actually serve Gemma-4-E4B-it-GGUF (GAIA's default model). Two root causes: a stale Lemonade install in another profile shadowed the current one on PATH (old catalog, no Gemma), and the 10.7.0 server is flaky to start headless per-job — and GitHub Actions kills any server a job spawns when the job ends. After cleaning the runner to a single 10.7.0 install, both jobs now run reliably on Gemma by talking to a persistent Lemonade server.

What this does:

  • ensure-lemonade-running.ps1 launches the version-matched server as a Windows Scheduled Task (owned by Task Scheduler, not the job, so it survives across jobs and reboots), reuses it when already healthy, retries a wedged start, and warms Gemma-4. Both Windows workflows now call it instead of starting the server inline.
  • reset-lemonade.ps1 is the one-shot runner-cleanup tool (wipe every Lemonade install incl. stale copies → reinstall the pinned version → warm the backend). Already run on the stx runner to bring it to a single clean 10.7.0.

Verified on the runner (two consecutive workflow_dispatch runs of test_agent_sdk.yml):

  • Run 1 — registered the task, started the server (healthy in ~3s), warmed Gemma → Ran 8 tests in 140s / OK
  • Run 2 — Lemonade already healthy ... reusing persistent serverRan 8 tests in 109s / OK

Test plan

  • Test Agent SDK on Windows (Lemonade Integration) is green on Gemma-4-E4B-it-GGUF
  • Test GAIA CLI on Windows (Full Integration) is green on Gemma-4-E4B-it-GGUF

Tomasz Iniewicz added 4 commits June 17, 2026 21:30
GitHub Actions kills any server a job starts, and the 10.7.0 GUI server is
flaky to launch headless per-job. ensure-lemonade-running.ps1 launches it as
a Scheduled Task (owned by Task Scheduler, not the job), reuses it if already
healthy, retries a wedged start, and warms Gemma-4.
@github-actions github-actions Bot added installer Installer changes devops DevOps/infrastructure changes labels Jun 18, 2026
@itomek itomek added the ready_for_ci Run CI workflows on draft PR without requesting review label Jun 18, 2026
@itomek

itomek commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator Author

Both Windows integration jobs verified green on this branch head, on Gemma-4-E4B-it-GGUF. (They're absent from this PR's own check list because their paths: filters only match src/** / tests/** / setup.py, so they were exercised via workflow_dispatch.)

  • Agent SDK Tests (Windows) — ✅ run 27733444597Ran 8 tests ... ALL INTEGRATION TESTS PASSED
  • GAIA CLI Tests (Windows) — ✅ run 27733445215test_lemonade_client.py: exit code 0

The second run also confirms the persistence path: Lemonade already healthy on port 13305 -- reusing persistent server.

@itomek itomek marked this pull request as ready for review June 18, 2026 03:29
@itomek itomek requested a review from kovtcharov-amd as a code owner June 18, 2026 03:29
@github-actions

Copy link
Copy Markdown
Contributor

Review: ci(windows) — persistent Lemonade server for Windows integration jobs

Summary

Solid infra fix that targets a real, well-diagnosed problem: GitHub Actions kills any server a job spawns, so the inline Start-Process approach could never survive between jobs, and a stale per-profile install was shadowing the current one on PATH. Moving to a Scheduled Task (owned by Task Scheduler, not the job) is the right mechanism, and consolidating ~50 lines of duplicated inline start/wait/pull logic from both workflows into one shared helper is a clear improvement. The one thing worth a second look before merge: the warm-pull step swallows failure and still reports success, which is a quiet deviation from the fail-loud convention and from the behavior this PR replaces.

Issues Found

🟡 Warm-pull failure is swallowed; the helper exits 0 anyway (installer/scripts/ensure-lemonade-running.ps1:246)

The removed inline code in both workflows throw on a failed pull. The new helper only warns and then exit 0:

} catch { Write-Host "WARN: warm pull failed: $($_.Exception.Message)" }
...
exit 0

The pull does double duty here — it both downloads/registers the model and warms it. If it's purely a warm-up and the model is already present, a WARN is defensible. But if the pull fails because the model isn't actually present/downloadable (exactly the failure mode this PR exists to fix), the helper reports the server "ready," the workflow proceeds, and the first test either eats a multi-minute inline pull or fails deep in the test step — reintroducing the flakiness. This also runs against the repo's "No Silent Fallbacks — Fail Loudly" rule. Consider making it fatal to match the prior behavior:

} catch { Write-Host "ERROR: warm pull failed: $($_.Exception.Message)"; exit 1 }

If you intend warm-up to be best-effort, a one-line comment saying so (and noting the model presence is guaranteed elsewhere) would make the intent explicit.

🟢 PATH-strip filter is a broad substring regex (installer/scripts/reset-lemonade.ps1:416)

$_ -notmatch "lemonade" drops any PATH entry containing the substring "lemonade" (case-insensitive), so an unrelated dir like C:\dev\lemonade-helpers\bin would be stripped too. Low risk for a manual one-shot cleanup tool, but scoping to the known install dir name (e.g. lemonade_server) would be safer.

🟢 No integrity check on the downloaded MSI (installer/scripts/reset-lemonade.ps1:436)

The MSI is fetched over HTTPS from the pinned official release and installed silently with admin rights. A SHA-256 check against a known hash would harden the reinstall path. Acceptable as-is given the pinned official source; noting for future hardening.

🟢 Note (not a blocker): persistent task runs the server as SYSTEM/Highest at boot (ensure-lemonade-running.ps1:212)

This is the intended design for a self-hosted runner, and the exe is resolved from standard install locations, so it's not a code-level vulnerability. Flagging only so the runner owner is aware the task survives reboots and runs elevated indefinitely until explicitly removed.

Strengths

  • Excellent comment-based help. The .SYNOPSIS/.DESCRIPTION/.PARAMETER blocks explain the why (GHA killing job-spawned processes, stale-profile PATH shadowing) — future maintainers won't have to reverse-engineer the intent.
  • Idempotent + self-healing. Health-check-first reuse, retry-with-recycle that stops the task and any stray process before each attempt, and a -ForceRestart escape hatch are exactly the right shape for flaky CI startup.
  • Single source of truth for the version. reset-lemonade.ps1 reads LEMONADE_VERSION from src/gaia/version.py (currently 10.7.0) rather than hardcoding, with a sensible literal fallback.
  • Good de-duplication. Both Windows workflows now share one helper instead of two copies of the inline start/wait/pull block.

Verdict

Approve with suggestions. No blocking issues. The warm-pull swallow (🟡) is the one item worth resolving before merge — either make it fatal to match the prior throw, or add a comment making "best-effort warm-up" explicit. The two minor items can be follow-ups. Since the verification is the CI run itself, the unchecked test-plan boxes should be green before this lands.

@itomek itomek added this pull request to the merge queue Jun 18, 2026
Merged via the queue into main with commit a1000cf Jun 18, 2026
48 of 49 checks passed
@itomek itomek deleted the tmi/ci-windows-gemma-fresh-server branch June 18, 2026 13:04
pull Bot pushed a commit to bhardwajRahul/gaia that referenced this pull request Jun 26, 2026
…md#1867)

## 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 amd#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:

- [x] **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.
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 ready_for_ci Run CI workflows on draft PR without requesting review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants