Repository navigation
Fail fast on unreachable peers and report them after the results - #28
Conversation
A peer that cannot be connected to held every multi-peer command for the request budget: the transport dialed with Go's 30s default and ps waited its 15s control timeout. Reachability is now decided once, in the transport, for every command: - The connect step has its own 3s budget; the request after it keeps its full budget, so a slow runner is not mistaken for a missing one. - A connection to a Tailscale address still pending after 300ms asks tailscaled whether the node is online; one reported offline fails at once with when it was last seen. Healthy connections never pay for it. - SSH peers get ConnectTimeout=3, and ssh's exit 255 before the remote side spoke is reported as unreachable instead of EOF. ps, df and workspaces print what reachable peers returned first, then one line per peer that could not be read, saying whether it was unreachable or connected but slow. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013E4B7TDRFcv2mAVSsCVnHn
|
Generated by Claude Code |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
An SSH peer on an offline Tailscale node still waited out ssh's 3s ConnectTimeout. When ssh has sent nothing shortly after starting, look up where the ssh_config host points with `ssh -G` and, if tailscaled reports that node offline, stop ssh and report it as unreachable, the same way TCP peers do. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013E4B7TDRFcv2mAVSsCVnHn
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e4c60dbe63
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Tailscale's Online flag is control-plane state: a node that lost its coordination server can still carry traffic, and over SSH the check ran until the runner's first response byte, so a slow request to such a node could be cut. A node now counts as gone only when it is offline and this machine has had no WireGuard handshake with it within WireGuard's 3 minute session lifetime; a connection made a moment ago always leaves one. The tailscaled status is shared for 2s instead of per process, so a handshake made since is seen, and the background checks capture what they use up front. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013E4B7TDRFcv2mAVSsCVnHn
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: aa949462a8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Review kept finding cases where the early offline verdict described something other than the connection being attempted: a host with a non-tailnet address too, an SSH host reached through a proxy, a status captured before the attempt's own handshake. One rule now covers them: an attempt is cut short only when every address its host resolves to belongs to a node that is offline with no recent handshake, as observed after the attempt began, and, for SSH, only when ssh connects directly. Each attempt captures its lookups when it begins. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_013E4B7TDRFcv2mAVSsCVnHn
Requested by George · project thread
Before: with one peer offline,
errand ps,dfandworkspacessat for the whole timeout before printing anything: about 15s forpsandworkspaces(the control request budget) and about 30s fordf(Go's default dial timeout, under a 2 minute storage budget).errand run --onan offline peer waited about 30s too. SSH peers waited for the system TCP timeout. The failure line said things likecontext deadline exceededorEOF, and it came before the table.After: an offline Tailscale node fails in about 0.3s with
unreachable: Tailscale reports cabal offline, last seen 3h ago, whether the peer is reached over HTTP or SSH. Any other host that doesn't accept the connection fails within 3s (unreachable: no answer within 3s,connection refused; is errand running there?,ssh could not connect to box). The table comes first, followed by one line for each peer that couldn't be read. A runner that accepted the connection but didn't answer in time is reported astimed out: connected, but the runner did not answer in time, so you can tell a slow runner from a missing one.Reachability is now decided in the client transport, which every command uses, so
peers,--whereplacement,runandattachget this too without changes of their own.How: the HTTP transports dial through
dialPeer(internal/client/reach.go). The connect step gets its own 3s budget, and the request after it keeps its full budget. If a connection to a Tailscale address (100.64.0.0/10 or fd7a:115c:a1e0::/48) is still pending after 300ms,dialPeerasks tailscaled once per process for the node'sOnlineandLastSeenand cancels the dial when the node is offline. Healthy connections finish well before 300ms, so they never trigger the lookup. When Tailscale says the node is online, or anything about the lookup is unclear, the dial keeps its 3s budget. SSH peers getConnectTimeout=3. If ssh has sent nothing after 300ms, errand runsssh -Gto find the address the ssh_config host points at and makes the same tailscaled check; for an offline node it stops ssh. ssh exiting with status 255 before the remote side sends anything is reported as unreachable.readFleetcollects failures and prints them after rendering.Tests:
go test -race ./internal/client ./internal/tailnet ./cmd/errandpass, apart fromTestChangeGCDryRunDoesNotWidenRestrictiveDownloadedStaging, which also fails on main when run as root in the container. New tests cover an offline node failing fast over TCP (IPv4 and IPv6) and over SSH, an online node getting its full budget, no tailscaled lookup for fast or non-tailnet connections, the caller's deadline being kept, a refused connection, ssh exit 255,ssh -Gparsing, and failures printed after the table.Note: this touches
cmd/errand/main.go(readFleet) andinternal/client/ssh.go(ssh args and connection), which #26 also changes. The overlap is small.🤖 Generated with Claude Code
https://claude.ai/code/session_013E4B7TDRFcv2mAVSsCVnHn