From b439c3e16770988491d3be37264504120346ad1a Mon Sep 17 00:00:00 2001 From: Ammar Bandukwala Date: Mon, 27 Mar 2023 09:59:58 -0500 Subject: [PATCH] fix: permit SSH by default when startup script fails (#6798) --- cli/ssh.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cli/ssh.go b/cli/ssh.go index 3b02ea387f..e9168f6999 100644 --- a/cli/ssh.go +++ b/cli/ssh.go @@ -82,10 +82,13 @@ func (r *RootCmd) ssh() *clibase.Cmd { if xerrors.Is(err, context.Canceled) { return cliui.Canceled } - if xerrors.Is(err, cliui.AgentStartError) { - return xerrors.New("Agent startup script exited with non-zero status, use --no-wait to login anyway.") + if !xerrors.Is(err, cliui.AgentStartError) { + return xerrors.Errorf("await agent: %w", err) } - return xerrors.Errorf("await agent: %w", err) + + // We don't want to fail on a startup script error because it's + // natural that the user will want to fix the script and try again. + // We don't print the error because cliui.Agent does that for us. } conn, err := client.DialWorkspaceAgent(ctx, workspaceAgent.ID, &codersdk.DialWorkspaceAgentOptions{})