Skip to content

Commit d42bf8c

Browse files
committed
improve messages
1 parent bd3fc1f commit d42bf8c

File tree

2 files changed

+21
-19
lines changed

2 files changed

+21
-19
lines changed

cli/cliui/agent.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ func Agent(ctx context.Context, writer io.Writer, opts AgentOptions) error {
8686
// startup logs.
8787
showStartupLogs = true
8888

89-
stage := "Waiting for initial connection from the workspace agent"
89+
stage := "Waiting for the workspace agent to connect"
9090
sw.Start(stage)
9191
for agent.Status == codersdk.WorkspaceAgentConnecting {
9292
if agent, err = fetch(); err != nil {
@@ -96,7 +96,7 @@ func Agent(ctx context.Context, writer io.Writer, opts AgentOptions) error {
9696

9797
if agent.Status == codersdk.WorkspaceAgentTimeout {
9898
now := time.Now()
99-
sw.Log(now, codersdk.LogLevelInfo, "The workspace agent is having trouble connecting, we will keep trying to reach it")
99+
sw.Log(now, codersdk.LogLevelInfo, "The workspace agent is having trouble connecting, wait for it to connect or restart your workspace.")
100100
sw.Log(now, codersdk.LogLevelInfo, troubleshootingMessage(agent, "https://coder.com/docs/v2/latest/templates#agent-connection-issues"))
101101
for agent.Status == codersdk.WorkspaceAgentTimeout {
102102
if agent, err = fetch(); err != nil {
@@ -218,8 +218,9 @@ func Agent(ctx context.Context, writer io.Writer, opts AgentOptions) error {
218218
case codersdk.WorkspaceAgentDisconnected:
219219
showInitialConnection = false
220220

221-
stage := "The workspace agent lost connection, waiting for it to reconnect"
221+
stage := "The workspace agent lost connection"
222222
sw.Start(stage)
223+
sw.Log(time.Now(), codersdk.LogLevelWarn, "Wait for it to reconnect or restart your workspace.")
223224
sw.Log(time.Now(), codersdk.LogLevelWarn, troubleshootingMessage(agent, "https://coder.com/docs/v2/latest/templates#agent-connection-issues"))
224225
for agent.Status == codersdk.WorkspaceAgentDisconnected {
225226
if agent, err = fetch(); err != nil {

cli/cliui/agent_test.go

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ func TestAgent(t *testing.T) {
5353
},
5454
},
5555
want: []string{
56-
"⧗ Waiting for initial connection from the workspace agent",
57-
"✔ Waiting for initial connection from the workspace agent",
56+
"⧗ Waiting for the workspace agent to connect",
57+
"✔ Waiting for the workspace agent to connect",
5858
"⧗ Running workspace agent startup script (non-blocking)",
5959
"Notice: The startup script is still running and your workspace may be incomplete.",
6060
"For more information and troubleshooting, see",
@@ -86,10 +86,10 @@ func TestAgent(t *testing.T) {
8686
},
8787
},
8888
want: []string{
89-
"⧗ Waiting for initial connection from the workspace agent",
90-
"The workspace agent is having trouble connecting, we will keep trying to reach it",
89+
"⧗ Waiting for the workspace agent to connect",
90+
"The workspace agent is having trouble connecting, wait for it to connect or restart your workspace.",
9191
"For more information and troubleshooting, see",
92-
"✔ Waiting for initial connection from the workspace agent",
92+
"✔ Waiting for the workspace agent to connect",
9393
"⧗ Running workspace agent startup script (non-blocking)",
9494
"✔ Running workspace agent startup script (non-blocking)",
9595
},
@@ -121,9 +121,10 @@ func TestAgent(t *testing.T) {
121121
},
122122
},
123123
want: []string{
124-
"⧗ The workspace agent lost connection, waiting for it to reconnect",
124+
"⧗ The workspace agent lost connection",
125+
"Wait for it to reconnect or restart your workspace.",
125126
"For more information and troubleshooting, see",
126-
"✔ The workspace agent lost connection, waiting for it to reconnect",
127+
"✔ The workspace agent lost connection",
127128
},
128129
},
129130
{
@@ -160,8 +161,8 @@ func TestAgent(t *testing.T) {
160161
},
161162
},
162163
want: []string{
163-
"⧗ Waiting for initial connection from the workspace agent",
164-
"✔ Waiting for initial connection from the workspace agent",
164+
"⧗ Waiting for the workspace agent to connect",
165+
"✔ Waiting for the workspace agent to connect",
165166
"⧗ Running workspace agent startup script",
166167
"Hello world",
167168
"Bye now",
@@ -192,8 +193,8 @@ func TestAgent(t *testing.T) {
192193
},
193194
},
194195
want: []string{
195-
"⧗ Waiting for initial connection from the workspace agent",
196-
"✔ Waiting for initial connection from the workspace agent",
196+
"⧗ Waiting for the workspace agent to connect",
197+
"✔ Waiting for the workspace agent to connect",
197198
"⧗ Running workspace agent startup script",
198199
"Hello world",
199200
"Warning: The startup script exited with an error and your workspace may be incomplete.",
@@ -244,8 +245,8 @@ func TestAgent(t *testing.T) {
244245
},
245246
},
246247
want: []string{
247-
"⧗ Waiting for initial connection from the workspace agent",
248-
"✔ Waiting for initial connection from the workspace agent",
248+
"⧗ Waiting for the workspace agent to connect",
249+
"✔ Waiting for the workspace agent to connect",
249250
"⧗ Running workspace agent startup script",
250251
"Hello world",
251252
"✔ Running workspace agent startup script",
@@ -268,7 +269,7 @@ func TestAgent(t *testing.T) {
268269
},
269270
},
270271
want: []string{
271-
"⧗ Waiting for initial connection from the workspace agent",
272+
"⧗ Waiting for the workspace agent to connect",
272273
},
273274
wantErr: true,
274275
},
@@ -289,8 +290,8 @@ func TestAgent(t *testing.T) {
289290
},
290291
},
291292
want: []string{
292-
"⧗ Waiting for initial connection from the workspace agent",
293-
"The workspace agent is having trouble connecting, we will keep trying to reach it",
293+
"⧗ Waiting for the workspace agent to connect",
294+
"The workspace agent is having trouble connecting, wait for it to connect or restart your workspace.",
294295
"https://troubleshoot",
295296
},
296297
wantErr: true,

0 commit comments

Comments
 (0)