@@ -236,6 +236,8 @@ func (r *RootCmd) configSSH() *serpent.Command {
236
236
r .InitClient (client ),
237
237
),
238
238
Handler : func (inv * serpent.Invocation ) error {
239
+ ctx := inv .Context ()
240
+
239
241
if sshConfigOpts .waitEnum != "auto" && skipProxyCommand {
240
242
// The wait option is applied to the ProxyCommand. If the user
241
243
// specifies skip-proxy-command, then wait cannot be applied.
@@ -244,7 +246,13 @@ func (r *RootCmd) configSSH() *serpent.Command {
244
246
sshConfigOpts .header = r .header
245
247
sshConfigOpts .headerCommand = r .headerCommand
246
248
247
- recvWorkspaceConfigs := sshPrepareWorkspaceConfigs (inv .Context (), client )
249
+ // Talk to the API early to prevent bad placement of the
250
+ // version mismatch warning. The asynchronous requests
251
+ // issued by sshPrepareWorkspaceConfigs may trigger the
252
+ // warning at any time.
253
+ _ , _ = client .BuildInfo (ctx )
254
+
255
+ recvWorkspaceConfigs := sshPrepareWorkspaceConfigs (ctx , client )
248
256
249
257
out := inv .Stdout
250
258
if dryRun {
@@ -366,7 +374,7 @@ func (r *RootCmd) configSSH() *serpent.Command {
366
374
return xerrors .Errorf ("fetch workspace configs failed: %w" , err )
367
375
}
368
376
369
- coderdConfig , err := client .SSHConfiguration (inv . Context () )
377
+ coderdConfig , err := client .SSHConfiguration (ctx )
370
378
if err != nil {
371
379
// If the error is 404, this deployment does not support
372
380
// this endpoint yet. Do not error, just assume defaults.
0 commit comments