Skip to content

[log] Add debug logging to rate_limit.go#6870

Merged
lpcox merged 1 commit into
mainfrom
log/rate-limit-logging-8cea787c13f77832
Jun 2, 2026
Merged

[log] Add debug logging to rate_limit.go#6870
lpcox merged 1 commit into
mainfrom
log/rate-limit-logging-8cea787c13f77832

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot commented Jun 1, 2026

Adds meaningful logCircuitBreaker debug calls to the functions in internal/server/rate_limit.go that previously had no logging coverage.

Changes

  • extractRateLimitErrorText: logs when the result is not a map (unexpected input), when scanning content items (with count), and when the fallback default message is used
  • isRateLimitToolResult: logs the number of content items being inspected when an error result is encountered
  • parseRateLimitResetFromText: logs when the "rate reset in Ns" pattern is absent from the error text

All new log calls use the existing logCircuitBreaker logger (declared in circuit_breaker.go, same package) — no new logger declaration needed.

Quality checklist

  • Exactly 1 file modified
  • No test files modified
  • Reuses existing logCircuitBreaker logger (no duplicate declaration)
  • Logger naming follows pkg:filename convention (existing: server:circuit_breaker)
  • Log arguments have no side effects
  • Log messages are meaningful for debugging rate-limit behaviour
  • No duplicate logging with existing calls
  • go build passes
  • go test ./... passes
  • go vet ./... passes

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • index.crates.io

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "index.crates.io"

See Network Configuration for more information.

Generated by Go Logger Enhancement · sonnet46 4.7M ·

Add meaningful logCircuitBreaker debug calls to the three functions
in rate_limit.go that previously had no logging:

- extractRateLimitErrorText: log when result is not a map, when
  scanning content items, and when no text is found (fallback path)
- isRateLimitToolResult: log the number of content items being
  inspected when an error result is encountered
- parseRateLimitResetFromText: log when the reset time pattern is
  absent from the error text

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added automation enhancement New feature or request labels Jun 1, 2026
@lpcox lpcox marked this pull request as ready for review June 2, 2026 16:40
Copilot AI review requested due to automatic review settings June 2, 2026 16:40
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves observability of the server-side rate limit detection flow by adding additional logCircuitBreaker debug logging in internal/server/rate_limit.go, helping diagnose unexpected tool result shapes and why reset timestamps aren’t being inferred.

Changes:

  • Add debug logging when extractRateLimitErrorText receives an unexpected (non-map) result and when it falls back to the default message.
  • Add debug logging showing how many content items are scanned in extractRateLimitErrorText / isRateLimitToolResult.
  • Add debug logging when parseRateLimitResetFromText does not find the "rate reset in " pattern.
Show a summary per file
File Description
internal/server/rate_limit.go Adds debug log lines around error-text extraction, rate-limit tool-result inspection, and reset-time parsing fallback paths.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 1/1 changed files
  • Comments generated: 0

@lpcox lpcox merged commit 692b023 into main Jun 2, 2026
23 checks passed
@lpcox lpcox deleted the log/rate-limit-logging-8cea787c13f77832 branch June 2, 2026 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants