Skip to content

fix: handle partial results from gh aw logs on rate limit#24571

Merged
lpcox merged 1 commit intomainfrom
fix/token-audit-partial-logs
Apr 4, 2026
Merged

fix: handle partial results from gh aw logs on rate limit#24571
lpcox merged 1 commit intomainfrom
fix/token-audit-partial-logs

Conversation

@lpcox
Copy link
Copy Markdown
Collaborator

@lpcox lpcox commented Apr 4, 2026

Problem

The token audit workflow fails completely when gh aw logs hits the API rate limit, even though it successfully downloaded 163 runs before the limit was reached (run #23986065459).

Root cause: gh aw logs --json writes JSON to stdout only at the end (renderLogsJSON at line 575 of logs_orchestrator.go). When rate limiting triggers an error during pagination (line 173), the function returns early — all successfully processed runs are discarded.

Fix (workflow-side)

  • Capture exit code with || LOGS_EXIT=$? instead of letting set -e abort
  • Process whatever JSON was written to the file
  • Fall back to empty {"runs":[],"summary":{}} if nothing was captured
  • Report partial results with a warning

Root cause fix needed

The deeper fix (gh aw logs should output partial results on error) is tracked in #24568.

gh aw logs exits non-zero when it hits the GitHub API rate limit
during pagination, discarding all successfully downloaded runs
(163 runs lost in run #23986065459). The JSON output is never
written because the error return at logs_orchestrator.go:173
skips renderLogsJSON entirely.

This workflow-side fix:
- Captures the exit code with || LOGS_EXIT=$? instead of aborting
- Processes whatever partial JSON was written
- Falls back to empty JSON if nothing was captured

The root cause (gh aw logs discarding partial results) is tracked
in issue #24568.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 4, 2026 19:53
@lpcox lpcox merged commit b6e4a90 into main Apr 4, 2026
85 of 87 checks passed
@lpcox lpcox deleted the fix/token-audit-partial-logs branch April 4, 2026 19:54
@lpcox lpcox review requested due to automatic review settings April 4, 2026 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant