diff --git a/.github/scripts/check-fork-schedule-stall.sh b/.github/scripts/check-fork-schedule-stall.sh new file mode 100755 index 0000000000..0d9996c1d1 --- /dev/null +++ b/.github/scripts/check-fork-schedule-stall.sh @@ -0,0 +1,141 @@ +#!/usr/bin/env bash +# check-fork-schedule-stall.sh — classify a fork's Actions schedule health (#14444). +# +# Distinguishes the two competing diagnoses for a stalled scheduled +# workflow: a single workflow failing (fix the workflow or its +# dispatch path) versus repo-wide cron silence while every other +# event type keeps running (GitHub's scheduled-workflow suppression +# for fork repositories — a platform limit, not a code defect). +# +# Input is a runs JSON document as produced by +# `gh api repos/OWNER/REPO/actions/runs?per_page=N`: either an object +# with a `.workflow_runs` array or a bare array. Each run needs +# `id`, `name`, `event`, `created_at` (conclusion optional). +# +# Output is stable `key=value` lines on stdout: per-workflow last +# schedule event counts, the newest schedule event repo-wide, +# days-since, non-schedule activity after it, and the verdict. +# +# Verdicts: +# healthy newest schedule event within the window +# repo-wide-cron-silence schedules older than the window AND at +# least one non-schedule run is newer than +# the newest schedule event (Actions alive, +# crons dead) — escalate as a platform limit +# single-workflow-or-idle schedules older than the window but no +# newer non-schedule activity (repo idle or +# one workflow quietly failing — needs a +# per-workflow look, not an escalation) +# no-schedule-data no schedule events in the input at all +# +# Oracle: the 2026-11-24 developing-today-forks/opencode stall is the +# golden case — last schedule event 2026-11-20T23:01:45Z +# (repo-sweeper success), Dependabot dynamic runs still firing +# 2026-11-24, zero schedule events after 2026-11-20 — verdict +# repo-wide-cron-silence (see the contract test fixtures, which are +# excerpts of that live data with real run IDs). +# +# Usage: +# check-fork-schedule-stall.sh --runs-json FILE [--now ISO8601] [--min-silent-days N] +# check-fork-schedule-stall.sh --help +# Exit: 0 = classified (verdict line always present); 1 = usage/read/parse error. +set -euo pipefail + +usage() { + sed -n '2,/^set -euo/p' "$0" | sed 's/^# \?//' +} + +RUNS_JSON="" +NOW="" +MIN_SILENT_DAYS="2" + +while [ "$#" -gt 0 ]; do + case "$1" in + --runs-json) + [ "$#" -ge 2 ] || { echo "check-fork-schedule-stall: --runs-json needs a value" >&2; exit 1; } + RUNS_JSON="$2"; shift 2 ;; + --now) + [ "$#" -ge 2 ] || { echo "check-fork-schedule-stall: --now needs a value" >&2; exit 1; } + NOW="$2"; shift 2 ;; + --min-silent-days) + [ "$#" -ge 2 ] || { echo "check-fork-schedule-stall: --min-silent-days needs a value" >&2; exit 1; } + MIN_SILENT_DAYS="$2"; shift 2 ;; + --help | -h) usage; exit 0 ;; + *) + echo "check-fork-schedule-stall: unexpected argument '$1'" >&2 + echo "usage: check-fork-schedule-stall.sh --runs-json FILE [--now ISO8601] [--min-silent-days N]" >&2 + exit 1 ;; + esac +done + +[ -n "$RUNS_JSON" ] || { echo "check-fork-schedule-stall: --runs-json is required" >&2; exit 1; } +[ -r "$RUNS_JSON" ] || { echo "check-fork-schedule-stall: cannot read $RUNS_JSON" >&2; exit 1; } +case "$MIN_SILENT_DAYS" in +'' | *[!0-9]*) echo "check-fork-schedule-stall: --min-silent-days must be a non-negative integer" >&2; exit 1 ;; +esac + +exec python3 - "$RUNS_JSON" "$NOW" "$MIN_SILENT_DAYS" <<'PYEOF' +import json, sys +from datetime import datetime, timezone + +path, now_arg, min_days_arg = sys.argv[1], sys.argv[2], int(sys.argv[3]) + +def parse_ts(s): + return datetime.fromisoformat(str(s).replace("Z", "+00:00")) + +try: + with open(path, encoding="utf-8") as fh: + doc = json.load(fh) +except Exception as exc: + print(f"check-fork-schedule-stall: cannot parse {path}: {exc}", file=sys.stderr) + sys.exit(1) + +runs = doc.get("workflow_runs", doc) if isinstance(doc, dict) else doc +if not isinstance(runs, list): + print("check-fork-schedule-stall: expected an object with .workflow_runs or a bare array", + file=sys.stderr) + sys.exit(1) + +now = parse_ts(now_arg) if now_arg else datetime.now(timezone.utc) + +sched = [r for r in runs if isinstance(r, dict) and r.get("event") == "schedule" + and r.get("created_at")] +if not sched: + print("workflows_with_schedule_events=0") + print("verdict=no-schedule-data") + sys.exit(0) + +by_wf = {} +for r in sched: + name = str(r.get("name", "?")) + ts = parse_ts(r["created_at"]) + if name not in by_wf or ts > by_wf[name][0]: + by_wf[name] = (ts, r.get("id"), r.get("conclusion")) + +newest_name = max(by_wf, key=lambda n: by_wf[n][0]) +newest_ts, newest_id, newest_conc = by_wf[newest_name] +days_silent = (now - newest_ts).total_seconds() / 86400 + +fresh_other = 0 +for r in runs: + if not isinstance(r, dict) or r.get("event") == "schedule" or not r.get("created_at"): + continue + if parse_ts(r["created_at"]) > newest_ts: + fresh_other += 1 + +if days_silent <= min_days_arg: + verdict = "healthy" +elif fresh_other > 0: + verdict = "repo-wide-cron-silence" +else: + verdict = "single-workflow-or-idle" + +print(f"workflows_with_schedule_events={len(by_wf)}") +print(f"newest_schedule_event={newest_ts.strftime('%Y-%m-%dT%H:%M:%SZ')}") +print(f"newest_schedule_workflow={newest_name}") +print(f"newest_schedule_run_id={newest_id}") +print(f"newest_schedule_conclusion={newest_conc}") +print(f"days_since_last_schedule={days_silent:.1f}") +print(f"nonschedule_runs_since_last_schedule={fresh_other}") +print(f"verdict={verdict}") +PYEOF diff --git a/.github/scripts/check-fork-schedule-stall.test.sh b/.github/scripts/check-fork-schedule-stall.test.sh new file mode 100755 index 0000000000..2ed31eea8e --- /dev/null +++ b/.github/scripts/check-fork-schedule-stall.test.sh @@ -0,0 +1,125 @@ +#!/usr/bin/env bash +# check-fork-schedule-stall.test.sh — contract tests for the fork +# schedule-stall classifier (#14444). Builds fixture runs documents +# and asserts the verdict line plus the measured fields. +# +# Oracle: the stall fixture is an excerpt of live +# developing-today-forks/opencode data from 2026-11-24 (real run +# IDs): last schedule event repo-sweeper 44833661765 at +# 2026-11-20T23:01:45Z, agents 44826053161 failed at 22:06Z on the +# pm-dispatch 502, Dependabot dynamic runs still firing 11-24. +# Verdict must be repo-wide-cron-silence. The healthy and idle +# fixtures are synthetic companions pinning the other branches. +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +CHECK="$SCRIPT_DIR/check-fork-schedule-stall.sh" +TMP="$(mktemp -d)" +trap 'rm -rf "$TMP"' EXIT + +fail_count=0 + +# expect_verdict FIXTURE NOW WANT_VERDICT [WANT_PATTERN...] +expect_verdict() { + local fixture="$1" now="$2" want="$3" + shift 3 + local out rc + out="$(bash "$CHECK" --runs-json "$fixture" --now "$now" 2>&1)" && rc=0 || rc=$? + if [ "$rc" -ne 0 ]; then + echo "FAIL $want: exit $rc" + echo "$out" | head -5 + fail_count=$((fail_count + 1)) + return + fi + local got + got="$(grep -E '^verdict=' <<<"$out" || true)" + if [ "$got" != "verdict=$want" ]; then + echo "FAIL $want: got '$got'" + echo "$out" | head -8 + fail_count=$((fail_count + 1)) + return + fi + local pat ok=1 + for pat in "$@"; do + if ! grep -qF "$pat" <<<"$out"; then + echo "FAIL $want: output missing '$pat'" + echo "$out" | head -8 + ok=0 + fail_count=$((fail_count + 1)) + fi + done + [ "$ok" -eq 1 ] && echo "pass $want" +} + +# Fixture 1: the live 2026-11-24 stall (real run IDs, trimmed fields). +cat >"$TMP/stall.json" <<'JSON' +{"workflow_runs": [ + {"id": 45459750765, "name": "npm_and_yarn", "event": "dynamic", "conclusion": null, "created_at": "2026-11-24T18:27:30Z"}, + {"id": 44833661765, "name": "repo-sweeper", "event": "schedule", "conclusion": "success", "created_at": "2026-11-20T23:01:45Z"}, + {"id": 44832026321, "name": "auto-format", "event": "schedule", "conclusion": "success", "created_at": "2026-11-20T22:49:09Z"}, + {"id": 44826053161, "name": "agents", "event": "schedule", "conclusion": "failure", "created_at": "2026-11-20T22:06:00Z"}, + {"id": 44803563625, "name": "models-snapshot", "event": "schedule", "conclusion": "success", "created_at": "2026-11-20T19:35:29Z"} +]} +JSON + +# Fixture 2: healthy — a schedule event 3 hours ago. +cat >"$TMP/healthy.json" <<'JSON' +{"workflow_runs": [ + {"id": 999, "name": "agents", "event": "schedule", "conclusion": "success", "created_at": "2026-11-24T18:00:00Z"}, + {"id": 998, "name": "repo-sweeper", "event": "schedule", "conclusion": "success", "created_at": "2026-11-23T23:00:00Z"} +]} +JSON + +# Fixture 3: idle — old schedules, nothing newer of any kind. +cat >"$TMP/idle.json" <<'JSON' +{"workflow_runs": [ + {"id": 997, "name": "agents", "event": "schedule", "conclusion": "failure", "created_at": "2026-11-20T22:06:00Z"}, + {"id": 996, "name": "repo-sweeper", "event": "schedule", "conclusion": "success", "created_at": "2026-11-20T23:01:45Z"} +]} +JSON + +NOW="2026-11-24T21:00:00Z" + +expect_verdict "$TMP/stall.json" "$NOW" "repo-wide-cron-silence" \ + "workflows_with_schedule_events=4" \ + "newest_schedule_event=2026-11-20T23:01:45Z" \ + "newest_schedule_workflow=repo-sweeper" \ + "days_since_last_schedule=3.9" \ + "nonschedule_runs_since_last_schedule=1" + +expect_verdict "$TMP/healthy.json" "$NOW" "healthy" \ + "newest_schedule_workflow=agents" + +expect_verdict "$TMP/idle.json" "$NOW" "single-workflow-or-idle" \ + "nonschedule_runs_since_last_schedule=0" + +# Bare-array input shape is accepted. +python3 - "$TMP/stall.json" "$TMP/bare.json" <<'PYEOF' +import json, sys +runs = json.load(open(sys.argv[1]))["workflow_runs"] +json.dump(runs, open(sys.argv[2], "w")) +PYEOF +expect_verdict "$TMP/bare.json" "$NOW" "repo-wide-cron-silence" + +# Strict contract: unknown flags and missing input are usage errors. +if bash "$CHECK" --bogus-flag 2>/dev/null; then + echo "FAIL usage: unknown flag accepted"; fail_count=$((fail_count + 1)) +else + echo "pass usage-unknown-flag" +fi +if bash "$CHECK" --runs-json "$TMP/missing.json" 2>/dev/null; then + echo "FAIL usage: missing file accepted"; fail_count=$((fail_count + 1)) +else + echo "pass usage-missing-file" +fi +if bash "$CHECK" 2>/dev/null; then + echo "FAIL usage: missing --runs-json accepted"; fail_count=$((fail_count + 1)) +else + echo "pass usage-missing-arg" +fi + +if [ "$fail_count" -ne 0 ]; then + echo "$fail_count failure(s)" >&2 + exit 1 +fi +echo "check-fork-schedule-stall: all contract tests pass" diff --git a/doc/2026-11-24T21-07-25Z_report_fork-schedule-stall-14444/escalation.md b/doc/2026-11-24T21-07-25Z_report_fork-schedule-stall-14444/escalation.md new file mode 100644 index 0000000000..44763ef2e9 --- /dev/null +++ b/doc/2026-11-24T21-07-25Z_report_fork-schedule-stall-14444/escalation.md @@ -0,0 +1,66 @@ +# Fork schedule stall: developing-today-forks/opencode agents.yml silent since 2026-11-20 + +Escalation record for developing-today/code#14444 (lane oc-code-05, 2026-11-24). +Slice PR: `.github/scripts/check-fork-schedule-stall.sh` (+ contract test), +which encodes this diagnosis as a repeatable command. + +## Verdict + +Repo-wide GitHub schedule suppression on the fork — not an agents.yml +defect and not caused by the last runs' failures. Escalated as a +platform limit; the workflow file must not be "fixed". + +Owning platform limit: **GitHub Actions schedule policy for fork +repositories** (cron delivery suppressed on forks while every other +event type keeps working). + +## Evidence (re-verified live 2026-11-24 ~21:00Z, `gh api`, lane oc-code-05) + +- `agents` workflow (id 401762792) state is **active**; last scheduled + run 44826053161, 2026-11-20T22:06Z, conclusion **failure** — died in + `Dispatch suggestions` on `pm-dispatch POST /v1/sessions` HTTP 502 + (all four attempts). The 502 is real but unrelated to the stall: + that run *did* fire. +- Zero schedule-event runs repo-wide after 2026-11-20 (last: repo-sweeper + 44833661765, 2026-11-20T23:01Z, success; auto-format 22:49Z success; + models-snapshot 19:35Z success). Per-workflow last-schedule list: + agents 22:06Z failure, repo-sweeper 23:01Z success, auto-format + 22:49Z success, models-snapshot 19:35Z success. +- Non-schedule runs continue the same day (Dependabot `dynamic` runs, + latest 2026-11-24T18:27Z). Actions is on; only cron triggers are + silent, repo-wide, across 8 scheduled workflows. +- Machine-readable (committed classifier on the live 100-run window): + `newest_schedule_event=2026-11-20T23:01:45Z`, + `days_since_last_schedule=3.9`, + `nonschedule_runs_since_last_schedule=25`, + `verdict=repo-wide-cron-silence`. + +Reproduce: `gh api "repos/developing-today-forks/opencode/actions/runs?per_page=100" > runs.json` +then `bash .github/scripts/check-fork-schedule-stall.sh --runs-json runs.json`. + +## Recommendation (re-enable + observe, then move if silent) + +1. An owner/admin re-enables the workflow via the Actions API + (`PUT /repos/developing-today-forks/opencode/actions/workflows/401762792/enable`) + and watches the next two cron slots (00:00 / 15:00 UTC). A manual + `workflow_dispatch` proves the workflow executes but does not prove + cron is back. +2. If crons stay silent after re-enable, the schedule moves off the + fork (e.g. onto developing-today/code's pm-scheduled surface, which + is where the slot table already mirrors from). + +## Effect on parked task 20778 + +It cannot resume/revalidate until a *scheduled* (not manual) agents run +succeeds, so it stays parked on this platform blocker. Separately, the +Nov 18–20 failures show the pm-dispatch 502 (code#6992) must be gone or +the resumed run will fire and fail in `Dispatch suggestions`. + +## Issue acceptance state after this slice + +- [x] Reason identified with evidence (this record + classifier + live run list). +- [ ] Scheduled runs resume, or blocker escalated with the owning + platform limit named — escalation half done here (limit named + above and on the issue); resume awaits re-enable + observe. +- [ ] Finding recorded on the issue including 20778 effect — the PR's + progress note carries it; the checkbox closes when the note lands.