fix(launcher): tolerate slow cold first start (Windows)#305
Merged
Conversation
First launch on Windows can exceed the old 60s readiness wait because Windows Defender scans the freshly written torch DLLs on first import, so the browser never opened. Poll up to 5 minutes (it opens the instant the port is reachable, so no penalty on the normal path), and abort immediately via a done channel if the server process exits, so a crash no longer waits out the timeout. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.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.
Problem
On a clean Windows machine, first launch timed out and the browser never opened. The server does start, but the first
import torchis slow — Windows Defender scans the ~80 freshly-written package DLLs on first access, which routinely exceeds the launcher's old 60-second readiness wait. Subsequent launches are fast.Fix
donechannel), so a genuine crash no longer makes the user wait out the full timeout before seeing the error.Tests
New
browser_test.go: verifies it bails promptly on server exit and detects a reachable port quickly.gofmt/vet/-raceclean.🤖 Generated with Claude Code