Repository navigation
Description
What happened
Every org-wide script aborts before doing any work:
$ bash scripts/reconcile-tag-on-merge-callers.sh
HTTP 502: 502 Bad Gateway (https://api.github.com/graphql)
FATAL: discover_repos failedThat is discover_repos in scripts/lib-org.sh — the first step of org-ruleset.sh verify, reconcile-tag-on-merge-callers.sh, retire-per-repo-dispatchers.sh, retire-per-repo-candy-gates.sh and governance-reconcile.sh. None of them has an alternative path, so a flake in discovery means no org report at all.
The mechanism
The org's discovery query is one GraphQL listing at --limit 1000 with four fields. The org now holds 486 repos, so that listing is five paginated requests. Under current gateway conditions the later pages intermittently return 502/504, and the whole command fails:
$ gh repo list opencharly --limit 1000 --json name,isArchived,isFork,defaultBranchRef --jq 'length'
486
$ gh repo list opencharly --limit 200 --json name,isArchived,isFork,defaultBranchRef --jq 'length'
200
$ gh repo list opencharly --limit 1000 --json name,isArchived,isFork,defaultBranchRef --jq 'length'
HTTP 502: 502 Bad Gateway (https://api.github.com/graphql)
$ gh repo list opencharly --limit 200 --json name,isArchived,isFork,defaultBranchRef --jq 'length'
200Interleaved in that order, so the variable is the QUERY SIZE, not the minute. The same shape shows at the other sizes tried: --limit 100 and --limit 200 succeeded on every attempt, --limit 500 and --limit 1000 produced 502, and one --limit 1000 produced 504 Gateway Timeout.
Small queries are healthy throughout, which rules out "the API is down":
$ gh api graphql -f query='{viewer{login}}' --jq '.data.viewer.login'
aitrawog
$ gh api graphql -f query='{organization(login:"opencharly"){repositories(first:1){nodes{name}}}}' --jq '.data.organization.repositories.nodes[0].name'
marketplace
$ gh api "orgs/opencharly/repos?per_page=100&page=5" --jq 'length'
86REST paging answered pages 2-5 as 100, 100, 100, 86 without a single failure while the GraphQL listing was failing (page 1 was not separately requested; the org total 486 is from the GraphQL listing that did succeed).
The missed control
discover_repos and discover_excludes have no classification of a provider error: they run under set -o pipefail, return non-zero on any gh failure, and every caller turns that into FATAL. There is no distinction between "the org has no repos", "this token cannot read them" and "page 4 of 5 502'd" — all three abort identically, and nothing retries or narrows the request.
The repo's own tests cannot see this class at all: org-ruleset_test.sh, reconcile-tag-on-merge-callers_test.sh and the retirement tests substitute a mock gh, so the coverage proves the logic around discovery and never the provider behaviour of discovery itself.
Blast radius
Every org-wide operation, measured today:
reconcile-tag-on-merge-callers.sh— four consecutive attempts across ~25 minutes failed at discovery, so the#204rollout (which also carries the#286assertion and the#215schedule backstop into every per-repo caller) could not start.org-ruleset.sh verify— the org end-state assertion is unreachable for the same reason.- The retirement scripts — same discovery, same abort.
This is not a content defect in any repo; it is the org's inability to enumerate its own repos reliably right now.
What would close it
Either one closes the immediate failure; both are small and local to lib-org.sh:
- Page discovery at a size the gateway serves reliably.
--limit 100/--limit 200were stable across every attempt while500/1000were not. Chunking the listing (or using RESTorgs/:org/repospaging, which served 5/5 pages cleanly here) removes the failure without any retry. - Classify the transient class in discovery only — a bounded retry of a
5xxon a discovery page, failing loud when it persists, so a socket reset costs a second rather than the whole report.
The same tension as #286 applies to (2): a blind retry is what R3 forbids, so it is worth taking (1) first — it removes the failure rather than absorbing it.
Agent: containerd-crabbox-program · session 8b1c01cf-7f79-4a75-bff8-240415a06208
Assisted-by: Claude Code deepseek-v4.1-flash:cloud (analysed on a live system)
Activity
aitrawog commentedon Nov 9, 2026
CLAIM
Taking option 1 from the issue body — remove the failure rather than absorb it: discovery pages at a size the gateway serves reliably, so no retry is involved (option 2 would be the R3-sensitive one, and I would rather not have a retry in the org's step zero).
Intended shape, to be measured before it is written:
discover_repos/discover_excludesstop issuing one--limit 1000listing and page explicitly, with the page size named once.mapfile < <(fn)note in the file already warns about).ghtests get a fixture that serves MULTIPLE pages and one whose second page fails, so the coverage distinguishes a complete discovery from a partial one.I will not run the
#204rollout from this same change: that is 486 outward writes and belongs in its own operation once discovery is trustworthy.Agent:
containerd-crabbox-program· session8b1c01cf-7f79-4a75-bff8-240415a06208Assisted-by: Claude Code deepseek-v4.1-flash:cloud
fix(ci): discovery pages REST and refuses a truncated repo set (#290) (…
aitrawog commentedon Nov 9, 2026
RESOLVED
#291 MERGED
2026-11-09T18:49:49Z, squash38a0b65c30e1c30bbc6973653fc48d3c4e9d385e, tagv2026.313.1849verified pointing at exactly that merge. Verdict## Review — PASS;workflow-checksandlintgreen on every head of the branch.What landed:
discover_allpages REST at one named page size and refuses a truncated repo set (count checked against the org's own total), with the two filters and the membership arm deriving from it;org-ruleset.sh's membership arm no longer issues its own--limit 1000listing. No retry anywhere (R3) — the failure was removed, not absorbed.Proof it removed the failure: the reconcile that died four times at
FATAL: discover_repos failednow walks the org and exits 0 —Closed explicitly, not by
Closes— native auto-merge does not run GitHub's post-merge side effects, which is the same platform behaviour this programme has recorded repeatedly; the keyword was in the body and the issue was still OPEN after the merge.Residual, filed rather than left implicit: #292 — the filters each issue their own read, so a script performs two or three paged listings and a repo created between them lands in neither set. That is a consolidation, not a correctness gap: every read is count-checked and every call site aborts on failure.
Agent:
containerd-crabbox-program· session8b1c01cf-7f79-4a75-bff8-240415a06208Assisted-by: Claude Code deepseek-v4.1-flash:cloud (fully tested and validated)