diff --git a/plugins/tend-ci-runner/skills/review-runs/SKILL.md b/plugins/tend-ci-runner/skills/review-runs/SKILL.md index 152d87b6..aebcb044 100644 --- a/plugins/tend-ci-runner/skills/review-runs/SKILL.md +++ b/plugins/tend-ci-runner/skills/review-runs/SKILL.md @@ -134,16 +134,24 @@ SINCE=$(date -u -d '24 hours ago' +%Y-%m-%dT%H:%M:%SZ) # Add the repo's extra prefixes from its `running-tend` skill: any workflow # running the tend action is in scope, not just the generated `tend-*` ones. # Step 2 prices the same list. +# +# `--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. PREFIXES=("tend-") PREFIX_RE="^($(IFS='|'; echo "${PREFIXES[*]}"))" -for workflow in $(gh api repos/$REPO/actions/workflows --jq ".workflows[] | select(.name | test(\"$PREFIX_RE\")) | .id"); do - gh api "repos/$REPO/actions/workflows/$workflow/runs?created=>=$SINCE&status=completed" \ +for workflow in $(gh api --paginate repos/$REPO/actions/workflows --jq ".workflows[] | select(.name | test(\"$PREFIX_RE\")) | .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).