Stabilize daemon handoff live test - #403
Merged
coneilen merged 1 commit intoSep 21, 2026
Merged
Conversation
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>
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.
Root cause:
DaemonHandoff.Live.Tests.ps1selected the single spawnedgraphcoded.exechild 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 transient0supervisor 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 inTools/windows/Tests/DaemonHandoff.Live.Tests.ps1:218withowner=0, contender=0, daemonA=missing state file, daemonB=published;gh run view 35658491754 --repo scgopi/GraphCode --job 106527850230 --log-> failed at the same assertion withowner=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, orgraphcode.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.