Skip to content

Commit 6e7f65b

Browse files
fix(cli): properly handle build log streaming during coder ping (#15600)
Closes #15584. - The `Collecting Diagnostics` spinner now starts after the workspace build logs (if any) have finished streaming. - Removes network interfaces with negative MTUs from `healthsdk` diagnostics. - Improves the wording on diagnostics for MTUs below the 'safe' value to indicate that direct connections may be degraded, or rendered unusable (i.e. if every packet is dropped).
1 parent 32fc844 commit 6e7f65b

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

cli/ping.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,6 @@ func (r *RootCmd) ping() *serpent.Command {
103103
ctx, cancel := context.WithCancel(inv.Context())
104104
defer cancel()
105105

106-
spin := spinner.New(spinner.CharSets[5], 100*time.Millisecond)
107-
spin.Writer = inv.Stderr
108-
spin.Suffix = pretty.Sprint(cliui.DefaultStyles.Keyword, " Collecting diagnostics...")
109-
spin.Start()
110-
111106
notifyCtx, notifyCancel := inv.SignalNotifyContext(ctx, StopSignals...)
112107
defer notifyCancel()
113108

@@ -118,10 +113,15 @@ func (r *RootCmd) ping() *serpent.Command {
118113
workspaceName,
119114
)
120115
if err != nil {
121-
spin.Stop()
122116
return err
123117
}
124118

119+
// Start spinner after any build logs have finished streaming
120+
spin := spinner.New(spinner.CharSets[5], 100*time.Millisecond)
121+
spin.Writer = inv.Stderr
122+
spin.Suffix = pretty.Sprint(cliui.DefaultStyles.Keyword, " Collecting diagnostics...")
123+
spin.Start()
124+
125125
opts := &workspacesdk.DialAgentOptions{}
126126

127127
if r.verbose {

codersdk/healthsdk/interfaces.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,14 @@ func generateInterfacesReport(st *interfaces.State) (report InterfacesReport) {
6868
continue
6969
}
7070
report.Interfaces = append(report.Interfaces, healthIface)
71-
if iface.MTU < safeMTU {
71+
// Some loopback interfaces on Windows have a negative MTU, which we can
72+
// safely ignore in diagnostics.
73+
if iface.MTU > 0 && iface.MTU < safeMTU {
7274
report.Severity = health.SeverityWarning
7375
report.Warnings = append(report.Warnings,
7476
health.Messagef(health.CodeInterfaceSmallMTU,
75-
"Network interface %s has MTU %d (less than %d), which may degrade the quality of direct connections", iface.Name, iface.MTU, safeMTU),
77+
"Network interface %s has MTU %d (less than %d), which may degrade the quality of direct "+
78+
"connections or render them unusable.", iface.Name, iface.MTU, safeMTU),
7679
)
7780
}
7881
}

0 commit comments

Comments
 (0)