Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions packages/envd/internal/host/mmds.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,26 +139,32 @@
httpClient := &http.Client{}
defer httpClient.CloseIdleConnections()

var lastErr error

Check warning on line 142 in packages/envd/internal/host/mmds.go

View check run for this annotation

Claude / Claude Code Review

envd version not bumped despite behavioral change

envd's runtime behavior changes here (stderr now uses the `<4>` syslog priority prefix, per-iteration error lines are suppressed, and the cancellation message wording/format differs), but `packages/envd/pkg/version.go` is still `0.5.20`. Per CLAUDE.md line 133, "Version in `pkg/version.go` must be bumped on every behavioral change" — please bump to `0.5.21` to match the convention followed by #2660, #2639, and #2643.
Comment thread
ValentaTomas marked this conversation as resolved.

ticker := time.NewTicker(50 * time.Millisecond)
defer ticker.Stop()

for {
select {
case <-ctx.Done():
fmt.Fprintf(os.Stderr, "context cancelled while waiting for mmds opts")
if lastErr != nil {
fmt.Fprintf(os.Stderr, "<4>gave up polling for mmds opts: %v (last error: %v)\n", ctx.Err(), lastErr)
} else {
fmt.Fprintf(os.Stderr, "<4>gave up polling for mmds opts: %v\n", ctx.Err())
}

return
case <-ticker.C:
token, err := getMMDSToken(ctx, httpClient)
if err != nil {
fmt.Fprintf(os.Stderr, "error getting mmds token: %v\n", err)
lastErr = fmt.Errorf("get mmds token: %w", err)

Check warning on line 160 in packages/envd/internal/host/mmds.go

View check run for this annotation

Claude / Claude Code Review

Log message text says "first failure of each kind" but code records last error

The PR description and commit message say "Log only the first failure of each kind", but the code unconditionally overwrites `lastErr` on every failed tick (lines 160 and 167), so the cancellation log surfaces whichever error happened *last* — not the first, and not per error class. Either gate the assignment with `if lastErr == nil` to match the stated intent, or adjust the wording to say "last error".
Comment thread
ValentaTomas marked this conversation as resolved.

continue
}

mmdsOpts, err := getMMDSOpts(ctx, httpClient, token)
if err != nil {
fmt.Fprintf(os.Stderr, "error getting mmds opts: %v\n", err)
lastErr = fmt.Errorf("get mmds opts: %w", err)

continue
}
Expand Down
Loading