Skip to content

Commit d4fca9c

Browse files
Copilotmrjf
andauthored
autoloop: handle pending CI checks and document all pause reasons
Agent-Logs-Url: https://github.com/githubnext/tsessebe/sessions/0307e618-3d47-47a6-930c-8b4e2fd2d486 Co-authored-by: mrjf <180956+mrjf@users.noreply.github.com>
1 parent dd47431 commit d4fca9c

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

.github/workflows/autoloop.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -434,12 +434,21 @@ Each run executes **one iteration for the single selected program**:
434434
PR=${EXISTING_PR:-$(gh pr list --head autoloop/{program-name} --json number -q '.[0].number')}
435435
# Watch the checks (exits non-zero if any fail — we tolerate that below).
436436
gh pr checks "$PR" --watch --interval 30 || true
437-
status=$(gh pr checks "$PR" --json conclusion -q '.[].conclusion' \
438-
| awk 'BEGIN{r="success"} /FAILURE|CANCELLED|TIMED_OUT|ACTION_REQUIRED/{r="failure"} END{print r}')
437+
# Determine status. Treat any pending/queued/in_progress as failure-to-conclude
438+
# (should not happen after --watch returns, but we guard anyway). Neutral and
439+
# skipped count as success.
440+
status=$(gh pr checks "$PR" --json conclusion,state -q '.[] | (.conclusion // .state // "")' \
441+
| awk '
442+
BEGIN { r = "success" }
443+
/^(FAILURE|CANCELLED|TIMED_OUT|ACTION_REQUIRED|STARTUP_FAILURE|STALE)$/ { r = "failure" }
444+
/^(PENDING|QUEUED|IN_PROGRESS|WAITING|REQUESTED)$/ { if (r == "success") r = "pending" }
445+
END { print r }')
439446
echo "CI status: $status"
447+
# If status == "pending" after --watch, treat as failure for safety and re-poll
448+
# once more; otherwise proceed with success/failure.
440449
```
441450

442-
Equivalent REST-API fallback: `GET /repos/{owner}/{repo}/commits/{sha}/check-runs` and `GET /repos/.../commits/{sha}/check-suites`, treating any `conclusion` in {`failure`, `timed_out`, `cancelled`, `action_required`} as failure.
451+
Equivalent REST-API fallback: `GET /repos/{owner}/{repo}/commits/{sha}/check-runs` and `GET /repos/.../commits/{sha}/check-suites`, treating any `conclusion` in {`failure`, `timed_out`, `cancelled`, `action_required`} as failure and any check still in `status` ∈ {`queued`, `in_progress`, `waiting`} as not-yet-concluded (keep polling).
443452

444453
4. Respect the **per-iteration wall clock**: 60 minutes total (including all CI waits and fix attempts). If the cap is hit while waiting or fixing, **stop** — do **not** silently abandon. Go to the **budget-exhausted** handler in Step 5b below: set `paused: true` with `pause_reason: "ci-timeout: wall-clock cap reached"`, comment on the program issue, and end the iteration. Do **not** revert — leave the broken commit in place for a human or Evergreen to pick up.
445454

@@ -768,7 +777,7 @@ All iterations in reverse chronological order (newest first).
768777
| PR | `#number` or `` | Draft PR number for this program |
769778
| Issue | `#number` or `` | Program issue number (single source of truth for status, iteration log, and human steering) |
770779
| Paused | `true` or `false` | Whether the program is paused |
771-
| Pause Reason | text or `` | Why it is paused (if applicable) |
780+
| Pause Reason | text or `` | Why it is paused. Recognized values set by the CI-gated acceptance flow: `ci-fix-exhausted: <signature>` (5 fix attempts exhausted), `stuck in CI fix loop: <signature>` (no-progress guard triggered), `ci-timeout: wall-clock cap reached` (60-min per-iteration cap hit). Other free-form text may be set for errors. |
772781
| Completed | `true` or `false` | Whether the program has reached its target metric |
773782
| Completed Reason | text or `` | Why it completed (e.g., `target metric 0.95 reached with value 0.97`) |
774783
| Consecutive Errors | integer | Count of consecutive evaluation failures |

0 commit comments

Comments
 (0)