fix: Prevent stale keep-alive sockets from failing create-vsix - #868
Merged
Conversation
findOpenPr was intermittently dying with 'TypeError: fetch failed' / UND_ERR_SOCKET 'other side closed', aborting the whole build. The lookups happen once per project, separated by multi-minute npm install/build/pack runs. GitHub closes idle keep-alive sockets well before the next call, but undici still pulls the dead socket from its pool and the request fails before leaving the machine. Send 'connection: close' so each lookup gets a fresh socket. Reproduced locally (failed at roku-debug) and confirmed fixed: all five projects now resolve, including the PR lookup that finds #855. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
|
Hey there! I just built a new version of the vscode extension based on 5c4158c. 📦 Download the .vsixSee the install instructions if you need them. This replaces your marketplace version of the extension until you reinstall it. Built from:
Prefer to keep the marketplace version installed? There's also a side-by-side build that installs as a separate extension. Be sure to disable the marketplace version while testing it, otherwise the two will conflict. |
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.
create-vsixhas been failing on most runs since #867, with:Cause
findOpenPrruns once per project, and consecutive calls are separated by multi-minutenpm i && npm run build && npm packruns. GitHub closes idle keep-alive sockets long before the next call, but undici still takes the dead socket from its connection pool, so the request fails before it ever leaves the machine.The socket dump confirms it —
bytesWritten/bytesReadare non-zero, so the connection had already completed one request/response cycle before being reused.Because
main()isasyncwith.catch(… process.exit(1)), a single failed lookup aborts the entire build after several projects have already been built.Fix
Send
connection: closeon the lookup requests so each gets a fresh socket.Verification
Ran the full script locally exactly as CI does:
roku-debug(the 3rd lookup)Also ruled out the other candidate explanations:
GITHUB_TOKENset, so noauthorizationheader was sent at all. Auth failures would also return HTTP 401/403 and hit the existing!response.okbranch rather than throwing.Note
This removes the cause, but a transient network blip could still abort a build, since the throw bypasses the graceful
!response.okhandling immediately below it. These lookups only improve ref resolution — priorities 3 and 4 (git ls-remote, thenmaster) still produce a valid vsix. Wrapping the fetch in a try/catch that returnsundefinedwould make failures degrade instead of abort. Left out here to keep the fix focused; happy to add it if wanted.🤖 Generated with Claude Code