schedule-backstop: resume-asks.yml's in-flight guard never matches (the job is named resume) — every tick dispatches, 3x the designed cadence in every repo #190

Closed
opened 2026-10-09 20:13:36 +00:00 by matou-build-agent · 3 comments

Filed by the swarm healer (Matou/idss watchdog pass of 2026-10-09 20:02 UTC, signature e2c0a0a76977, heal run heal-Matou-idss-1791576177-380893). Found while diagnosing Matou/idss#2044; not the cause of that incident — an aggravating factor that triples the exposure.

Symptom

schedule-backstop.sh resume-asks.yml 40 dispatches on every tick, however
recently resume-asks ran. On Matou/idss today that is ~4 extra dispatches an
hour on top of the workflow's own :10,:40 cron — 6 runs/hour against the 2 the
cadence is designed for, in every repo whose registry carries
backstop ... resume-asks.yml:40 (currently all six on matou-workstation).

Observed dispatch starts, Matou/idss 2026-10-09 (workflow_dispatch events
interleaved with the schedule ones at :10/:40): 09:46, 10:01, 10:16,
10:31, 10:46, 11:01, 11:17, 11:31, 11:46, 12:01, 12:17, 12:31, 12:46, 13:01, …
— i.e. one per tick, inside a declared 40-minute window.

Cause

name="${wf%.yml}" maps the workflow FILE to the JOB name the
actions/tasks listing reports. The listing reports the job name, and
resume-asks.yml's job is called resume:

# .forgejo/workflows/resume-asks.yml
jobs:
  resume:            # <- the name the API returns
    runs-on: swarm

So the in-flight/recent guard looks for resume-asks (or resume-asks (N) /
resume-asks (<host>)) and never matches a real run. healer.yml already
carries exactly this special case one line below
([ "$name" = "healer" ] && name="watchdog"); resume-asks → resume is
missing. triage and swarm are unaffected (triage matches bare, swarm (<host>) matches the suffix clause).

Reproduced against the live endpoint from matou-workstation, 2026-10-09 20:12 UTC,
with the guard's own jq lifted verbatim out of the script (cutoff = −40 min,
HOST_NAME=matou-workstation):

cutoff=2026-10-09T19:32:45Z
resume-asks  inflight=0      <- what the script computes -> dispatches
resume       inflight=5      <- what it should see
triage       inflight=2

…while the payload's four newest resume-asks.yml rows were
resume running 20:10:52, resume failure 20:01:16, resume failure 19:55:58,
resume success 19:46:58.

This is the same job-vs-workflow-name drift as #107 (scheduler-canary) and the
.name/.workflow_id note in heal-lib.sh's watchdog_detect; the backstop's
own header comment warns about it for the healer and for matrix suffixes.

Why it matters

  1. Load. Each sweep walks every ready-for-human issue and calls
    post-issue-ask.sh on it — 48 issues ≈ 280 s and a few hundred
    Forgejo/Mattermost round-trips on Matou/idss alone, 3× more often than
    intended, across six repos.
  2. Noise, today. With one pool host wedged (Matou/idss#2044 —
    bens-mac-04 cannot resolve git.matou.nz), ~1 in 3 of those runs reds.
    Tripling the run count tripled the red count, which is what pushed
    resume-asks over watchdog_detect's streak threshold and bought a fifth
    full Opus heal investigation for one host fault (Matou/idss#2045).
  3. The backstop is explicitly designed to be a no-op while the real scheduler
    works. Here the real scheduler is firing :10/:40 and the backstop
    still piles on.

Suggested fix

Extend the job-name mapping beside the healer case, e.g.

name="${wf%.yml}"
[ "$name" = "healer" ] && name="watchdog"
[ "$name" = "resume-asks" ] && name="resume"

…and (sturdier) cover the general case by also matching
.workflow_id == $wf, which is on every row and cannot drift with a job
rename — the same reasoning watchdog_detect records for its own
self-exclusion. .sandcastle/tests/ has no backstop case for a workflow whose
job name differs from its file name; one would pin this.

Canonical home is this repo (ADR 0180) — Matou/idss's vendored copy is
byte-identical apart from the per-HOST clause, so it needs a re-vendor + a
FACTORY_REF bump after the fix, not a direct edit.

> *Filed by the swarm healer (`Matou/idss` watchdog pass of 2026-10-09 20:02 UTC, signature `e2c0a0a76977`, heal run `heal-Matou-idss-1791576177-380893`). Found while diagnosing `Matou/idss`#2044; **not** the cause of that incident — an aggravating factor that triples the exposure.* ## Symptom `schedule-backstop.sh resume-asks.yml 40` dispatches on **every tick**, however recently `resume-asks` ran. On `Matou/idss` today that is ~4 extra dispatches an hour on top of the workflow's own `:10,:40` cron — 6 runs/hour against the 2 the cadence is designed for, in every repo whose registry carries `backstop ... resume-asks.yml:40` (currently all six on `matou-workstation`). Observed dispatch starts, `Matou/idss` 2026-10-09 (`workflow_dispatch` events interleaved with the `schedule` ones at `:10`/`:40`): 09:46, 10:01, 10:16, 10:31, 10:46, 11:01, 11:17, 11:31, 11:46, 12:01, 12:17, 12:31, 12:46, 13:01, … — i.e. one per tick, inside a declared 40-minute window. ## Cause `name="${wf%.yml}"` maps the workflow FILE to the JOB name the `actions/tasks` listing reports. The listing reports the **job** name, and `resume-asks.yml`'s job is called `resume`: ```yaml # .forgejo/workflows/resume-asks.yml jobs: resume: # <- the name the API returns runs-on: swarm ``` So the in-flight/recent guard looks for `resume-asks` (or `resume-asks (N)` / `resume-asks (<host>)`) and never matches a real run. `healer.yml` already carries exactly this special case one line below (`[ "$name" = "healer" ] && name="watchdog"`); `resume-asks` → `resume` is missing. `triage` and `swarm` are unaffected (`triage` matches bare, `swarm (<host>)` matches the suffix clause). Reproduced against the live endpoint from `matou-workstation`, 2026-10-09 20:12 UTC, with the guard's own jq lifted verbatim out of the script (`cutoff` = −40 min, `HOST_NAME=matou-workstation`): ``` cutoff=2026-10-09T19:32:45Z resume-asks inflight=0 <- what the script computes -> dispatches resume inflight=5 <- what it should see triage inflight=2 ``` …while the payload's four newest `resume-asks.yml` rows were `resume running 20:10:52`, `resume failure 20:01:16`, `resume failure 19:55:58`, `resume success 19:46:58`. This is the same job-vs-workflow-name drift as #107 (scheduler-canary) and the `.name`/`.workflow_id` note in `heal-lib.sh`'s `watchdog_detect`; the backstop's own header comment warns about it for the healer and for matrix suffixes. ## Why it matters 1. **Load.** Each sweep walks every `ready-for-human` issue and calls `post-issue-ask.sh` on it — 48 issues ≈ 280 s and a few hundred Forgejo/Mattermost round-trips on `Matou/idss` alone, 3× more often than intended, across six repos. 2. **Noise, today.** With one pool host wedged (`Matou/idss`#2044 — `bens-mac-04` cannot resolve `git.matou.nz`), ~1 in 3 of those runs reds. Tripling the run count tripled the red count, which is what pushed `resume-asks` over `watchdog_detect`'s `streak` threshold and bought a fifth full Opus heal investigation for one host fault (`Matou/idss`#2045). 3. The backstop is explicitly designed to be a no-op while the real scheduler works. Here the real scheduler **is** firing `:10`/`:40` and the backstop still piles on. ## Suggested fix Extend the job-name mapping beside the healer case, e.g. ```sh name="${wf%.yml}" [ "$name" = "healer" ] && name="watchdog" [ "$name" = "resume-asks" ] && name="resume" ``` …and (sturdier) cover the general case by also matching `.workflow_id == $wf`, which is on every row and cannot drift with a job rename — the same reasoning `watchdog_detect` records for its own self-exclusion. `.sandcastle/tests/` has no backstop case for a workflow whose job name differs from its file name; one would pin this. Canonical home is this repo (ADR 0180) — `Matou/idss`'s vendored copy is byte-identical apart from the per-HOST clause, so it needs a re-vendor + a `FACTORY_REF` bump after the fix, not a direct edit.
Author
Member

This was generated by AI during triage.

Agent Brief

Category: bug
Summary: schedule-backstop.sh's in-flight guard never matches resume-asks' runs because it searches by the workflow FILE name while Forgejo's task listing reports the JOB name (resume) — so the backstop dispatches on every tick instead of staying a no-op.

Verification (confirmed against the code at triage, 2026-10-09):

  • schedule-backstop.sh derives the run name it searches for from the workflow file (name="${wf%.yml}") and carries exactly one job-vs-file special case: healer → watchdog. There is no resume-asks → resume case.
  • .forgejo/workflows/resume-asks.yml names its job resume.
  • The in-flight/recent guard then counts only runs whose .name is resume-asks (or the matrix/host-suffixed variants resume-asks (N) / resume-asks (<host>)). A real run reports .name == "resume", so the count is always 0 and the dispatch branch always fires.
  • tests/schedule-backstop-test.sh only ever drives the swarm.yml workflow (whose job name equals its file stem), so no existing case exercises a workflow whose job name differs from its file name. The reporter's "no backstop case for a job-name/file-name mismatch" claim holds.

This is the same job-vs-workflow-name drift already handled for healer/watchdog and called out in heal-lib.sh's watchdog_detect and the backstop's own header comment.

Current behavior:
For a workflow whose job name differs from its file stem (resume-asks.yml → job resume), the backstop's redundancy check matches nothing, so schedule-backstop.sh resume-asks.yml <window> dispatches on every tick even while the workflow's own :10/:40 cron is firing — ~3x the designed cadence, in every repo whose registry carries a resume-asks.yml backstop.

Desired behavior:
The backstop treats a run as in-flight/recent whenever it belongs to the workflow being backstopped, regardless of any divergence between the workflow's file name and its reported job name. For resume-asks.yml, an actual resume run (waiting, running, or started within the window — including matrix/host-suffixed variants) suppresses the dispatch, exactly as a swarm run does today.

Key interfaces / approach (agent chooses):

  • The name-mapping block that currently reads name="${wf%.yml}"; [ "$name" = "healer" ] && name="watchdog". The minimal fix adds [ "$name" = "resume-asks" ] && name="resume".
  • Preferred (drift-proof): also match on the run's .workflow_id/file identity (every row carries it and it cannot drift under a job rename) in addition to the job-name match — the same self-exclusion reasoning watchdog_detect records. This removes the per-workflow special-case treadmill rather than extending it. The agent decides whether to keep the explicit resume-asks→resume line as a belt-and-braces alongside the .workflow_id match, or rely on the latter alone — either is acceptable if the acceptance criteria pass. (Two-way door: the choice is revertible and pinned by the new test; see the ADR 0174 note below.)

Acceptance criteria:

  • A new case in tests/schedule-backstop-test.sh drives a workflow whose reported job name differs from its file stem (e.g. resume-asks.yml with a resume run) and asserts that a waiting/running/recently-started run of that job SUPPRESSES the dispatch. This case FAILS against the current code and PASSES after the fix.
  • A matching case asserts the backstop still DISPATCHES for that workflow when there is genuinely no in-flight/recent resume run (the no-op-when-scheduler-silent property is preserved).
  • The existing swarm / healer / matrix-suffix / per-host cases continue to pass unchanged.
  • The offline test suite is green: for t in tests/*.sh onboarding/tests/*.sh; do case "$t" in *fakebin*|*fixtures*) continue;; esac; bash "$t" || echo "FAIL: $t"; done
  • STATUS.md is updated in the same commit (header line + affected item) — this changes scheduler behavior.

Out of scope:

  • The .sandcastle/ vendored self-copy and Matou/idss's vendored copy: both pick up the fix only when a human bumps FACTORY_REF (pull-only topology, ADR 0001). Do not edit .sandcastle/.
  • The underlying Matou/idss#2044 host-resolution incident this was found alongside — this ticket is only the backstop's over-dispatch (an aggravating factor, not that cause).
  • Any change to the :10/:40 cron cadence or the backstop's window arithmetic.

Ruled by agent under ADR 0174 — veto anytime.

Ruling: ready-for-agent. Why a two-way door: this is a one-file behavioral bug fix in a root harness file (schedule-backstop.sh) plus its offline test; it touches neither a prompt skeleton nor .sandcastle//.forgejo/ (this repo's protected paths), so a swarm worker may land it. It is fully revertible by a later commit and the narrow-vs-general fix choice is pinned by the new test case — none of the one-way-door conditions (personal credentials, security widening, member-facing trust accept, data destruction, non-routine spend) apply. What proves it: the new tests/schedule-backstop-test.sh case, which fails before the fix and passes after, plus the full offline suite staying green.

> *This was generated by AI during triage.* ## Agent Brief **Category:** bug **Summary:** `schedule-backstop.sh`'s in-flight guard never matches `resume-asks`' runs because it searches by the workflow FILE name while Forgejo's task listing reports the JOB name (`resume`) — so the backstop dispatches on every tick instead of staying a no-op. **Verification (confirmed against the code at triage, 2026-10-09):** - `schedule-backstop.sh` derives the run name it searches for from the workflow file (`name="${wf%.yml}"`) and carries exactly one job-vs-file special case: `healer` → `watchdog`. There is no `resume-asks` → `resume` case. - `.forgejo/workflows/resume-asks.yml` names its job `resume`. - The in-flight/recent guard then counts only runs whose `.name` is `resume-asks` (or the matrix/host-suffixed variants `resume-asks (N)` / `resume-asks (<host>)`). A real run reports `.name == "resume"`, so the count is always 0 and the dispatch branch always fires. - `tests/schedule-backstop-test.sh` only ever drives the `swarm.yml` workflow (whose job name equals its file stem), so no existing case exercises a workflow whose job name differs from its file name. The reporter's "no backstop case for a job-name/file-name mismatch" claim holds. This is the same job-vs-workflow-name drift already handled for `healer`/`watchdog` and called out in `heal-lib.sh`'s `watchdog_detect` and the backstop's own header comment. **Current behavior:** For a workflow whose job name differs from its file stem (`resume-asks.yml` → job `resume`), the backstop's redundancy check matches nothing, so `schedule-backstop.sh resume-asks.yml <window>` dispatches on every tick even while the workflow's own `:10`/`:40` cron is firing — ~3x the designed cadence, in every repo whose registry carries a `resume-asks.yml` backstop. **Desired behavior:** The backstop treats a run as in-flight/recent whenever it belongs to the workflow being backstopped, regardless of any divergence between the workflow's file name and its reported job name. For `resume-asks.yml`, an actual `resume` run (waiting, running, or started within the window — including matrix/host-suffixed variants) suppresses the dispatch, exactly as a `swarm` run does today. **Key interfaces / approach (agent chooses):** - The name-mapping block that currently reads `name="${wf%.yml}"; [ "$name" = "healer" ] && name="watchdog"`. The minimal fix adds `[ "$name" = "resume-asks" ] && name="resume"`. - **Preferred (drift-proof):** also match on the run's `.workflow_id`/file identity (every row carries it and it cannot drift under a job rename) in addition to the job-name match — the same self-exclusion reasoning `watchdog_detect` records. This removes the per-workflow special-case treadmill rather than extending it. The agent decides whether to keep the explicit `resume-asks`→`resume` line as a belt-and-braces alongside the `.workflow_id` match, or rely on the latter alone — either is acceptable if the acceptance criteria pass. (Two-way door: the choice is revertible and pinned by the new test; see the ADR 0174 note below.) **Acceptance criteria:** - [ ] A new case in `tests/schedule-backstop-test.sh` drives a workflow whose reported job name differs from its file stem (e.g. `resume-asks.yml` with a `resume` run) and asserts that a waiting/running/recently-started run of that job SUPPRESSES the dispatch. This case FAILS against the current code and PASSES after the fix. - [ ] A matching case asserts the backstop still DISPATCHES for that workflow when there is genuinely no in-flight/recent `resume` run (the no-op-when-scheduler-silent property is preserved). - [ ] The existing `swarm` / healer / matrix-suffix / per-host cases continue to pass unchanged. - [ ] The offline test suite is green: `for t in tests/*.sh onboarding/tests/*.sh; do case "$t" in *fakebin*|*fixtures*) continue;; esac; bash "$t" || echo "FAIL: $t"; done` - [ ] `STATUS.md` is updated in the same commit (header line + affected item) — this changes scheduler behavior. **Out of scope:** - The `.sandcastle/` vendored self-copy and `Matou/idss`'s vendored copy: both pick up the fix only when a human bumps `FACTORY_REF` (pull-only topology, ADR 0001). Do not edit `.sandcastle/`. - The underlying `Matou/idss`#2044 host-resolution incident this was found alongside — this ticket is only the backstop's over-dispatch (an aggravating factor, not that cause). - Any change to the `:10`/`:40` cron cadence or the backstop's window arithmetic. --- **Ruled by agent under ADR 0174 — veto anytime.** **Ruling:** `ready-for-agent`. **Why a two-way door:** this is a one-file behavioral bug fix in a root harness file (`schedule-backstop.sh`) plus its offline test; it touches neither a prompt skeleton nor `.sandcastle/`/`.forgejo/` (this repo's protected paths), so a swarm worker may land it. It is fully revertible by a later commit and the narrow-vs-general fix choice is pinned by the new test case — none of the one-way-door conditions (personal credentials, security widening, member-facing trust accept, data destruction, non-routine spend) apply. **What proves it:** the new `tests/schedule-backstop-test.sh` case, which fails before the fix and passes after, plus the full offline suite staying green.
Author
Member

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

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

close-report for #190 — status success

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

envelope
{
  "issue": 190,
  "status": "success",
  "commits": [
    "1ab59e9210e2959a15e74c61220483a1d51b951d"
  ],
  "changed_files": [
    "schedule-backstop.sh",
    "tests/schedule-backstop-test.sh",
    "STATUS.md"
  ],
  "tests": [
    {
      "command": "bash tests/schedule-backstop-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": {
    "A new case drives a workflow whose job name differs from its file stem (resume-asks.yml with a resume run) and asserts a waiting/running/recently-started run SUPPRESSES dispatch; fails before fix, passes after": "tests/schedule-backstop-test.sh #190 cases (resume running/waiting/recent); verified red on pre-fix code via git stash, green after",
    "A matching case asserts the backstop still DISPATCHES when there is no in-flight/recent resume run": "tests/schedule-backstop-test.sh resume-idle.json case asserts dispatch occurs",
    "Existing swarm/healer/matrix-suffix/per-host cases continue to pass unchanged": "all 18 scenarios pass; existing cases unmodified except run_backstop gaining an optional 2nd arg defaulting to swarm.yml",
    "Offline test suite is green": "full suite loop run, no FAIL lines",
    "STATUS.md updated in the same commit (header line + affected item)": "STATUS.md new #190 header entry in commit 1ab59e9210e2959a15e74c61220483a1d51b951d"
  },
  "summary": "schedule-backstop.sh's in-flight guard now maps resume-asks.yml to its job name resume, so a real resume run suppresses the over-dispatch, with four new offline test cases.",
  "blockers": []
}
**close-report** for #190 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 190, "status": "success", "commits": [ "1ab59e9210e2959a15e74c61220483a1d51b951d" ], "changed_files": [ "schedule-backstop.sh", "tests/schedule-backstop-test.sh", "STATUS.md" ], "tests": [ { "command": "bash tests/schedule-backstop-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": { "A new case drives a workflow whose job name differs from its file stem (resume-asks.yml with a resume run) and asserts a waiting/running/recently-started run SUPPRESSES dispatch; fails before fix, passes after": "tests/schedule-backstop-test.sh #190 cases (resume running/waiting/recent); verified red on pre-fix code via git stash, green after", "A matching case asserts the backstop still DISPATCHES when there is no in-flight/recent resume run": "tests/schedule-backstop-test.sh resume-idle.json case asserts dispatch occurs", "Existing swarm/healer/matrix-suffix/per-host cases continue to pass unchanged": "all 18 scenarios pass; existing cases unmodified except run_backstop gaining an optional 2nd arg defaulting to swarm.yml", "Offline test suite is green": "full suite loop run, no FAIL lines", "STATUS.md updated in the same commit (header line + affected item)": "STATUS.md new #190 header entry in commit 1ab59e9210e2959a15e74c61220483a1d51b951d" }, "summary": "schedule-backstop.sh's in-flight guard now maps resume-asks.yml to its job name resume, so a real resume run suppresses the over-dispatch, with four new offline test cases.", "blockers": [] } ``` </details>
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#190
No description provided.