Skip to content

Commit ff5666b

Browse files
committed
fix(cli/ssh): Fetch up-to-date build info to avoid ws has no agents
Fixes #5836
1 parent ba02dc8 commit ff5666b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

cli/ssh.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,11 @@ func getWorkspaceAndAgent(ctx context.Context, inv *clibase.Invocation, client *
367367
return codersdk.Workspace{}, codersdk.WorkspaceAgent{}, xerrors.Errorf("workspace %q is being deleted", workspace.Name)
368368
}
369369

370+
// Fetch up-to-date information.
371+
workspace.LatestBuild, err = client.WorkspaceBuild(ctx, workspace.LatestBuild.ID)
372+
if err != nil {
373+
return codersdk.Workspace{}, codersdk.WorkspaceAgent{}, err
374+
}
370375
resources := workspace.LatestBuild.Resources
371376

372377
agents := make([]codersdk.WorkspaceAgent, 0)

0 commit comments

Comments
 (0)