open-design/.github
lefarcen 54f225d6b3
ci: retry PR-context gh calls so a transient API blip doesn't abort the run (#3128)
* ci: retry PR-context gh calls so a transient API blip doesn't abort the run

The early PR-context gathering calls `gh pr diff`, `gh pr view`, and
`gh api .../files`. gh hits api.github.com under the hood, and a single
transient timeout/5xx there aborts the whole run before any exploration
(seen on #3083: "could not find pull request diff: Get \"https://api.
github.com/...\": net/http timeout"). These were the only network calls
in the run without a retry (source fetch + npm already retry).

Add a small gh_retry helper (4 attempts, linear backoff) and wrap the
three read-only context calls. gh writes nothing to stdout on a failed
API call, so retrying is safe even for the calls piped into the context
file; the retry warning goes to stderr.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* ci: address review — buffer gh retries to files (no paginated duplication)

Review (Siri-Ray): wrapping `gh api --paginate` retries inline while the
context block is redirected to the file means a mid-pagination failure
leaves partial pages in the context, and the retry appends them again —
duplicating the patches section and burning the context budget the agent
reads.

Replace the in-pipe gh_retry with gh_retry_file: each call buffers to its
own file per attempt (`>` truncates on open, so a failed/partial attempt
is discarded before the next), and the context block just cats the
finished files. Fetch PR body + patches to files up front, then assemble.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-27 14:42:08 +00:00
..
actions fix(ci): narrow workflow scope and reuse setup steps (#2708) 2026-05-22 18:58:53 +08:00
ISSUE_TEMPLATE refactor(issue-template): separate logs and screenshots fields in bug report (#3032) 2026-05-27 04:41:28 +00:00
screenshots feat(ui): add copy to clipboard functionality for user messages with … (#1669) 2026-05-14 20:19:20 +08:00
scripts ci: retry PR-context gh calls so a transient API blip doesn't abort the run (#3128) 2026-05-27 14:42:08 +00:00
workflows ci: clean agent report (write-to-file) + slim artifacts/uploads (#3116) 2026-05-27 12:30:05 +00:00
actionlint.yaml Add sandboxed agent PR exploration (#2604) 2026-05-26 07:52:42 +00:00
pull_request_template.md docs(pr): require user-perspective description and surface area (#1520) 2026-05-13 15:28:05 +08:00