Skip to content

skills(review-reviewers,review-runs): retry tracking-issue lookup on empty result - #345

Closed
tend-agent wants to merge 1 commit into
mainfrom
fix/tracking-issue-lookup-retry-25009161877
Closed

tend-agent wants to merge 1 commit into
mainfrom
fix/tracking-issue-lookup-retry-25009161877

Conversation

@tend-agent

Copy link
Copy Markdown
Collaborator

Summary

Retries the gh issue list tracking-issue lookup up to 3 times before treating empty as ground truth. Same fix applied to both review-reviewers and review-runs SKILL.md (identical lookup code in both).

Evidence

GitHub's /issues endpoint is intermittently returning [] for queries whose matching issues clearly exist. Reproduced empirically during analysis run 25009161877:

=== gh issue list (5 attempts, same command) ===
Attempt 1: ''
Attempt 2: '133'
Attempt 3: ''
Attempt 4: ''
Attempt 5: '133'

=== Raw API count ===
Attempt 1: count=0, []
Attempt 2: count=0, []
Attempt 3: count=2, [#342, #133]
Attempt 4: count=2, [#342, #133]
Attempt 5: count=0, []

Response ETags differ between empty and populated responses, suggesting different read replicas/cache entries serve the same query inconsistently. gh search issues, gh api search/issues, and gh api repos/.../issues (with and without label filter) all show the same flake — it's at the GitHub API layer, not specific to one endpoint.

Outcome impact (today, max-sixty/tend)

Two duplicate tracking issues created within one hour today on top of pre-existing tracking issue #133:

  • #342 created at 16:18:06Z by review-reviewers run 25006456679 (max-sixty/worktrunk matrix cell)
  • #344 created at 17:16:05Z by review-reviewers run 25009161877 (max-sixty/tend matrix cell — this analysis run)

Each duplicate triggered a tend-triage run that exited silently after recognizing the tracking-label shape:

Gates

  • Confidence: High — 2 occurrences in one hour today (independent matrix runs), reproduced live (3 of 5 manual attempts returned empty for known-existing issues).
  • Classification: Structural — the script is non-resilient to a known API behavior; same conditions reproduce reliably.
  • Magnitude: Targeted fix, ~6 added lines per file.
  • Both gates pass.

Evidence gist

https://gist.github.com/8f10d7c1abcb07c79bef00ee6d02d315

Cleanup

#342 and #344 can be closed by a maintainer (both empty, the pre-existing #133 is the canonical tracking issue for 2026-04 with all per-target gist references).

…empty result

Why: GitHub's /issues endpoint intermittently returns [] even when matching
issues exist (different read replicas serve different ETags for the same
query). A single empty response makes the skill think no tracking issue
exists and create a duplicate, which then triggers a tend-triage run on
the new dup.

Both skills had identical lookup code; both retry up to 3 times before
treating empty as ground truth.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@tend-agent tend-agent added the claude-behavior Behavioral issues found by review-reviewers label Apr 27, 2026
@max-sixty

Copy link
Copy Markdown
Owner

I'm skeptical that gh actually returns []; are we sure that's what's happening?

@tend-agent

Copy link
Copy Markdown
Collaborator Author

Reproduced just now against max-sixty/tend (gh 2.89.0). The exact query the script runs, captured raw with --json number,title:

Attempt 1: [{"number":342,...},{"number":133,...}]
Attempt 2: [{"number":342,...},{"number":133,...}]
Attempt 3: []
Attempt 4: []
Attempt 5: [{"number":342,...},{"number":133,...}]

That's the literal byte sequence [] from gh issue list --state open --label review-reviewers-tracking --json number,title, with no jq applied, on a query whose result demonstrably contains #133, #342, and #344 (all OPEN with the right label). 2 of 5 attempts returned an empty array.

A second batch of 10 attempts run a moment later showed a different artifact of the same flake — gh issue list consistently returned 2 issues (#133, #342) while gh api repos/.../issues for the same filter returned count=0 8 of 10 times. So both the GraphQL path that gh issue list uses and the REST path that gh api uses are flaking, just on different cache shards.

Note also: even the "non-empty" responses are stale — they omit #344, an OPEN issue with the matching label and title created an hour earlier. So this isn't strictly a binary [] vs full flake; partial/stale responses also occur. The retry handles the empty case (the only one that causes the duplicate-creation bug); partial-response shouldn't matter since we sort and pick the lowest number.

@max-sixty

Copy link
Copy Markdown
Owner

is there an issue on gh for this? can we reproduce with curl? it's extremely surprising that gh returns incorrect results

@tend-agent

Copy link
Copy Markdown
Collaborator Author

Your skepticism was warranted — this isn't a gh bug. It's a GitHub server-side incident.

GitHub Status, 2026-04-27 "GitHub search is degraded" — critical impact, 16:31–22:46 UTC, components Issues / Pull Requests / Actions / Packages. Status update at 19:50 UTC pinpointed the cause: "identified the source of the additional load causing stress on our ElasticSearch clusters." The 17:35 update explicitly named symptoms — "intermittent failures to view issues, pull requests, projects and Actions workflow runs."

The two duplicate tracking issues were created at 16:18 (#342) and 17:16 (#344) — squarely inside that window. The reproduction I posted yesterday at 19:23 UTC was also during the incident.

That explains the symmetric flake pattern from yesterday's repro — gh issue list (GraphQL) and gh api repos/.../issues (REST label filter) both flaking on different cache shards. Issue label filtering goes through ElasticSearch in both paths; when ES is degraded, both layers return stale or empty results, just from different shards. gh faithfully returned what the API gave it.

Cannot reproduce now. Re-ran 30 attempts each via curl REST, curl search/issues, curl GraphQL, and gh issue list — all returned 5 issues consistently, 0 empties. The incident resolved at 22:46 UTC last night.

curl REST /repos/.../issues?labels=...     30/30 = count 5
curl /search/issues?q=label:...            30/30 = total_count 5
curl GraphQL repository.issues(labels:[…]) 30/30 = totalCount 5
gh issue list --label ...                  30/30 = count 5

No upstream cli/cli issue — searched and found nothing matching this shape. There wouldn't be one, since gh isn't the broken layer.

So the question for the PR is whether to keep the retry as defensive mitigation against future GitHub search/ES incidents, or close it since today's specific cause is resolved server-side. Your call. The retry is cheap (3 attempts, no backoff needed since the flake is per-request) but it is mitigating GitHub, not gh.

@max-sixty

Copy link
Copy Markdown
Owner

close it, any variants of it

@tend-agent

Copy link
Copy Markdown
Collaborator Author

Closing per #345 (comment) — root cause was the GitHub search-degradation incident on 2026-04-27, not a gh bug, and the workaround isn't worth keeping.

@tend-agent tend-agent closed this Apr 28, 2026
max-sixty pushed a commit that referenced this pull request Aug 30, 2026
…earch missed (#1096)

The weekly `consumers.json` refresh rebuilds the file wholesale from `gh
search code`, so the file inherits the search's recall. Today's search
returned 6 of the 8 listed consumers, and running the recipe as written
would have deleted `jakobtfaber/Faber2026` and
`max-sixty/cargo-affected` — both live, both still carrying eight
`tend-*.yaml` files — from the data the public site renders. This makes
the search a discovery step only: candidates are the union of the search
hits and the repos already listed, and a per-repo API check decides who
stays.

<details><summary>Evidence and verification</summary>

**The miss is in the index, not the query or the cap.** The search
returns 52 hits against a 100 cap, so nothing is crowded out; both repos
simply return zero hits for `max-sixty/tend` while their workflow files
demonstrably contain the ref:

```
$ gh search code 'max-sixty/tend' --repo max-sixty/cargo-affected
(no results)
$ gh api repos/max-sixty/cargo-affected/contents/.github/workflows/tend-review.yaml | ... | grep uses:
      - uses: max-sixty/tend/[email protected]
```

`max-sixty/cargo-affected` returns nothing for a bare `tend` query
either — the repo is absent from the code index, not stale in it. #1093
observed the same 6-of-8 result independently and named this as out of
scope for that PR.

**Not a retry.** #345 was closed on the principle that a retry wrapper
around a transient search blip isn't worth keeping. This adds no retry
and re-queries nothing: it stops treating search absence as evidence of
removal, and moves the keep/drop decision onto an authoritative per-repo
API check that an uninstall actually fails.

**Verified.** The recipe was extracted verbatim from the file and run
under `set -euo pipefail` against real GitHub: 6 discovered, 8
candidates, 8 retained, output byte-identical to the committed
`data/consumers.json`. The drop path was exercised separately against a
repo with no matching workflows (`octocat/Hello-World` → `count=0`,
dropped). `uv run pytest` passes (763), as does `pre-commit` on the
changed file.

**Out of scope, worth its own look:** `max-sixty/tend-integration`
satisfies both filters — 3 `tend-*.yaml` files and `bot_name:
tend-agent` — and is absent from the list only because code search does
not index it either. If it is ever indexed, the weekly refresh adds the
test fixture to the public site's adopter list.

</details>

---------

Co-authored-by: tend-agent <[email protected]>
max-sixty pushed a commit that referenced this pull request Aug 30, 2026
…earch missed (#1096)

The weekly `consumers.json` refresh rebuilds the file wholesale from `gh
search code`, so the file inherits the search's recall. Today's search
returned 6 of the 8 listed consumers, and running the recipe as written
would have deleted `jakobtfaber/Faber2026` and
`max-sixty/cargo-affected` — both live, both still carrying eight
`tend-*.yaml` files — from the data the public site renders. This makes
the search a discovery step only: candidates are the union of the search
hits and the repos already listed, and a per-repo API check decides who
stays.

<details><summary>Evidence and verification</summary>

**The miss is in the index, not the query or the cap.** The search
returns 52 hits against a 100 cap, so nothing is crowded out; both repos
simply return zero hits for `max-sixty/tend` while their workflow files
demonstrably contain the ref:

```
$ gh search code 'max-sixty/tend' --repo max-sixty/cargo-affected
(no results)
$ gh api repos/max-sixty/cargo-affected/contents/.github/workflows/tend-review.yaml | ... | grep uses:
      - uses: max-sixty/tend/[email protected]
```

`max-sixty/cargo-affected` returns nothing for a bare `tend` query
either — the repo is absent from the code index, not stale in it. #1093
observed the same 6-of-8 result independently and named this as out of
scope for that PR.

**Not a retry.** #345 was closed on the principle that a retry wrapper
around a transient search blip isn't worth keeping. This adds no retry
and re-queries nothing: it stops treating search absence as evidence of
removal, and moves the keep/drop decision onto an authoritative per-repo
API check that an uninstall actually fails.

**Verified.** The recipe was extracted verbatim from the file and run
under `set -euo pipefail` against real GitHub: 6 discovered, 8
candidates, 8 retained, output byte-identical to the committed
`data/consumers.json`. The drop path was exercised separately against a
repo with no matching workflows (`octocat/Hello-World` → `count=0`,
dropped). `uv run pytest` passes (763), as does `pre-commit` on the
changed file.

**Out of scope, worth its own look:** `max-sixty/tend-integration`
satisfies both filters — 3 `tend-*.yaml` files and `bot_name:
tend-agent` — and is absent from the list only because code search does
not index it either. If it is ever indexed, the weekly refresh adds the
test fixture to the public site's adopter list.

</details>

---------

Co-authored-by: tend-agent <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

claude-behavior Behavioral issues found by review-reviewers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants