scheduler-canary: assertion 2 false-alarms UNGATED once the ci task pages past actions/tasks limit=50 (+ fixture slugs post to the live channel) #109

Closed
opened 2026-08-28 15:55:20 +00:00 by ben · 2 comments
Owner

Symptom

2026-08-28, Mattermost, four posts (11:22Z, 11:30Z, 13:22Z, 13:45Z):

scheduler-canary: Matou/dev-factory UNGATED — head 1fc29e0a37 on main is 166m old with NO claimed ci task (a waiting run is not a claimed one — the #880 trap).

False alarm. Head 1fc29e0a's ci task DID run and passed: task 29393 (test, ci.yml, success, 2026-08-28T08:36:04Z).

Cause

Assertion 2 (claimed-head-sha) fetches actions/tasks?limit=50&page=1 and looks for a task with head_sha == main and workflow_id == ci.yml. dev-factory churns ~10 tasks per 15 min on the same head (resume-asks.yml every ~7 min + swarm.yml + triage.yml + healer.yml; 119 tasks on 1fc29e0a by 15:00Z). Within ~3 h the ci task falls off page 1. The canary then sees tasks for the head but none named ci → UNGATED. It re-fires every CANARY_REPOST_MIN, and the "recovered"/re-alarm pairs are the debounce cycling on a page whose contents shift between ticks.

idss hits the same wall on any long-lived head, just slower.

Second, smaller hazard seen the same morning: four scheduler-canary: x/y API UNREACHABLE posts at 08:35Z. x/y is the test-fixture slug; some test-mode invocation ran with the real MATTERMOST_* env (a session-runner sourcing host-env.sh, working idss #932 at that time) and posted its self-alarm to the live channel. tests/scheduler-canary-test.sh strips the env, the caller was something else — not pinned.

Rule / fix

  1. Assertion 2 must not depend on the ci task surviving page 1. Options, cheapest first:
    • filter server-side: actions/runs?event=push&status=success&limit=… (or actions/tasks with a workflow filter if the API exposes one) and match head_sha;
    • or page actions/tasks until a task older than the head's commit time is seen.
      Pick one; add a test where 60+ non-ci tasks sit on the head in front of the ci task.
  2. notify-mattermost.sh (or the canary) refuses to post when the slug is a fixture (x/y, Matou/idss behind http://x, http://fake…) — i.e. when FORGEJO_API does not start with https://git.matou.nz/. Fixture invocations must land in "would-have-sent" output only, whatever the host env carries.

Evidence: Mattermost posts as above; /tmp/scheduler-canary/Matou-dev-factory-ungated on matou-workstation. Ruled from idss session 2026-08-28; the canary is factory-owned (#105/#107), so the fix lands here and reaches consumers via FACTORY_REF.

## Symptom 2026-08-28, Mattermost, four posts (11:22Z, 11:30Z, 13:22Z, 13:45Z): > scheduler-canary: Matou/dev-factory UNGATED — head 1fc29e0a3783 on main is 166m old with NO claimed ci task (a waiting run is not a claimed one — the #880 trap). **False alarm.** Head `1fc29e0a`'s ci task DID run and passed: task 29393 (`test`, `ci.yml`, success, 2026-08-28T08:36:04Z). ## Cause Assertion 2 (claimed-head-sha) fetches `actions/tasks?limit=50&page=1` and looks for a task with `head_sha == main` **and** `workflow_id == ci.yml`. dev-factory churns ~10 tasks per 15 min on the *same* head (`resume-asks.yml` every ~7 min + `swarm.yml` + `triage.yml` + `healer.yml`; 119 tasks on `1fc29e0a` by 15:00Z). Within ~3 h the ci task falls off page 1. The canary then sees tasks for the head but none named ci → UNGATED. It re-fires every `CANARY_REPOST_MIN`, and the "recovered"/re-alarm pairs are the debounce cycling on a page whose contents shift between ticks. idss hits the same wall on any long-lived head, just slower. Second, smaller hazard seen the same morning: four `scheduler-canary: x/y API UNREACHABLE` posts at 08:35Z. `x/y` is the test-fixture slug; some test-mode invocation ran with the real `MATTERMOST_*` env (a session-runner sourcing host-env.sh, working idss #932 at that time) and posted its self-alarm to the live channel. `tests/scheduler-canary-test.sh` strips the env, the caller was something else — not pinned. ## Rule / fix 1. Assertion 2 must not depend on the ci task surviving page 1. Options, cheapest first: - filter server-side: `actions/runs?event=push&status=success&limit=…` (or `actions/tasks` with a workflow filter if the API exposes one) and match `head_sha`; - or page `actions/tasks` until a task older than the head's commit time is seen. Pick one; add a test where 60+ non-ci tasks sit on the head in front of the ci task. 2. `notify-mattermost.sh` (or the canary) refuses to post when the slug is a fixture (`x/y`, `Matou/idss` behind `http://x`, `http://fake`…) — i.e. when `FORGEJO_API` does not start with `https://git.matou.nz/`. Fixture invocations must land in "would-have-sent" output only, whatever the host env carries. Evidence: Mattermost posts as above; `/tmp/scheduler-canary/Matou-dev-factory-ungated` on matou-workstation. Ruled from idss session 2026-08-28; the canary is factory-owned (#105/#107), so the fix lands here and reaches consumers via FACTORY_REF.
Author
Owner

Claimed by an interactive session (Ben + Claude) — swapped ready-for-agent → agent-working so the swarm skips it.

Claimed by an interactive session (Ben + Claude) — swapped ready-for-agent → agent-working so the swarm skips it.
Author
Owner

Landed in a39a709 on main.

  1. Assertion 2 now reads the head's OWN runs: actions/runs?head_sha=<sha>&limit=50&page=N — verified live that the forge honours the filter (105 hits for 1fc29e0a, 0 for a bogus sha) and that the ci run sits on the LAST page (page 3 of 3, 1.2s). Page 1 → total_count, then the last page, then a bounded 10-page walk; claimed = a ci.yml run whose status has left waiting (#880 trap kept). actions-endpoint-test exempts head_sha= alongside status=waiting.
  2. notify-mattermost.sh refuses to post when FORGEJO_API is set and not https:// (every fixture is http://x/http://fake/http://fj.test) — prints would-have-sent instead. No host name baked into the harness. Override NOTIFY_ALLOW_PLAIN_HTTP_FORGE=1 for a plain-http forge / shimmed tests.

Proof: tests/scheduler-canary-test.sh 14 scenarios incl. d3 (60 non-ci runs ahead of ci → silent, last page read, tasks view untouched) and d4 (waiting-only ci → UNGATED); tests/notify-test.sh 7 checks; full offline suite green. GOTCHAS 37. Reaches matou-workstation's tick at the next re-vendor + FACTORY_REF bump — until then the false alarms continue.

Landed in `a39a709` on main. 1. Assertion 2 now reads the head's OWN runs: `actions/runs?head_sha=<sha>&limit=50&page=N` — verified live that the forge honours the filter (105 hits for `1fc29e0a`, 0 for a bogus sha) and that the ci run sits on the LAST page (page 3 of 3, 1.2s). Page 1 → total_count, then the last page, then a bounded 10-page walk; claimed = a `ci.yml` run whose status has left `waiting` (#880 trap kept). `actions-endpoint-test` exempts `head_sha=` alongside `status=waiting`. 2. `notify-mattermost.sh` refuses to post when `FORGEJO_API` is set and not `https://` (every fixture is `http://x`/`http://fake`/`http://fj.test`) — prints would-have-sent instead. No host name baked into the harness. Override `NOTIFY_ALLOW_PLAIN_HTTP_FORGE=1` for a plain-http forge / shimmed tests. Proof: `tests/scheduler-canary-test.sh` 14 scenarios incl. d3 (60 non-ci runs ahead of ci → silent, last page read, tasks view untouched) and d4 (waiting-only ci → UNGATED); `tests/notify-test.sh` 7 checks; full offline suite green. GOTCHAS 37. Reaches matou-workstation's tick at the next re-vendor + FACTORY_REF bump — until then the false alarms continue.
ben 2026-08-28 18:34:08 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Matou/dev-factory#109
No description provided.