mirror of
https://github.com/coder/coder.git
synced 2026-09-21 20:51:01 +08:00
fix(agent): downgrade script completion error log to warn (#23369)
Downgrades the "reporting script completed" log in `agentscripts` from ERROR to WARN. During agent reconnects, the `scriptCompleted` RPC can race with the connection teardown, producing a "connection closed" error. Since `slogtest` treats ERROR logs as test failures, this causes `TestAgent_ReconnectNoLifecycleReemit` to flake on macOS. A failed timing report is non-fatal — the script itself has already finished, and the agent will continue operating normally. WARN is the appropriate severity, consistent with the call site in `agent.go:createDevcontainer`. Also switches from `fmt.Sprintf` to structured `slog.Error` fields for consistency with the rest of the codebase. Fixes coder/internal#1410
This commit is contained in:
@@ -398,11 +398,11 @@ func (r *Runner) run(ctx context.Context, script codersdk.WorkspaceAgentScript,
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
logger.Error(ctx, fmt.Sprintf("reporting script completed: %s", err.Error()))
|
||||
logger.Warn(ctx, "reporting script completed", slog.Error(err))
|
||||
}
|
||||
})
|
||||
if err != nil {
|
||||
logger.Error(ctx, fmt.Sprintf("reporting script completed: track command goroutine: %s", err.Error()))
|
||||
logger.Warn(ctx, "reporting script completed: track command goroutine", slog.Error(err))
|
||||
}
|
||||
}()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user