fix(coderd): handle ignored errors across coderd packages (#22851)

Handle previously ignored error return values in coderd:

- coderd/chats.go: check sendEvent errors, log on failure
- coderd/chatd/chattest: thread testing.TB through server structs,
  replace log.Printf with t.Logf, check writeSSEEvent errors
- coderd/chatd/chattool/createworkspace.go: log UpdateChatWorkspace
  failure instead of discarding both return values
- coderd/chatd/chattool/execute.go: surface ProcessOutput error in
  the timeout message returned to the caller
- coderd/provisionerdserver: log stream.Send failure in the
  DownloadFile error helper
This commit is contained in:
Mathias Fredriksson
2026-03-13 19:53:20 +02:00
committed by GitHub
parent 3bd840fe27
commit 9d33c340ec
8 changed files with 75 additions and 31 deletions
+6 -2
View File
@@ -245,14 +245,18 @@ func pollProcess(
context.Background(),
5*time.Second,
)
outputResp, _ := conn.ProcessOutput(bgCtx, processID)
outputResp, outputErr := conn.ProcessOutput(bgCtx, processID)
bgCancel()
output := truncateOutput(outputResp.Output)
timeoutMsg := fmt.Sprintf("command timed out after %s", timeout)
if outputErr != nil {
timeoutMsg += fmt.Sprintf(" (failed to get output: %v)", outputErr)
}
return ExecuteResult{
Success: false,
Output: output,
ExitCode: -1,
Error: fmt.Sprintf("command timed out after %s", timeout),
Error: timeoutMsg,
Truncated: outputResp.Truncated,
}
case <-ticker.C: