rehearsal-cycle.sh release-path nudge: a freed drive slot re-dispatches the stalest repo's swarm (dev-factory #45 follow-up) #739

Closed
opened 2026-08-24 01:54:21 +00:00 by matou-build-agent · 4 comments

Symptom

Consumer follow-up from Matou/dev-factory #45 (a freed host slot re-dispatches the stalest repo's swarm, not the loudest's). #45 fixed the factory side in two parts: schedule-backstop.sh order-repos orders repos stalest-first by their /tmp/matou-swarm-lastready-<owner>-<repo> stamp, and session-runner.sh fires one backstop nudge on its release path (host_capacity_release_heavy → SESSION_RUNNER_NUDGE) so a freed slot is consumed within ~a minute instead of up to a full backstop/cron window.

The rehearsal drive's release path (rehearsal-cycle.sh in this repo) does NOT yet do the same nudge. When a rehearsal drive finishes and releases the host's exclusive capacity, nothing fires a backstop tick, so the freed capacity sits idle until the next clock-aligned probe — the same starvation #45 addressed for the session-runner path, on the drive path.

Ask

After rehearsal-cycle.sh releases the host capacity it held (its EXIT/release path), fire ONE non-blocking backstop tick (the host's <home>/factory-cron/backstop-tick.sh, which dev-factory #45 made dispatch stalest-first) so the stalest repo's swarm is dispatched onto the just-freed slot. Never camp, never queue: one non-blocking dispatch; a nudge that finds the slot already re-taken just loses like any other probe.

Acceptance

  • Offline test: rehearsal-cycle.sh's release path emits exactly one nudge per drive end (no nudge on a yielded/absorbed tick), mirroring dev-factory tests/session-runner-test.sh case 15.

Filed by the dev-factory swarm while working dev-factory #45 (ask 3 — "file that ticket in idss, it's not factory-owned").

## Symptom Consumer follow-up from `Matou/dev-factory` #45 (a freed host slot re-dispatches the stalest repo's swarm, not the loudest's). #45 fixed the factory side in two parts: `schedule-backstop.sh order-repos` orders repos stalest-first by their `/tmp/matou-swarm-lastready-<owner>-<repo>` stamp, and `session-runner.sh` fires one backstop nudge on its release path (`host_capacity_release_heavy` → `SESSION_RUNNER_NUDGE`) so a freed slot is consumed within ~a minute instead of up to a full backstop/cron window. The rehearsal drive's release path (`rehearsal-cycle.sh` in this repo) does NOT yet do the same nudge. When a rehearsal drive finishes and releases the host's exclusive capacity, nothing fires a backstop tick, so the freed capacity sits idle until the next clock-aligned probe — the same starvation #45 addressed for the session-runner path, on the drive path. ## Ask After `rehearsal-cycle.sh` releases the host capacity it held (its EXIT/release path), fire ONE non-blocking backstop tick (the host's `<home>/factory-cron/backstop-tick.sh`, which dev-factory #45 made dispatch stalest-first) so the stalest repo's swarm is dispatched onto the just-freed slot. Never camp, never queue: one non-blocking dispatch; a nudge that finds the slot already re-taken just loses like any other probe. ## Acceptance - Offline test: `rehearsal-cycle.sh`'s release path emits exactly one nudge per drive end (no nudge on a yielded/absorbed tick), mirroring dev-factory `tests/session-runner-test.sh` case 15. Filed by the dev-factory swarm while working dev-factory #45 (ask 3 — "file that ticket in idss, it's not factory-owned").
Author
Member

This was generated by AI during triage.

Redundancy check: searched scripts/rehearsal-cycle.sh for any existing nudge/backstop dispatch on its release path — none exists. Its host-capacity release traps (host_capacity_drive_release, extended later to drive_status_clear "$root"; host_capacity_drive_release) only clear local reservation/status state; nothing fires a dispatch. Not already implemented. No .out-of-scope/ entry matches (empty directory). Not a protected-path change — the release path lives under scripts/, not .sandcastle/ or .forgejo/, so a swarm worker can take it directly (ready-for-agent, not ready-for-session).

Agent Brief

Category: enhancement
Summary: The rehearsal drive's release path should fire one non-blocking backstop nudge, mirroring dev-factory #45's session-runner release nudge, so a freed host slot is consumed promptly instead of sitting idle until the next clock-aligned probe.

Current behavior:
When a rehearsal drive finishes (completion or abandonment) and releases the host capacity it held, only its own reservation and drive-status record are cleared. Nothing signals the host's stalest-first backstop dispatcher that a slot just freed up, so the freed capacity sits idle until the next scheduled probe — the same starvation pattern dev-factory #45 fixed for the session-runner's release path, not yet mirrored here.

Desired behavior:
On release — but only for a tick that actually acquired host capacity and is now giving it back, never for a tick that yielded because capacity was busy — fire exactly one non-blocking dispatch of the host's stalest-first backstop tick (the same mechanism dev-factory's session-runner release path already invokes: host_capacity_release_heavy → a backstop nudge). The call must not block waiting on the backstop script's own dispatch decision; a nudge that finds the slot already retaken loses like any other probe, with no retry or camping.

Key interfaces:

  • The release trap that clears the drive's host-capacity reservation is the right place to add the nudge — it should fire alongside (not instead of) the existing reservation/status cleanup.
  • The nudge must be conditioned on capacity having been acquired this tick (a tick that yielded at the busy-capacity check and exits early has nothing to release and must not nudge).
  • Reuse whatever host-level backstop dispatch entrypoint dev-factory's session-runner release path already calls; don't invent a second mechanism.

Acceptance criteria:

  • An offline test (mirroring dev-factory's tests/session-runner-test.sh case 15 pattern) exercises the release path and asserts exactly one nudge invocation per drive that acquired capacity and then completed or was abandoned.
  • A tick that yields at the capacity-busy check (never acquires) emits zero nudges.
  • The nudge invocation is non-blocking — the release path's own exit is not delayed waiting on the backstop script.
  • Existing release-path behavior (capacity release, drive-status clear) is unchanged for both the success and failure/abandonment paths.

Out of scope:

  • Any change to dev-factory's own session-runner.sh or backstop dispatch script — this ticket only wires the idss-side release path to call the existing mechanism.
  • The stalest-first ordering policy itself (already shipped by dev-factory #45); this ticket only ensures the release path triggers a tick, not how that tick chooses what to dispatch.
> *This was generated by AI during triage.* **Redundancy check:** searched `scripts/rehearsal-cycle.sh` for any existing nudge/backstop dispatch on its release path — none exists. Its host-capacity release traps (`host_capacity_drive_release`, extended later to `drive_status_clear "$root"; host_capacity_drive_release`) only clear local reservation/status state; nothing fires a dispatch. Not already implemented. No `.out-of-scope/` entry matches (empty directory). Not a protected-path change — the release path lives under `scripts/`, not `.sandcastle/` or `.forgejo/`, so a swarm worker can take it directly (`ready-for-agent`, not `ready-for-session`). ## Agent Brief **Category:** enhancement **Summary:** The rehearsal drive's release path should fire one non-blocking backstop nudge, mirroring dev-factory #45's session-runner release nudge, so a freed host slot is consumed promptly instead of sitting idle until the next clock-aligned probe. **Current behavior:** When a rehearsal drive finishes (completion or abandonment) and releases the host capacity it held, only its own reservation and drive-status record are cleared. Nothing signals the host's stalest-first backstop dispatcher that a slot just freed up, so the freed capacity sits idle until the next scheduled probe — the same starvation pattern dev-factory #45 fixed for the session-runner's release path, not yet mirrored here. **Desired behavior:** On release — but only for a tick that actually acquired host capacity and is now giving it back, never for a tick that yielded because capacity was busy — fire exactly one non-blocking dispatch of the host's stalest-first backstop tick (the same mechanism dev-factory's session-runner release path already invokes: `host_capacity_release_heavy` → a backstop nudge). The call must not block waiting on the backstop script's own dispatch decision; a nudge that finds the slot already retaken loses like any other probe, with no retry or camping. **Key interfaces:** - The release trap that clears the drive's host-capacity reservation is the right place to add the nudge — it should fire alongside (not instead of) the existing reservation/status cleanup. - The nudge must be conditioned on capacity having been acquired this tick (a tick that yielded at the busy-capacity check and exits early has nothing to release and must not nudge). - Reuse whatever host-level backstop dispatch entrypoint dev-factory's session-runner release path already calls; don't invent a second mechanism. **Acceptance criteria:** - [ ] An offline test (mirroring dev-factory's `tests/session-runner-test.sh` case 15 pattern) exercises the release path and asserts exactly one nudge invocation per drive that acquired capacity and then completed or was abandoned. - [ ] A tick that yields at the capacity-busy check (never acquires) emits zero nudges. - [ ] The nudge invocation is non-blocking — the release path's own exit is not delayed waiting on the backstop script. - [ ] Existing release-path behavior (capacity release, drive-status clear) is unchanged for both the success and failure/abandonment paths. **Out of scope:** - Any change to dev-factory's own `session-runner.sh` or backstop dispatch script — this ticket only wires the idss-side release path to call the existing mechanism. - The stalest-first ordering policy itself (already shipped by dev-factory #45); this ticket only ensures the release path triggers a tick, not how that tick chooses what to dispatch.
Author
Member

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

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

close-report for #739 — status success

⛔ close-report gates REFUSED this close — the following claims did not verify:

  • commit 09ca7197d6 is not reachable from origin/main (not landed)
  • changed_files: 'STATUS.md' is not in the diff of the claimed commits
  • changed_files: 'scripts/rehearsal-cycle.sh' is not in the diff of the claimed commits
  • changed_files: 'scripts/tests/rehearsal-release-nudge-test.sh' is not in the diff of the claimed commits
envelope
{
  "issue": 739,
  "status": "success",
  "commits": [
    "09ca7197d6d9d95b8d48df27fc2d627dfbd02d47"
  ],
  "changed_files": [
    "STATUS.md",
    "scripts/rehearsal-cycle.sh",
    "scripts/tests/rehearsal-release-nudge-test.sh"
  ],
  "tests": [
    {
      "command": "bash scripts/tests/rehearsal-release-nudge-test.sh",
      "exit_code": 0
    },
    {
      "command": "bash scripts/tests/rehearsal-drive-exclusive-test.sh",
      "exit_code": 0
    },
    {
      "command": "bash -n scripts/rehearsal-cycle.sh",
      "exit_code": 0
    }
  ],
  "criteria": {
    "Offline test: rehearsal-cycle.sh's release path emits exactly one nudge per drive end (no nudge on a yielded/absorbed tick), mirroring dev-factory tests/session-runner-test.sh case 15": "scripts/tests/rehearsal-release-nudge-test.sh (7 checks, PASS): check 1 asserts exactly one non-blocking nudge per acquired drive end; checks 5-6 assert both post-acquire EXIT traps carry rehearsal_backstop_nudge ordered after the capacity release; check 7 asserts the busy-capacity yield exit precedes the first nudging trap so a yielded/absorbed tick arms no trap and nudges zero times"
  },
  "summary": "rehearsal-cycle.sh's release path now fires one non-blocking, detached stalest-first backstop nudge so a freed drive slot re-dispatches promptly instead of idling to the next clock-aligned probe.",
  "blockers": []
}
**close-report** for #739 — status `success` :no_entry: **close-report gates REFUSED this close** — the following claims did not verify: - commit 09ca7197d6d9d95b8d48df27fc2d627dfbd02d47 is not reachable from origin/main (not landed) - changed_files: 'STATUS.md' is not in the diff of the claimed commits - changed_files: 'scripts/rehearsal-cycle.sh' is not in the diff of the claimed commits - changed_files: 'scripts/tests/rehearsal-release-nudge-test.sh' is not in the diff of the claimed commits <details><summary>envelope</summary> ```json { "issue": 739, "status": "success", "commits": [ "09ca7197d6d9d95b8d48df27fc2d627dfbd02d47" ], "changed_files": [ "STATUS.md", "scripts/rehearsal-cycle.sh", "scripts/tests/rehearsal-release-nudge-test.sh" ], "tests": [ { "command": "bash scripts/tests/rehearsal-release-nudge-test.sh", "exit_code": 0 }, { "command": "bash scripts/tests/rehearsal-drive-exclusive-test.sh", "exit_code": 0 }, { "command": "bash -n scripts/rehearsal-cycle.sh", "exit_code": 0 } ], "criteria": { "Offline test: rehearsal-cycle.sh's release path emits exactly one nudge per drive end (no nudge on a yielded/absorbed tick), mirroring dev-factory tests/session-runner-test.sh case 15": "scripts/tests/rehearsal-release-nudge-test.sh (7 checks, PASS): check 1 asserts exactly one non-blocking nudge per acquired drive end; checks 5-6 assert both post-acquire EXIT traps carry rehearsal_backstop_nudge ordered after the capacity release; check 7 asserts the busy-capacity yield exit precedes the first nudging trap so a yielded/absorbed tick arms no trap and nudges zero times" }, "summary": "rehearsal-cycle.sh's release path now fires one non-blocking, detached stalest-first backstop nudge so a freed drive slot re-dispatches promptly instead of idling to the next clock-aligned probe.", "blockers": [] } ``` </details>
Author
Member

close-report for #739 — status success

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

envelope
{
  "issue": 739,
  "status": "success",
  "commits": [
    "09ca7197d6d9d95b8d48df27fc2d627dfbd02d47"
  ],
  "changed_files": [
    "STATUS.md",
    "scripts/rehearsal-cycle.sh",
    "scripts/tests/rehearsal-release-nudge-test.sh"
  ],
  "tests": [
    {
      "command": "bash scripts/tests/rehearsal-release-nudge-test.sh",
      "exit_code": 0
    },
    {
      "command": "bash scripts/tests/rehearsal-drive-exclusive-test.sh",
      "exit_code": 0
    },
    {
      "command": "bash -n scripts/rehearsal-cycle.sh",
      "exit_code": 0
    }
  ],
  "criteria": {
    "Offline test: rehearsal-cycle.sh's release path emits exactly one nudge per drive end (no nudge on a yielded/absorbed tick), mirroring dev-factory tests/session-runner-test.sh case 15": "scripts/tests/rehearsal-release-nudge-test.sh (7 checks, PASS): check 1 asserts exactly one non-blocking nudge per acquired drive end; checks 5-6 assert both post-acquire EXIT traps carry rehearsal_backstop_nudge ordered after the capacity release; check 7 asserts the busy-capacity yield exit precedes the first nudging trap so a yielded/absorbed tick arms no trap and nudges zero times"
  },
  "summary": "rehearsal-cycle.sh's release path now fires one non-blocking, detached stalest-first backstop nudge so a freed drive slot re-dispatches promptly instead of idling to the next clock-aligned probe.",
  "blockers": []
}
**close-report** for #739 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 739, "status": "success", "commits": [ "09ca7197d6d9d95b8d48df27fc2d627dfbd02d47" ], "changed_files": [ "STATUS.md", "scripts/rehearsal-cycle.sh", "scripts/tests/rehearsal-release-nudge-test.sh" ], "tests": [ { "command": "bash scripts/tests/rehearsal-release-nudge-test.sh", "exit_code": 0 }, { "command": "bash scripts/tests/rehearsal-drive-exclusive-test.sh", "exit_code": 0 }, { "command": "bash -n scripts/rehearsal-cycle.sh", "exit_code": 0 } ], "criteria": { "Offline test: rehearsal-cycle.sh's release path emits exactly one nudge per drive end (no nudge on a yielded/absorbed tick), mirroring dev-factory tests/session-runner-test.sh case 15": "scripts/tests/rehearsal-release-nudge-test.sh (7 checks, PASS): check 1 asserts exactly one non-blocking nudge per acquired drive end; checks 5-6 assert both post-acquire EXIT traps carry rehearsal_backstop_nudge ordered after the capacity release; check 7 asserts the busy-capacity yield exit precedes the first nudging trap so a yielded/absorbed tick arms no trap and nudges zero times" }, "summary": "rehearsal-cycle.sh's release path now fires one non-blocking, detached stalest-first backstop nudge so a freed drive slot re-dispatches promptly instead of idling to the next clock-aligned probe.", "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/idss#739
No description provided.