Conversation
getPeers checks CurrentTailnet before copying it into the response, but then dereferences st.CurrentTailnet.MagicDNSSuffix for every peer. If tailscaled returns a status that lists peers but has no CurrentTailnet, every /peers request panics and the connection is reset. The extension expects CurrentTailnet to be set whenever there is no error, so returning it as null would just move the failure into the Node Explorer. Instead, return the offline error when there is one (the logged-out case, unchanged), and otherwise fail the request like other status errors, so the extension keeps its last good tree and retries. Also add nil checks for Self in getPeers, getServe and serveConfigDNS. tailscaled always sets Self, but these handlers can be pointed at a -mockfile profile, and getServe already checks Self a few lines earlier. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: ZAG23 <zacharygruenberg@gmail.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.
getPeerschecksst.CurrentTailnetfor nil before copying it into the response, but then readsst.CurrentTailnet.MagicDNSSuffixunconditionally for every peer (get_peers.go:120). When tailscaled returns a status that lists peers but has noCurrentTailnet, each/peerspoll panics and the connection is reset:I hit this with v1.1.0 in VSCodium on macOS (standalone Tailscale app 1.102.4): 10 panics, one on its own and then nine consecutive 5-second polls about a minute and a half later, after which they stopped. I didn't determine why tailscaled briefly omitted
CurrentTailnet.Fix
getPeers: whenCurrentTailnetis nil, return the offline error if there is one (the logged-out case, unchanged), and otherwise return an error so the request fails like other status errors. Returning"CurrentTailnet": nullalongside peers would just move the crash: the extension readsstatus.CurrentTailnet.Namewithout a null check insrc/node-explorer-provider.ts. With a failed request, the poll throws beforecurrentStatusis replaced, the same path a reset connection took before, so the Node Explorer keeps its last good tree and picks up changes on the next good poll.SelfingetPeers,getServe(which already checksSelfa few lines earlier) andserveConfigDNS. tailscaled always setsSelf, but-mockfileprofiles don't have to.Testing
tsrelay/handler/nil_status_test.go. Without the fix, four of its five tests panic, atget_peers.go:120,get_peers.go:140,get_serve.go:167andcreate_serve.go:96; the logged-out test passes before and after. With the fix all five pass, along withgo vet ./tsrelay/...andgo test ./tsrelay/..../peersand/serveJSON responses are identical to the v1.1.0 binary's.-mockfilestatus that is running, lists peers, and has noCurrentTailnet: v1.1.0 panics, and this returns a plain-text 500 that the extension'sresp.json()rejects, so the poll counts as failed.GOEXPERIMENT=nojsonv2: 1.27 enables jsonv2 by default, and the pinnedgo-json-experiment/jsondoesn't compile against it. Not tested with./tool/go.🤖 Generated with Claude Code