backstop/session-runner: a released host slot re-dispatches the stalest repo's swarm, not the loudest's #45

Closed
opened 2026-08-24 01:33:23 +00:00 by ben · 2 comments
Owner

Symptom (2026-08-23)

Matou/matou-app got zero swarm queue evaluations on either host between 02:46Z and 19:30Z+ while five tickets sat ready-for-agent (matou-app #63/#64/#65/#72/#73). Both hosts were nearly idle the whole time (elitebook-03: 90–97% CPU idle hourly, 12 GB free; workstation: 60–92% idle) — the machines weren't busy, the slots were.

Why matou-app specifically: idss/dev-factory generate their own label/close events, so their swarm runs re-probe the host locks dozens of times per hour and catch every gap the moment a session or drive releases. A quiet repo only probes on its :15/:45 cron + :00/:30 backstop — 4 clock-aligned probes/hour — and on hosts where busy windows run 1–2 h (session-runner sessions on the workstation, rehearsal drives on elitebook-03) those probes always land inside a busy window. Verdict logs: last matou-app line 02:00Z (workstation) / 02:46Z (elitebook-03); fuser on /tmp/matou-swarm.lock during the 19:30Z tick showed the drive holding both slots while matou-app's jobs yielded in ~2 s.

Fairness can't come from more polling; it has to come from the release side.

Ask

  1. Stalest-first dispatch order in schedule-backstop.sh: when the backstop dispatches swarm/triage across repos, order repos by oldest /tmp/matou-swarm-lastready-<owner>-<repo> stamp (missing stamp = oldest). Costs nothing when the host is free; when only one gap exists per hour, the starved repo gets it.
  2. Release-path nudge in session-runner.sh: after a session ends and host_capacity_release_heavy runs, fire one backstop tick (or dispatch the stalest repo's swarm workflow directly) so a freed slot is consumed within ~a minute instead of up to 15 (backstop) / 30 (cron).
  3. Consumer follow-up (idss): the rehearsal drive's release path (rehearsal-cycle.sh) does the same nudge — file that ticket in idss, it's not factory-owned.

Never camp, never queue: the nudge is one non-blocking dispatch, and a nudge that finds the slot already re-taken just loses like any other probe (#238).

Acceptance

  • Offline test: schedule-backstop-test.sh gains a case proving dispatch order follows lastready age (stalest first, missing stamp first of all).
  • Offline test: session-runner's release path emits exactly one nudge per session end (no nudge on a yielded/absorbed tick).
  • Live: with matou-app's stamp the oldest on the host, the next session end is followed by a matou-app swarm dispatch within ~1 min (runner journal + verdict log line for Matou/matou-app).
## Symptom (2026-08-23) Matou/matou-app got **zero** swarm queue evaluations on either host between 02:46Z and 19:30Z+ while five tickets sat `ready-for-agent` (matou-app #63/#64/#65/#72/#73). Both hosts were nearly idle the whole time (elitebook-03: 90–97% CPU idle hourly, 12 GB free; workstation: 60–92% idle) — the machines weren't busy, the *slots* were. Why matou-app specifically: idss/dev-factory generate their own label/close events, so their swarm runs re-probe the host locks dozens of times per hour and catch every gap the moment a session or drive releases. A quiet repo only probes on its :15/:45 cron + :00/:30 backstop — 4 clock-aligned probes/hour — and on hosts where busy windows run 1–2 h (session-runner sessions on the workstation, rehearsal drives on elitebook-03) those probes always land inside a busy window. Verdict logs: last matou-app line 02:00Z (workstation) / 02:46Z (elitebook-03); `fuser` on `/tmp/matou-swarm.lock` during the 19:30Z tick showed the drive holding both slots while matou-app's jobs yielded in ~2 s. Fairness can't come from more polling; it has to come from the release side. ## Ask 1. **Stalest-first dispatch order in `schedule-backstop.sh`**: when the backstop dispatches swarm/triage across repos, order repos by oldest `/tmp/matou-swarm-lastready-<owner>-<repo>` stamp (missing stamp = oldest). Costs nothing when the host is free; when only one gap exists per hour, the starved repo gets it. 2. **Release-path nudge in `session-runner.sh`**: after a session ends and `host_capacity_release_heavy` runs, fire one backstop tick (or dispatch the stalest repo's swarm workflow directly) so a freed slot is consumed within ~a minute instead of up to 15 (backstop) / 30 (cron). 3. **Consumer follow-up (idss)**: the rehearsal drive's release path (`rehearsal-cycle.sh`) does the same nudge — file that ticket in idss, it's not factory-owned. Never camp, never queue: the nudge is one non-blocking dispatch, and a nudge that finds the slot already re-taken just loses like any other probe (#238). ## Acceptance - Offline test: `schedule-backstop-test.sh` gains a case proving dispatch order follows lastready age (stalest first, missing stamp first of all). - Offline test: session-runner's release path emits exactly one nudge per session end (no nudge on a yielded/absorbed tick). - Live: with matou-app's stamp the oldest on the host, the next session end is followed by a matou-app swarm dispatch within ~1 min (runner journal + verdict log line for Matou/matou-app).

swarm-claim host=matou-dev-server-01 run=385
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=matou-dev-server-01 run=385 (automated multi-host claim — lowest live claim id works this ticket)

close-report for #45 — status success

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

envelope
{
  "issue": 45,
  "status": "success",
  "commits": [
    "5f8e192e15cd30677222e34eb6c0f659e1d42f58"
  ],
  "changed_files": [
    "STATUS.md",
    "onboarding/host-state-lib.sh",
    "onboarding/tests/host-state-lib-test.sh",
    "schedule-backstop.sh",
    "session-runner.sh",
    "tests/schedule-backstop-test.sh",
    "tests/session-runner-test.sh"
  ],
  "tests": [
    {
      "command": "bash tests/schedule-backstop-test.sh",
      "exit_code": 0
    },
    {
      "command": "bash tests/session-runner-test.sh",
      "exit_code": 0
    },
    {
      "command": "bash onboarding/tests/host-state-lib-test.sh",
      "exit_code": 0
    }
  ],
  "criteria": {
    "schedule-backstop-test.sh gains a case proving dispatch order follows lastready age (stalest first, missing stamp first of all)": "schedule-backstop.sh gains the pure `order-repos <owner/repo>...` subcommand ordering repos by the mtime of /tmp/matou-swarm-lastready-<owner>-<repo> (missing = stalest of all, stable ties); tests/schedule-backstop-test.sh adds three cases: gamma(missing)>beta(90m)>alpha(2m) ordering, two-missing input-order stability, and 'order-repos dispatches nothing' — all green (commit 5f8e192)",
    "session-runner's release path emits exactly one nudge per session end (no nudge on a yielded/absorbed tick)": "session-runner.sh adds SESSION_RUNNER_NUDGE (default EMPTY) + session_runner_nudge(), and at the single post-session choke point runs host_capacity_release_heavy then exactly one nudge; tests/session-runner-test.sh case 15 proves 1 nudge on an advanced session, 1 on a not-advanced (noop) session, and 0 on pool-exhausted / drive-yielded / limit-parked ticks",
    "Live: matou-app swarm dispatch within ~1 min of the next session end when its stamp is oldest": "Mechanism shipped and gate-unverifiable offline: the generated host backstop-tick.sh (onboarding/host-state-lib.sh host_state_render_backstop) now dispatches stalest-first via order-repos, and host_state_render_cron renders SESSION_RUNNER_NUDGE=<home>/factory-cron/backstop-tick.sh onto each session line, so a completed session's nudge fires that stalest-first backstop; goes live on the host's next `onboard.sh host-cron install` + a FACTORY_REF pin bump (host-state-lib-test.sh asserts both the generated tick ordering and the rendered nudge)",
    "Consumer follow-up (idss rehearsal-cycle.sh release-path nudge)": "Filed as Matou/idss #739 (needs-triage) — a consumer follow-up, not factory-owned, per ticket ask 3"
  },
  "summary": "Freed host slots now go to the stalest repo: schedule-backstop.sh order-repos + stalest-first host backstop-tick, plus a one-shot session-runner release-path nudge.",
  "blockers": []
}
**close-report** for #45 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 45, "status": "success", "commits": [ "5f8e192e15cd30677222e34eb6c0f659e1d42f58" ], "changed_files": [ "STATUS.md", "onboarding/host-state-lib.sh", "onboarding/tests/host-state-lib-test.sh", "schedule-backstop.sh", "session-runner.sh", "tests/schedule-backstop-test.sh", "tests/session-runner-test.sh" ], "tests": [ { "command": "bash tests/schedule-backstop-test.sh", "exit_code": 0 }, { "command": "bash tests/session-runner-test.sh", "exit_code": 0 }, { "command": "bash onboarding/tests/host-state-lib-test.sh", "exit_code": 0 } ], "criteria": { "schedule-backstop-test.sh gains a case proving dispatch order follows lastready age (stalest first, missing stamp first of all)": "schedule-backstop.sh gains the pure `order-repos <owner/repo>...` subcommand ordering repos by the mtime of /tmp/matou-swarm-lastready-<owner>-<repo> (missing = stalest of all, stable ties); tests/schedule-backstop-test.sh adds three cases: gamma(missing)>beta(90m)>alpha(2m) ordering, two-missing input-order stability, and 'order-repos dispatches nothing' — all green (commit 5f8e192)", "session-runner's release path emits exactly one nudge per session end (no nudge on a yielded/absorbed tick)": "session-runner.sh adds SESSION_RUNNER_NUDGE (default EMPTY) + session_runner_nudge(), and at the single post-session choke point runs host_capacity_release_heavy then exactly one nudge; tests/session-runner-test.sh case 15 proves 1 nudge on an advanced session, 1 on a not-advanced (noop) session, and 0 on pool-exhausted / drive-yielded / limit-parked ticks", "Live: matou-app swarm dispatch within ~1 min of the next session end when its stamp is oldest": "Mechanism shipped and gate-unverifiable offline: the generated host backstop-tick.sh (onboarding/host-state-lib.sh host_state_render_backstop) now dispatches stalest-first via order-repos, and host_state_render_cron renders SESSION_RUNNER_NUDGE=<home>/factory-cron/backstop-tick.sh onto each session line, so a completed session's nudge fires that stalest-first backstop; goes live on the host's next `onboard.sh host-cron install` + a FACTORY_REF pin bump (host-state-lib-test.sh asserts both the generated tick ordering and the rendered nudge)", "Consumer follow-up (idss rehearsal-cycle.sh release-path nudge)": "Filed as Matou/idss #739 (needs-triage) — a consumer follow-up, not factory-owned, per ticket ask 3" }, "summary": "Freed host slots now go to the stalest repo: schedule-backstop.sh order-repos + stalest-first host backstop-tick, plus a one-shot session-runner release-path nudge.", "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#45
No description provided.