scheduler-canary: first live tick — false UNGATED (tasks are named by JOB, not workflow), alarms dropped (tick has no host env), 3/4 repos error on a missing vendored copy #107

Closed
opened 2026-08-27 15:32:47 +00:00 by ben · 2 comments
Owner

Found 2026-08-27 15:15–15:50Z checking that the workstation actually picked up #105 after idss #891 vendored it and onboard.sh host-cron install re-rendered factory-cron/backstop-tick.sh (14:19Z). The host IS running the canary every 15 min — and the first real tick exposed three faults. Evidence is from /home/dev/swarm/logs/backstop.log, /tmp/scheduler-canary/, and bash -x runs on the host.

1. Assertion 2 can never see a claimed ci task — tasks are named by JOB, not workflow → false UNGATED on every head ≥ 45 min old

scheduler-canary.sh matches select(.name == "ci" or (.name | test("^ci \\("))) over actions/tasks. But a task's name is the job name: idss's ci.yml task shows as name: "seam", workflow_id: "ci.yml" (display_title: "ci"). So claimed is always 0, and at 15:15:22Z the canary wrote Matou-idss-ungated for head 2f077e23 (47 min old) whose seam task had run to success at 14:50 and was right there in the 50-task window. Every repo will raise UNGATED whenever main sits 45 min without a push.

Fix: match .workflow_id == "ci.yml" (field confirmed present on task objects: created_at, display_title, event, head_branch, head_sha, id, name, run_number, run_started_at, status, updated_at, url, workflow_id). Add a test case with a task named seam / workflow_id: ci.yml that must count as claimed, and one named ci under a different workflow_id that must not.

2. The alarm is dropped silently — the generated tick runs without the host env, so notify-mattermost.sh has no URL/channel/token, and the canary discards its stderr

The crontab line is */15 * * * * [ -e host.off ] || …/backstop-tick.sh >> backstop.log; the rendered tick sources nothing (grep -nE 'host-env|source|^\. ' backstop-tick.sh → empty) — unlike the session-runner lines, which . host-env.sh. MATTERMOST_URL/_CHANNEL_ID/_BOT_TOKEN live only in /home/dev/swarm/host-env.sh (the registry's env directive); notify-mattermost.sh falls back to /run/secrets/mattermost_bot_token only (container path), and needs URL+channel regardless. The canary's notify() { bash notify-mattermost.sh "$1" >/dev/null 2>&1 || true; } throws away the "unset — would have sent:" line. Net: the 15:15 UNGATED post never reached Mattermost (channel checked: no scheduler-canary: post since 15:00Z) and left no trace in the log. FORGEJO_TOKEN only works because the canary reads .sandcastle/secrets/forgejo_token itself.

Fix (either/both): the rendered tick sources the registry's env file before run_repo (it is the host's declared env — host_state_render_backstop already knows the path); and the canary lets notify's stderr through to the tick's log (2>&1 into the [slug canary] prefix) so a would-have-sent is at least visible. Test: the offline canary test asserts the would-have-sent line appears on stdout/stderr when Mattermost env is absent; the host-state-lib test asserts the rendered tick sources the registry env.

3. Three of four repos error every tick — canary() should skip-with-one-line when the vendored file is absent

14:45 [Matou/dev-factory canary] bash: /home/dev/swarm/Matou/dev-factory/.sandcastle/scheduler-canary.sh: No such file or directory — same for matou-app and matou-website, every 15 min. dev-factory is self-hosting (its canary is at the repo ROOT, not .sandcastle/); matou-app (FACTORY_REF 54e8f55) and matou-website (02ff038) predate #105. The tick should test -f and print one canary: not vendored at <ref> — skipping line; dev-factory's own entry should point at its root copy (the self-hosting split, idss GOTCHAS "dev-factory is self-hosting"). matou-app/matou-website need FACTORY_REF bumps to ≥ 8ea613a — their own protected-path tickets.

Also observed (not a fault, for the record)

  • Under an exact cron env (env -i PATH=/usr/bin:/bin HOME=/home/dev) the canary runs clean, exit 0, and the recovered path cleared the stale state file. The 15:30/15:45 ticks had NOT cleared it; the only path that leaves the file untouched is branches/main returning non-200 (branch="" → whole assertion skipped, no clear). Worth a recovered-on-unreadable-head decision, or at least a logged line.
  • Assertion 1 (four filtered waiting queues) is correct and quiet on a healthy queue.

Acceptance

  • AC1 workflow_id-based claimed match + the two new test cases
  • AC2 rendered tick sources the registry env; canary surfaces notify's would-have-sent; tests for both
  • AC3 absent vendored canary = one skip line, not an error; dev-factory's own entry runs its root copy
  • AC4 idss FACTORY_REF bump handoff (protected path) so the host's idss copy carries the fix; note in GOTCHAS 34
Found 2026-08-27 15:15–15:50Z checking that the workstation actually picked up #105 after idss #891 vendored it and `onboard.sh host-cron install` re-rendered `factory-cron/backstop-tick.sh` (14:19Z). The host IS running the canary every 15 min — and the first real tick exposed three faults. Evidence is from `/home/dev/swarm/logs/backstop.log`, `/tmp/scheduler-canary/`, and `bash -x` runs on the host. ## 1. Assertion 2 can never see a claimed `ci` task — tasks are named by JOB, not workflow → false UNGATED on every head ≥ 45 min old `scheduler-canary.sh` matches `select(.name == "ci" or (.name | test("^ci \\(")))` over `actions/tasks`. But a task's `name` is the **job** name: idss's `ci.yml` task shows as `name: "seam"`, `workflow_id: "ci.yml"` (`display_title: "ci"`). So `claimed` is always 0, and at 15:15:22Z the canary wrote `Matou-idss-ungated` for head `2f077e23` (47 min old) whose `seam` task had run to **success at 14:50** and was right there in the 50-task window. Every repo will raise UNGATED whenever `main` sits 45 min without a push. **Fix:** match `.workflow_id == "ci.yml"` (field confirmed present on task objects: `created_at, display_title, event, head_branch, head_sha, id, name, run_number, run_started_at, status, updated_at, url, workflow_id`). Add a test case with a task named `seam` / `workflow_id: ci.yml` that must count as claimed, and one named `ci` under a different `workflow_id` that must not. ## 2. The alarm is dropped silently — the generated tick runs without the host env, so `notify-mattermost.sh` has no URL/channel/token, and the canary discards its stderr The crontab line is `*/15 * * * * [ -e host.off ] || …/backstop-tick.sh >> backstop.log`; the rendered tick sources nothing (`grep -nE 'host-env|source|^\. ' backstop-tick.sh` → empty) — unlike the session-runner lines, which `. host-env.sh`. `MATTERMOST_URL`/`_CHANNEL_ID`/`_BOT_TOKEN` live only in `/home/dev/swarm/host-env.sh` (the registry's `env` directive); `notify-mattermost.sh` falls back to `/run/secrets/mattermost_bot_token` only (container path), and needs URL+channel regardless. The canary's `notify() { bash notify-mattermost.sh "$1" >/dev/null 2>&1 || true; }` throws away the "unset — would have sent:" line. Net: the 15:15 UNGATED post never reached Mattermost (channel checked: no `scheduler-canary:` post since 15:00Z) and left no trace in the log. `FORGEJO_TOKEN` only works because the canary reads `.sandcastle/secrets/forgejo_token` itself. **Fix (either/both):** the rendered tick sources the registry's `env` file before `run_repo` (it is the host's declared env — `host_state_render_backstop` already knows the path); and the canary lets notify's stderr through to the tick's log (`2>&1` into the `[slug canary]` prefix) so a would-have-sent is at least visible. Test: the offline canary test asserts the would-have-sent line appears on stdout/stderr when Mattermost env is absent; the host-state-lib test asserts the rendered tick sources the registry env. ## 3. Three of four repos error every tick — `canary()` should skip-with-one-line when the vendored file is absent `14:45 [Matou/dev-factory canary] bash: /home/dev/swarm/Matou/dev-factory/.sandcastle/scheduler-canary.sh: No such file or directory` — same for matou-app and matou-website, every 15 min. dev-factory is self-hosting (its canary is at the repo ROOT, not `.sandcastle/`); matou-app (FACTORY_REF `54e8f55`) and matou-website (`02ff038`) predate #105. The tick should test `-f` and print one `canary: not vendored at <ref> — skipping` line; dev-factory's own entry should point at its root copy (the self-hosting split, idss GOTCHAS "dev-factory is self-hosting"). matou-app/matou-website need FACTORY_REF bumps to ≥ `8ea613a` — their own protected-path tickets. ## Also observed (not a fault, for the record) - Under an exact cron env (`env -i PATH=/usr/bin:/bin HOME=/home/dev`) the canary runs clean, exit 0, and the `recovered` path cleared the stale state file. The 15:30/15:45 ticks had NOT cleared it; the only path that leaves the file untouched is `branches/main` returning non-200 (`branch=""` → whole assertion skipped, no clear). Worth a `recovered`-on-unreadable-head decision, or at least a logged line. - Assertion 1 (four filtered `waiting` queues) is correct and quiet on a healthy queue. ## Acceptance - [ ] AC1 workflow_id-based claimed match + the two new test cases - [ ] AC2 rendered tick sources the registry env; canary surfaces notify's would-have-sent; tests for both - [ ] AC3 absent vendored canary = one skip line, not an error; dev-factory's own entry runs its root copy - [ ] AC4 idss FACTORY_REF bump handoff (protected path) so the host's idss copy carries the fix; note in GOTCHAS 34

swarm-claim host=elitebook-distributed-server-03 run=2869
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=elitebook-distributed-server-03 run=2869 (automated multi-host claim — lowest live claim id works this ticket)

close-report for #107 — status success

✅ close-report gates passed — every claim verified against main; issue closed.

envelope
{
  "issue": 107,
  "status": "success",
  "commits": [
    "cec8b3c"
  ],
  "changed_files": [
    "STATUS.md",
    "docs/GOTCHAS.md",
    "onboarding/host-state-lib.sh",
    "onboarding/tests/host-state-lib-test.sh",
    "scheduler-canary.sh",
    "tests/scheduler-canary-test.sh"
  ],
  "tests": [
    {
      "command": "bash tests/scheduler-canary-test.sh",
      "exit_code": 0
    },
    {
      "command": "bash onboarding/tests/host-state-lib-test.sh",
      "exit_code": 0
    },
    {
      "command": "for t in tests/*.sh onboarding/tests/*.sh; do case \"$t\" in *fakebin*|*fixtures*) continue;; esac; bash \"$t\" || echo FAIL; done",
      "exit_code": 0
    }
  ],
  "criteria": {
    "AC1 workflow_id-based claimed match + the two new test cases": "scheduler-canary.sh assertion 2 now matches `select((.workflow_id // \"\") == \"ci.yml\")` instead of `.name`; tests/scheduler-canary-test.sh case (d) uses a task named 'seam' with workflow_id ci.yml that MUST count as claimed (silent), and new case (d2) a task named 'ci' under workflow_id release.yml that must NOT count (posts UNGATED). Both green in the 12-scenario run.",
    "AC2 rendered tick sources the registry env; canary surfaces notify's would-have-sent; tests for both": "onboarding/host-state-lib.sh host_state_render_backstop now emits `[ -f <envfile> ] && . <envfile>` from the registry `env` directive before run_repo; scheduler-canary.sh notify() drops the `2>&1` so notify-mattermost.sh's would-have-sent stderr reaches the tick's [slug canary] prefix. Tests: host-state-lib-test.sh asserts the tick sources the host env (and omits it when no env directive); scheduler-canary-test.sh (nochat) asserts the would-have-sent line surfaces when MATTERMOST_* is stripped.",
    "AC3 absent vendored canary = one skip line, not an error; dev-factory's own entry runs its root copy": "onboarding/host-state-lib.sh canary() prefers $1/.sandcastle/scheduler-canary.sh, falls back to $1/scheduler-canary.sh (self-hosting dev-factory root copy), and prints one `canary: not vendored at <dir> — skipping` line when neither exists. host-state-lib-test.sh runs a rendered tick over vendored/selfhost/absent repos and asserts each path (vendored-copy runs, selfhost-root runs, absent skips with one line and no 'No such file', all repos still dispatch).",
    "AC4 idss FACTORY_REF bump handoff (protected path) so the host's idss copy carries the fix; note in GOTCHAS 34": "Filed idss #909 (labels priority, ready-for-session) requesting the FACTORY_REF bump to dev-factory main >= cec8b3c and a host-cron re-render (precedent idss #891). docs/GOTCHAS.md #34 extended with the 'First live tick (#107)' paragraph documenting all three faults and the re-vendor lag; STATUS.md header + milestone log updated."
  },
  "summary": "Fixed the scheduler canary's first-live-tick faults — claimed match by workflow_id, host-env sourced by the generated tick, unvendored-copy skip with root fallback — with offline tests, GOTCHAS 34, and the idss FACTORY_REF handoff (#909).",
  "blockers": []
}
**close-report** for #107 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 107, "status": "success", "commits": [ "cec8b3c" ], "changed_files": [ "STATUS.md", "docs/GOTCHAS.md", "onboarding/host-state-lib.sh", "onboarding/tests/host-state-lib-test.sh", "scheduler-canary.sh", "tests/scheduler-canary-test.sh" ], "tests": [ { "command": "bash tests/scheduler-canary-test.sh", "exit_code": 0 }, { "command": "bash onboarding/tests/host-state-lib-test.sh", "exit_code": 0 }, { "command": "for t in tests/*.sh onboarding/tests/*.sh; do case \"$t\" in *fakebin*|*fixtures*) continue;; esac; bash \"$t\" || echo FAIL; done", "exit_code": 0 } ], "criteria": { "AC1 workflow_id-based claimed match + the two new test cases": "scheduler-canary.sh assertion 2 now matches `select((.workflow_id // \"\") == \"ci.yml\")` instead of `.name`; tests/scheduler-canary-test.sh case (d) uses a task named 'seam' with workflow_id ci.yml that MUST count as claimed (silent), and new case (d2) a task named 'ci' under workflow_id release.yml that must NOT count (posts UNGATED). Both green in the 12-scenario run.", "AC2 rendered tick sources the registry env; canary surfaces notify's would-have-sent; tests for both": "onboarding/host-state-lib.sh host_state_render_backstop now emits `[ -f <envfile> ] && . <envfile>` from the registry `env` directive before run_repo; scheduler-canary.sh notify() drops the `2>&1` so notify-mattermost.sh's would-have-sent stderr reaches the tick's [slug canary] prefix. Tests: host-state-lib-test.sh asserts the tick sources the host env (and omits it when no env directive); scheduler-canary-test.sh (nochat) asserts the would-have-sent line surfaces when MATTERMOST_* is stripped.", "AC3 absent vendored canary = one skip line, not an error; dev-factory's own entry runs its root copy": "onboarding/host-state-lib.sh canary() prefers $1/.sandcastle/scheduler-canary.sh, falls back to $1/scheduler-canary.sh (self-hosting dev-factory root copy), and prints one `canary: not vendored at <dir> — skipping` line when neither exists. host-state-lib-test.sh runs a rendered tick over vendored/selfhost/absent repos and asserts each path (vendored-copy runs, selfhost-root runs, absent skips with one line and no 'No such file', all repos still dispatch).", "AC4 idss FACTORY_REF bump handoff (protected path) so the host's idss copy carries the fix; note in GOTCHAS 34": "Filed idss #909 (labels priority, ready-for-session) requesting the FACTORY_REF bump to dev-factory main >= cec8b3c and a host-cron re-render (precedent idss #891). docs/GOTCHAS.md #34 extended with the 'First live tick (#107)' paragraph documenting all three faults and the re-vendor lag; STATUS.md header + milestone log updated." }, "summary": "Fixed the scheduler canary's first-live-tick faults — claimed match by workflow_id, host-env sourced by the generated tick, unvendored-copy skip with root fallback — with offline tests, GOTCHAS 34, and the idss FACTORY_REF handoff (#909).", "blockers": [] } ``` </details>
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
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#107
No description provided.