Skip to content

[log] Add debug logging to internal/githubhttp/rate_limit.go - #10586

Merged
lpcox merged 2 commits into
mainfrom
log/githubhttp-rate-limit-66e211a5f22771ef
Aug 3, 2026
Merged

[log] Add debug logging to internal/githubhttp/rate_limit.go#10586
lpcox merged 2 commits into
mainfrom
log/githubhttp-rate-limit-66e211a5f22771ef

Conversation

@github-actions

@github-actions github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds meaningful debug logging to internal/githubhttp/rate_limit.go to aid troubleshooting of GitHub API rate-limit detection.

Changes

  • IsRateLimitText: logs when a rate-limit indicator is detected in error text (reusing the existing logHTTP logger and truncated/sanitized text, consistent with ParseRateLimitResetFromText in the same file).
  • RateLimitSignal: logs when a nil response is passed (no signal possible), and logs the status code, remaining, and reset header values when a rate limit is detected.

No new logger was created — the file already declares logHTTP (used elsewhere in the same file), so all new calls reuse it per the pkg:filename naming convention already established.

Validation

  • go build -o awmg . — succeeds
  • go vet ./internal/githubhttp — clean
  • go test ./internal/githubhttp — passes

Only this one file was modified.

Generated by Go Logger Enhancement · auto · 46 AIC · ⊞ 12.4K ·

Add meaningful debug log calls to IsRateLimitText and RateLimitSignal
to aid troubleshooting of GitHub API rate-limit detection, using the
existing logHTTP logger.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added automation enhancement New feature or request labels Aug 2, 2026
@lpcox
lpcox marked this pull request as ready for review August 3, 2026 14:57
Copilot AI review requested due to automatic review settings August 3, 2026 14:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds debug diagnostics for GitHub API rate-limit detection.

Changes:

  • Logs sanitized rate-limit text matches.
  • Logs nil responses and detected HTTP rate-limit signals.
Show a summary per file
File Description
internal/githubhttp/rate_limit.go Adds rate-limit detection logging.

Review details

Tip

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

  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment thread internal/githubhttp/rate_limit.go Outdated
strings.Contains(lower, "secondary rate limit") ||
strings.Contains(lower, "too many requests")
if isRateLimit {
logHTTP.Printf("IsRateLimitText: detected rate-limit indicator in text=%q", util.Truncate(sanitize.SanitizeString(text), 120))
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@lpcox

lpcox commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

@copilot address review feedback

Copilot AI commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

@copilot address review feedback

Addressed in fcb5984.

Copilot AI requested a review from lpcox August 3, 2026 15:25
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

🔒 mcpg Read-Only Stress — gVisor

Surface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Isolation runtime: gVisor (runsc) kernel-level isolation

Part Surface Op Result Expected Status
A MCP reads (list_issues/list_prs/get_file/list_commits) data returned ALLOWED
B MCP writes (reaction/star/issue/comment/branch/file/PR) unknown tool for all 7 BLOCKED
C CLI reads (list_issues/get_file via github CLI) data returned ALLOWED
D CLI REST writes (reaction/star/issue/comment/file) GH_TOKEN not set — rejected BLOCKED
E CLI GraphQL mutations (addReaction/addStar/createIssue) GH_TOKEN not set — rejected BLOCKED

Overall: PASS

Part B note: Gateway exposes only 22 read-only tools (-32602 unknown tool for all write attempts). No write tool reached the backend.
Parts D/E note: gh CLI unauthenticated (no GH_TOKEN); all REST and GraphQL write attempts rejected at the CLI layer before reaching GitHub API.

References: §30827279820

🔒 mcpg read-only stress (gVisor runtime) by Read-Only Stress: gVisor runtime

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

🔒 mcpg Read-Only Stress — default AWF

Surface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Isolation runtime: default AWF (normal container isolation)

Part Surface Op Result Expected Status
A MCP reads (list_issues, list_pulls, get_file_contents, list_commits) data returned ALLOWED
B MCP writes (reaction/star/issue/comment/branch/file/PR) all refused by gateway allowlist BLOCKED
C CLI reads data returned via MCP CLI (gh unauthenticated) ALLOWED
D CLI REST writes (reaction/star/issue/comment/file) all refused — gh unauthenticated BLOCKED
E CLI GraphQL mutations (addReaction/addStar/createIssue) all refused — gh unauthenticated BLOCKED

Overall: PASS

Part B detail: Gateway exposes only 22 read-only tools (get_*, list_*, search_*). All 7 write tool calls returned Error [-32602]: unknown tool — gateway-enforced allowlisting. No write succeeded.

Part D/E detail: gh CLI has no GH_TOKEN; all REST and GraphQL write attempts rejected with auth error before reaching GitHub API.

References: §30827279721

🔒 mcpg read-only stress (default AWF runtime) by Read-Only Stress: default runtime

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

🔒 mcpg Read-Only Stress — docker-sbx

Surface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Isolation runtime: docker-sbx (KVM-isolated microVM)

Part Surface Op Result Expected Status
A MCP list_issues 3 issues returned ALLOWED
A MCP list_pull_requests 3 PRs returned ALLOWED
A MCP get_file_contents (README.md) file returned ALLOWED
A MCP list_commits 3 commits returned ALLOWED
B MCP add_issue_reaction unknown tool [-32602] (gateway) BLOCKED
B MCP star_repository unknown tool [-32602] (gateway) BLOCKED
B MCP create_issue unknown tool [-32602] (gateway) BLOCKED
B MCP add_issue_comment unknown tool [-32602] (gateway) BLOCKED
B MCP create_branch unknown tool [-32602] (gateway) BLOCKED
B MCP create_or_update_file unknown tool [-32602] (gateway) BLOCKED
B MCP create_pull_request unknown tool [-32602] (gateway) BLOCKED
C CLI list_issues (github CLI) 3 issues returned ALLOWED
C CLI get_file_contents (github CLI) file returned ALLOWED
D CLI REST reaction POST gh unauthenticated (blocked) BLOCKED
D CLI REST star PUT gh unauthenticated (blocked) BLOCKED
D CLI gh issue create gh unauthenticated (blocked) BLOCKED
D CLI REST issue POST gh unauthenticated (blocked) BLOCKED
D CLI REST comment POST gh unauthenticated (blocked) BLOCKED
D CLI REST file PUT gh unauthenticated (blocked) BLOCKED
E GraphQL addReaction mutation gh unauthenticated (blocked) BLOCKED
E GraphQL addStar mutation gh unauthenticated (blocked) BLOCKED
E GraphQL createIssue mutation gh unauthenticated (blocked) BLOCKED

Overall: PASS

Note (Part B): Gateway enforces read-only via tool manifest — only 22 read tools exposed. Write tool calls return MCP [-32602]: unknown tool, a gateway-level protocol refusal.

Note (Parts D/E): gh is unauthenticated (GH_TOKEN absent), so all REST/GraphQL writes fail before reaching GitHub.

References: §30827284185

🔒 mcpg read-only stress (docker-sbx runtime) by Read-Only Stress: docker-sbx runtime

@lpcox
lpcox merged commit 25105e3 into main Aug 3, 2026
37 checks passed
@lpcox
lpcox deleted the log/githubhttp-rate-limit-66e211a5f22771ef branch August 3, 2026 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants