Make the upgrade-wrapper E2E marker read tolerant of the detached writer
Summary
-
Wrapper_DetachedTask_RunsAsSystemAfterWrapperExitsintermittently failed withIOException: ... because it is being used by another process(seen once on PR #440 CI, passed on re-run). The detached Task Scheduler inner script writes the identity marker asynchronously; the test waited for the file to exist, then immediatelyFile.ReadAllText'd it — which opens withFileShare.Readand collides with the writer's still-open handle (and could also read a partial/empty file mid-write). - Replace the read with
ReadMarkerWhenReady: open the marker withFileShare.ReadWrite(don't contend on the writer's handle) and poll until the content is non-empty, within a bounded 30s timeout with an actionable failure message naming the marker path.
Scope
- Surgical to the test/helper. The other marker-based tests only assert existence, so only this content-read needed the fix.
-
No production change — the marker is a test fixture; production reads upgrade traces from the agent over Halibut RPC, not via a concurrent local
File.ReadAllText, so the race does not exist in production code (verified). - Windows-only E2E (gated behind
OperatingSystem.IsWindows()).
Test plan
-
Squid.WindowsTentacleE2ETestscompiles clean cross-platform (the test body skips on non-Windows). -
Windows E2E CI ( WindowsTentacle*E2E) exercises the real path; the fix removes the file-handle contention that caused the intermittentIOException.