Skip to content

Stabilize daemon handoff live test - #403

Merged
coneilen merged 1 commit into
scgopi:mainfrom
coneilen:coneilen-microsoft-daemon-handoff-ci-repair
Sep 21, 2026
Merged

coneilen merged 1 commit into
scgopi:mainfrom
coneilen:coneilen-microsoft-daemon-handoff-ci-repair

Conversation

@coneilen

@coneilen coneilen commented Sep 21, 2026

Copy link
Copy Markdown
Collaborator

Root cause: DaemonHandoff.Live.Tests.ps1 selected the single spawned graphcoded.exe child correctly, then used a short fixed 80 x 100ms ownership poll. Under loaded Windows runners the owner/contender shell windows can lag behind the daemon handoff state-file publication, so the test observed transient 0 supervisor properties or a missing contender state even though the daemon had not reported a startup failure. Failed evidence: run 35658491771/job 106527851748 (owner=0, contender=0, daemonA=missing state file, daemonB=published), run 35658491754/job 106527850230 (owner=1, contender=0, daemonA=published, daemonB=missing state file), and earlier run 35651648908/job 106505235112.

Fix: replace the fixed ownership loop with a deadline-based wait for the explicit terminal contract (owner=1, contender=2) while checking shell and daemon liveness on every iteration. Timeout diagnostics now include elapsed time, shell exit codes, daemon process identity/exit state, daemon state-file contents, and both supervisor-state properties. The product daemon/supervisor code is unchanged.

RED: gh run view 35658491771 --repo scgopi/GraphCode --job 106527851748 --log -> failed in Tools/windows/Tests/DaemonHandoff.Live.Tests.ps1:218 with owner=0, contender=0, daemonA=missing state file, daemonB=published; gh run view 35658491754 --repo scgopi/GraphCode --job 106527850230 --log -> failed at the same assertion with owner=1, contender=0, daemonA=published, daemonB=missing state file.

GREEN: $tokens=$null; $errors=$null; [void][System.Management.Automation.Language.Parser]::ParseFile('Tools\windows\Tests\DaemonHandoff.Live.Tests.ps1',[ref]$tokens,[ref]$errors); $tokens2=$null; $errors2=$null; [void][System.Management.Automation.Language.Parser]::ParseFile('Tools\windows\Tests\TrayDaemon.Tests.ps1',[ref]$tokens2,[ref]$errors2); if($errors.Count -or $errors2.Count){ exit 1 } -> passed locally.

REGRESSION: powershell -NoProfile -ExecutionPolicy Bypass -File Tools\windows\Tests\TrayDaemon.Tests.ps1 -> Tray daemon contract tests: PASS, including the guard that rejects the old short fixed ownership poll and requires liveness/diagnostic condition waiting.

Native live validation note: this worktree does not contain built graphcode-windows.exe, graphcoded.exe, or graphcode.exe; local tool versions are not the CI-pinned Zig 0.15.2/Swift toolchain, so Windows CI remains authoritative for the packaged live handoff run.

Wait for the required owner/contender supervisor states with liveness checks and timeout diagnostics instead of relying on short fixed polling.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Colin Neilens <coneilen@microsoft.com>
@coneilen
coneilen merged commit 940b9e2 into scgopi:main Sep 21, 2026
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant