fix: handle partial results from gh aw logs on rate limit#24571
Merged
Conversation
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>
This was referenced Apr 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The token audit workflow fails completely when
gh aw logshits the API rate limit, even though it successfully downloaded 163 runs before the limit was reached (run #23986065459).Root cause:
gh aw logs --jsonwrites JSON to stdout only at the end (renderLogsJSONat line 575 oflogs_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)
|| LOGS_EXIT=$?instead of lettingset -eabort{"runs":[],"summary":{}}if nothing was capturedRoot cause fix needed
The deeper fix (
gh aw logsshould output partial results on error) is tracked in #24568.