From 903dbc4f6b7d8fe4d425034e3ae3efe2f81401eb Mon Sep 17 00:00:00 2001 From: tend-agent <270458913+tend-agent@users.noreply.github.com> Date: Fri, 7 Aug 2026 08:28:44 +0000 Subject: [PATCH] fix(review-runs): page the run census, so a day's window isn't the last hour MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Step 1's census call takes the endpoint's default 30-item page and never follows the rest. Runs come back newest-first, so on a busy repo the "past 24 hours" list is the most recent hour: 30 of 110 tend-mention runs today, spanning 68 minutes. The truncation is silent — 200 from the API, a successful --jq, and a census reported as complete — and it under-counts the recurrence evidence the gates run on. --paginate on both calls, per_page=100 to hold the page count down, and a total_count cross-check when a count lands on a page boundary. --- plugins/tend-ci-runner/skills/review-runs/SKILL.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/plugins/tend-ci-runner/skills/review-runs/SKILL.md b/plugins/tend-ci-runner/skills/review-runs/SKILL.md index 2db2fa88..18b475cc 100644 --- a/plugins/tend-ci-runner/skills/review-runs/SKILL.md +++ b/plugins/tend-ci-runner/skills/review-runs/SKILL.md @@ -131,14 +131,21 @@ List tend CI runs that completed in the past 24 hours (the cron runs daily): ```bash REPO=$(gh repo view --json nameWithOwner --jq '.nameWithOwner') SINCE=$(date -u -d '24 hours ago' +%Y-%m-%dT%H:%M:%SZ) -for workflow in $(gh api repos/$REPO/actions/workflows --jq '.workflows[] | select(.name | startswith("tend-")) | .id'); do - gh api "repos/$REPO/actions/workflows/$workflow/runs?created=>=$SINCE&status=completed" \ +# `--paginate` on both calls. Both endpoints page at 30 by default and return +# runs newest-first, so without it the census silently covers only the most +# recent 30 runs per workflow — on a busy repo that is the last hour, not the +# last 24. Each `--jq` here is a per-element projection, so `--paginate` +# applying it per page is harmless. +for workflow in $(gh api --paginate repos/$REPO/actions/workflows --jq '.workflows[] | select(.name | startswith("tend-")) | .id'); do + gh api --paginate "repos/$REPO/actions/workflows/$workflow/runs?created=>=$SINCE&status=completed&per_page=100" \ --jq '.workflow_runs[] | {databaseId: .id, conclusion, createdAt: .created_at, name: .name}' done ``` If no runs found, report "no runs to review" and exit. +Report the run census as the count this returns. Cross-check any workflow whose count lands on a round page boundary (30, 100) against `.total_count` before trusting it — a count that equals the page size is the signature of a page that was never followed. + Then, for each run ID from above, pull its jobs and classify them: - **Long-running** (>30 min): Tend runs typically finish in single-digit minutes. Anything over 30 is worth a look — download session logs in Step 3 and diagnose where the time went (long background waits, push-wait-fix cycles, a stuck tool call).