@@ -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,14 @@ 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 the version mismatch
250
+ // warning from being printed in the middle of a prompt.
251
+ // This is needed because the asynchronous requests issued
252
+ // by sshPrepareWorkspaceConfigs may otherwise trigger the
253
+ // warning at any time.
254
+ _ ,_ = client .BuildInfo (ctx )
255
+
256
+ recvWorkspaceConfigs := sshPrepareWorkspaceConfigs (ctx ,client )
248
257
249
258
out := inv .Stdout
250
259
if dryRun {
@@ -366,7 +375,7 @@ func (r *RootCmd) configSSH() *serpent.Command {
366
375
return xerrors .Errorf ("fetch workspace configs failed: %w" ,err )
367
376
}
368
377
369
- coderdConfig ,err := client .SSHConfiguration (inv . Context () )
378
+ coderdConfig ,err := client .SSHConfiguration (ctx )
370
379
if err != nil {
371
380
// If the error is 404, this deployment does not support
372
381
// this endpoint yet. Do not error, just assume defaults.