The broker rail has no automatic trigger at all — Forgejo has never fired a workflow_run event here, and all 4 broker-deploy runs in history were manual #874

Closed
opened 2026-08-26 19:18:20 +00:00 by ben · 3 comments
Owner

The broker's "auto-deploy" rail has no automatic trigger and never has.
broker-deploy.yml declares

  workflow_run:
    workflows: [ci]
    types: [completed]
    branches: [main]

but Forgejo has never fired a workflow_run event in this repository. Across
the whole task history:

events across 13,440 tasks:
  issues 6826 | workflow_dispatch 5012 | schedule 620 | push 981 | pull_request 1
  workflow_run ...................................................... 0

broker-deploy.yml is the only workflow here that declares workflow_run, and
every one of its four runs in history was a manual workflow_dispatch:

11014  failure  workflow_dispatch  2026-08-26T06:06:54Z
10982  failure  workflow_dispatch  2026-08-26T05:28:58Z
10866  failure  workflow_dispatch  2026-08-26T01:08:00Z
 9138  failure  workflow_dispatch  2026-08-23T04:55:05Z

Server is Forgejo 15.0.5+gitea-1.22.0.

Why this matters

This is the third wall in the same rail, and it is the one that outlives the
other two:

  1. #745 / GOTCHAS #90 — the runner was on the wrong Netbird mesh. Fixed.
  2. #745 / GOTCHAS #91 — the installer's marker check rejected genuine brokers via
    SIGPIPE. Fixed in 6200acb3, not yet live (#872).
  3. This. Even once 1 and 2 are fully closed and a dispatch installs cleanly,
    no future broker commit will ever deploy itself. ci will publish the
    binary on every broker-touching push, exactly as it does now, and nothing will
    install it. The rail will keep working only for as long as a human remembers
    to dispatch it by hand — which is precisely the failure mode ADR 0185 built it
    to remove.

It also reframes the headline number. "The install step succeeded exactly once in
11,639 tasks" was read as a broken ssh leg; the deeper reading is that the job
only ever ran when a human pushed the button, four times, ever.

Shape of a fix (not ruled — this is the filing)

  1. Fold the deploy into ci as a job, needs: publish-broker, with
    runs-on: elitebook-03 on that job alone. Same push event, no cross-workflow
    trigger, no new machinery — publish-broker already computes whether the sha
    was published, so the deploy leg can gate on its output rather than re-probing
    the registry. Loses the ability to dispatch a deploy independently, so keep
    broker-deploy.yml's workflow_dispatch as the manual/rollback door.
  2. Have ci dispatch it explicitly — a final ci step that POSTs the
    workflow_dispatch API for broker-deploy.yml with sha: ${{ github.sha }}.
    Keeps the two workflows separate; costs a token with actions write.
  3. Schedule it — a cron that deploys main's newest published broker sha if
    it differs from what is live. Self-healing and trigger-independent, but adds a
    window and needs a live-version probe (GOTCHAS #59).

Acceptance, whichever lands: a broker-touching push to main results in the live
broker running that sha, with no human in the loop, and something red if it does
not.

Also, for whoever dispatched at ~18:52Z today

A dispatch was made by hand around 2026-08-26T18:52Z. It produced no run —
the four above are the complete history and the newest is 06:06:54Z. A Forgejo
workflow_dispatch POST that is malformed, missing ref, or unauthorized
returns a non-2xx and creates nothing; it does not queue silently. Worth
re-checking the response code before concluding a deploy was attempted.

Filed from #745's session. Sibling of #872 (the installer copy the rail cannot
update); that one is about what the rail installs, this is about whether it ever
runs.

**The broker's "auto-deploy" rail has no automatic trigger and never has.** `broker-deploy.yml` declares ```yaml workflow_run: workflows: [ci] types: [completed] branches: [main] ``` but **Forgejo has never fired a `workflow_run` event in this repository.** Across the whole task history: ``` events across 13,440 tasks: issues 6826 | workflow_dispatch 5012 | schedule 620 | push 981 | pull_request 1 workflow_run ...................................................... 0 ``` `broker-deploy.yml` is the only workflow here that declares `workflow_run`, and every one of its **four** runs in history was a manual `workflow_dispatch`: ``` 11014 failure workflow_dispatch 2026-08-26T06:06:54Z 10982 failure workflow_dispatch 2026-08-26T05:28:58Z 10866 failure workflow_dispatch 2026-08-26T01:08:00Z 9138 failure workflow_dispatch 2026-08-23T04:55:05Z ``` Server is Forgejo `15.0.5+gitea-1.22.0`. ## Why this matters This is the **third** wall in the same rail, and it is the one that outlives the other two: 1. #745 / GOTCHAS #90 — the runner was on the wrong Netbird mesh. Fixed. 2. #745 / GOTCHAS #91 — the installer's marker check rejected genuine brokers via SIGPIPE. Fixed in `6200acb3`, not yet live (#872). 3. **This.** Even once 1 and 2 are fully closed and a dispatch installs cleanly, **no future broker commit will ever deploy itself.** `ci` will publish the binary on every broker-touching push, exactly as it does now, and nothing will install it. The rail will keep working only for as long as a human remembers to dispatch it by hand — which is precisely the failure mode ADR 0185 built it to remove. It also reframes the headline number. "The install step succeeded exactly once in 11,639 tasks" was read as a broken ssh leg; the deeper reading is that the job only ever ran when a human pushed the button, four times, ever. ## Shape of a fix (not ruled — this is the filing) 1. **Fold the deploy into `ci` as a job**, `needs: publish-broker`, with `runs-on: elitebook-03` on that job alone. Same push event, no cross-workflow trigger, no new machinery — `publish-broker` already computes whether the sha was published, so the deploy leg can gate on its output rather than re-probing the registry. Loses the ability to dispatch a deploy independently, so keep `broker-deploy.yml`'s `workflow_dispatch` as the manual/rollback door. 2. **Have `ci` dispatch it explicitly** — a final `ci` step that POSTs the `workflow_dispatch` API for `broker-deploy.yml` with `sha: ${{ github.sha }}`. Keeps the two workflows separate; costs a token with actions write. 3. **Schedule it** — a cron that deploys `main`'s newest published broker sha if it differs from what is live. Self-healing and trigger-independent, but adds a window and needs a live-version probe (GOTCHAS #59). Acceptance, whichever lands: a broker-touching push to `main` results in the live broker running that sha, with no human in the loop, and something red if it does not. ## Also, for whoever dispatched at ~18:52Z today A dispatch was made by hand around 2026-08-26T18:52Z. **It produced no run** — the four above are the complete history and the newest is 06:06:54Z. A Forgejo `workflow_dispatch` POST that is malformed, missing `ref`, or unauthorized returns a non-2xx and creates nothing; it does not queue silently. Worth re-checking the response code before concluding a deploy was attempted. Filed from #745's session. Sibling of #872 (the installer copy the rail cannot update); that one is about what the rail installs, this is about whether it ever runs.
Author
Owner

Correction to two counts in the filing above. The conclusion stands; the arithmetic behind it does not.

The dispatch DID land — I said it produced no run, and that was wrong

Ben's ~18:52Z dispatch returned 204 and created run 23170 (broker-deploy.yml, commit 974962bf, trigger ben), which is sitting in waiting right now. My "it produced no run" was an artefact of the endpoint I probed, not a fact about the server. Verified independently:

$ curl .../actions/runs?status=waiting | jq '[.workflow_runs[]|select(.workflow_id=="broker-deploy.yml")]'
  id 23170 | status waiting

The trap, which is worth writing down because it bit two sessions independently: GET /actions/tasks lists only jobs a runner has CLAIMED. A created-but-unclaimed run appears in /actions/runs?status=waiting and nowhere in /actions/tasks. Any "complete history" built from tasks is really "the history of claimed runs". The same endpoint has a second trap: a task's name is the job name (deploy), not the workflow name, so grepping tasks for broker-deploy returns zero even for the runs that did execute — filter on workflow_id instead.

So the count in the filing should read five runs, four of them claimed and one waiting, not "four times, ever".

What does NOT change

workflow_run is still zero across 13,438 tasks, confirmed independently by a second session's snapshot. broker-deploy.yml remains the only workflow declaring it, and every run that has ever executed was a manual workflow_dispatch — run 23170 included. The rail still has no automatic trigger, and the three candidate fixes above stand unchanged.

And the reason it is still waiting is a separate, larger fault

Run 23170 has not been claimed because the queue is not draining: ~1,454 runs are waiting, the oldest since 2026-08-25T20:15Z, and only swarm.yml tasks are moving. That is #878, not this ticket. Evidence gathered here that narrows it, for whoever takes it:

  • elitebook-03's runner is active (v12.13.1), capacity: 2, and is running one job container (sandcastle-6588…, up 28 min) — so it has a free slot.
  • Its registered labels are ['elitebook-03:host', 'swarm:host'], which the org API reports as ['elitebook-03','swarm']. A job saying runs-on: elitebook-03 matches.
  • Therefore run 23170 has a matching label AND a free slot on a live runner, and is still not claimed.

That rules out the three cheapest explanations — dead runner, wrong labels, saturated capacity — and points at server-side scheduling or stale task bookkeeping rather than anything on the runner hosts. matou-workstation could not be probed from here: it is on the product mesh (GOTCHAS #90), the same split that started this whole thread.

Consequence for this ticket: when the queue does drain, 23170 will run and fail at the marker check, because the droplet's installer is still the pre-fix hand-placed copy (#872). That failure will be a confirmation of GOTCHAS #91, not a new defect — do not re-dig it.

**Correction to two counts in the filing above. The conclusion stands; the arithmetic behind it does not.** ## The dispatch DID land — I said it produced no run, and that was wrong Ben's ~18:52Z dispatch returned `204` and created run **23170** (`broker-deploy.yml`, commit `974962bf`, trigger `ben`), which is sitting in **`waiting`** right now. My "it produced no run" was an artefact of the endpoint I probed, not a fact about the server. Verified independently: ``` $ curl .../actions/runs?status=waiting | jq '[.workflow_runs[]|select(.workflow_id=="broker-deploy.yml")]' id 23170 | status waiting ``` **The trap, which is worth writing down because it bit two sessions independently:** `GET /actions/tasks` lists only jobs a runner has **CLAIMED**. A created-but-unclaimed run appears in `/actions/runs?status=waiting` and **nowhere in `/actions/tasks`**. Any "complete history" built from `tasks` is really "the history of claimed runs". The same endpoint has a second trap: a task's `name` is the **job** name (`deploy`), not the workflow name, so grepping `tasks` for `broker-deploy` returns zero even for the runs that did execute — filter on `workflow_id` instead. So the count in the filing should read **five runs, four of them claimed and one waiting**, not "four times, ever". ## What does NOT change `workflow_run` is still **zero across 13,438 tasks**, confirmed independently by a second session's snapshot. `broker-deploy.yml` remains the only workflow declaring it, and every run that has ever *executed* was a manual `workflow_dispatch` — run 23170 included. The rail still has no automatic trigger, and the three candidate fixes above stand unchanged. ## And the reason it is still waiting is a separate, larger fault Run 23170 has not been claimed because **the queue is not draining**: ~1,454 runs are `waiting`, the oldest since 2026-08-25T20:15Z, and only `swarm.yml` tasks are moving. That is **#878**, not this ticket. Evidence gathered here that narrows it, for whoever takes it: - `elitebook-03`'s runner is `active` (v12.13.1), **`capacity: 2`**, and is running **one** job container (`sandcastle-6588…`, up 28 min) — so it has **a free slot**. - Its registered labels are `['elitebook-03:host', 'swarm:host']`, which the org API reports as `['elitebook-03','swarm']`. A job saying `runs-on: elitebook-03` matches. - Therefore run 23170 has **a matching label AND a free slot on a live runner, and is still not claimed.** That rules out the three cheapest explanations — dead runner, wrong labels, saturated capacity — and points at server-side scheduling or stale task bookkeeping rather than anything on the runner hosts. `matou-workstation` could not be probed from here: it is on the product mesh (GOTCHAS #90), the same split that started this whole thread. **Consequence for this ticket:** when the queue does drain, 23170 will run and **fail at the marker check**, because the droplet's installer is still the pre-fix hand-placed copy (#872). That failure will be a confirmation of GOTCHAS #91, not a new defect — do not re-dig it.

This was generated by AI during triage.

Ruled by agent under ADR 0174 — veto anytime.

Ruling: ready-for-session (keeps existing priority). Not ready-for-agent, not ready-for-human.

Why not ready-for-agent: the fix edits .forgejo/workflows/broker-deploy.yml and/or ci.yml — .forgejo/ is a fingerprinted protected path for swarm workers (edits rolled back after the run, #445; .sandcastle/protected-paths-lib.sh). It is also a live broker-deploy rail (elitebook-03 → mail droplet over the admin mesh). Same class as siblings #860 / #864 / #872 / #880, all ready-for-session — #874 belongs with them.

Why not ready-for-human (with one guardrail): choosing and wiring a CI trigger is revertible and provable by a drive, so it is not inherently a one-way door. The one part that would be — option 2's "token with actions write" (a new credential / posture consideration) — is avoidable, since options 1 and 3 need no new credential. So: route to session, with the guardrail below.

Why this is a two-way door: any of the three candidate fixes is revertible by reverting the workflow commit, and the acceptance ("a broker-touching push to main results in the live broker running that sha, no human in the loop, something red if not") is provable by a live broker drive. Reversible + provable + (options 1/3) off the one-way-door list.

Verified against the tree: .forgejo/workflows/broker-deploy.yml declares the workflow_run: [ci] trigger, and it is the only workflow here that does — consistent with the filing's "zero workflow_run events across 13,438 tasks". The rail's automatic trigger is a Forgejo event that never fires. Confirmed as filed.

Recommended default (session may override): option 1 — fold the deploy into ci as a needs: publish-broker job pinned runs-on: elitebook-03, gating on publish-broker's existing output. Adds no cross-workflow trigger (the thing Forgejo never fires) and no new credential. Keep broker-deploy.yml's workflow_dispatch as the manual/rollback door.
Guardrail: do not adopt option 2's actions-write token without a human — that is the one-way-door residue (security-posture widening, ADR 0174 §3). If a session concludes only option 2 works, re-label ready-for-human with that as the ## Why human.

Sequencing note: this rail is also currently behind the queue-drain fault (#878) and the not-yet-live installer fix (#872 / GOTCHAS #91). Per the filing, waiting run 23170 will fail at the marker check until #872 is live — a confirmation of #91, not a new defect. Land this trigger fix so the next broker sha self-deploys; expect the first post-fix run to still need #872 live to go green.

Session brief

  • Do: give the broker deploy an automatic trigger on a real Forgejo event (default: fold into ci as a job, option 1). Preserve workflow_dispatch for manual/rollback.
  • Acceptance: a broker-touching push to main results in the live broker running that sha with no human in the loop, and a red signal if it does not.
  • Guardrail: avoid a new actions-write token (option 2) — that path is a human gate.
  • Needs session standing because: protected .forgejo/ path + live broker-deploy infrastructure (admin mesh, elitebook-03).
> *This was generated by AI during triage.* **Ruled by agent under ADR 0174 — veto anytime.** **Ruling:** `ready-for-session` (keeps existing `priority`). Not `ready-for-agent`, not `ready-for-human`. **Why not `ready-for-agent`:** the fix edits `.forgejo/workflows/broker-deploy.yml` and/or `ci.yml` — `.forgejo/` is a fingerprinted protected path for swarm workers (edits rolled back after the run, #445; `.sandcastle/protected-paths-lib.sh`). It is also a live broker-deploy rail (elitebook-03 → mail droplet over the admin mesh). Same class as siblings #860 / #864 / #872 / #880, all `ready-for-session` — #874 belongs with them. **Why not `ready-for-human` (with one guardrail):** choosing and wiring a CI trigger is revertible and provable by a drive, so it is not inherently a one-way door. The one part that would be — option 2's "token with actions write" (a new credential / posture consideration) — is avoidable, since options 1 and 3 need no new credential. So: route to session, with the guardrail below. **Why this is a two-way door:** any of the three candidate fixes is revertible by reverting the workflow commit, and the acceptance ("a broker-touching push to main results in the live broker running that sha, no human in the loop, something red if not") is provable by a live broker drive. Reversible + provable + (options 1/3) off the one-way-door list. **Verified against the tree:** `.forgejo/workflows/broker-deploy.yml` declares the `workflow_run: [ci]` trigger, and it is the only workflow here that does — consistent with the filing's "zero `workflow_run` events across 13,438 tasks". The rail's automatic trigger is a Forgejo event that never fires. Confirmed as filed. **Recommended default (session may override): option 1 — fold the deploy into `ci` as a `needs: publish-broker` job pinned `runs-on: elitebook-03`**, gating on `publish-broker`'s existing output. Adds no cross-workflow trigger (the thing Forgejo never fires) and no new credential. Keep `broker-deploy.yml`'s `workflow_dispatch` as the manual/rollback door. **Guardrail:** do **not** adopt option 2's actions-write token without a human — that is the one-way-door residue (security-posture widening, ADR 0174 §3). If a session concludes only option 2 works, re-label `ready-for-human` with that as the `## Why human`. **Sequencing note:** this rail is also currently behind the queue-drain fault (#878) and the not-yet-live installer fix (#872 / GOTCHAS #91). Per the filing, waiting run 23170 will fail at the marker check until #872 is live — a confirmation of #91, not a new defect. Land this trigger fix so the *next* broker sha self-deploys; expect the first post-fix run to still need #872 live to go green. ## Session brief - **Do:** give the broker deploy an automatic trigger on a real Forgejo event (default: fold into `ci` as a job, option 1). Preserve `workflow_dispatch` for manual/rollback. - **Acceptance:** a broker-touching push to `main` results in the live broker running that sha with no human in the loop, and a red signal if it does not. - **Guardrail:** avoid a new actions-write token (option 2) — that path is a human gate. - **Needs session standing because:** protected `.forgejo/` path + live broker-deploy infrastructure (admin mesh, elitebook-03).

Close-report — ruled by agent under ADR 0174 (veto anytime; two-way door).

The broker rail's automatic trigger is wired for the first time. Shape 1 from the filing (fold the deploy into ci as a job) — the "no new machinery" option.

What landed — commit 55dc7da2:

  • ci.yml gains a deploy-broker job — needs: publish-broker, runs-on: elitebook-03 (the admin-mesh peer, #745/GOTCHAS #90 — matou-workstation cannot reach the broker droplet's mesh), gated if: github.event_name == 'push' && github.ref == 'refs/heads/main' && needs.publish-broker.outputs.published == '1'. It rides the same push that published the binary — no cross-workflow event.
  • publish-broker exposes a new published output — 0 by default (written before any early exit), 1 only after every upload for github.sha succeeds. deploy-broker gates on it rather than re-probing the registry, so a docs-only push / PR / manual ci run never deploys, and a sha that was never built is never installed. A failed publish-broker skips the deploy via needs.
  • broker-deploy.yml loses its dead workflow_run trigger and keeps workflow_dispatch as the manual/rollback door (now refusing an unpublished sha loud instead of silently skipping — the automatic no-op path lives in the published gate).

Why workflow_run had to go, not be fixed: confirmed structurally — broker-deploy.yml was the only workflow declaring workflow_run, matching the filing's workflow_run tally of 0 (per the correction comment above, the run count is 5 — four claimed + waiting run 23170 — every one a manual workflow_dispatch, not "four ever"; the zero workflow_run events stands). This Forgejo (15.0.5+gitea-1.22.0) does not fire the event at all, and it also silently un-registers the events it does support (see ci.yml's header, #871/#878). A rail built on the one trigger it fires zero of can never self-heal. The fold depends on workflow_run not at all, so it is strictly more robust regardless of the exact count.

Proof (two-way door, provable offline): scripts/tests/broker-deploy-trigger-test.sh — red before this change (FAIL: ci.yml has no deploy-broker job), green after (9 checks). It asserts the fold (job exists, needs publish-broker, runs on elitebook-03, gates on published==1 + push-to-main, publish-broker sets published 0/1) and the class rule that no workflow may carry a workflow_run trigger. It is swept by ci via the #873 loop, so a regression reddens main. Both workflow YAMLs re-parse; the full scripts/tests/*.sh sweep (25 files) is green. Documented as GOTCHAS #96; STATUS header updated.

Acceptance — "a broker-touching push to main results in the live broker running that sha, with no human in the loop, and something red if it does not": the trigger is now automatic and rides every broker push; a failed install reds deploy-broker (the installer's rollback discipline means a red never touches the live broker). The live-install landing is untouched here — it remains #872's residue (the stale hand-placed droplet-side installer that SIGPIPE-rejects genuine brokers); until #872 lands, deploy-broker will red on a real broker push exactly as broker-deploy 23170 did, which is the correct "something red if it does not". This ticket is about whether the rail ever fires; #872 is about what it installs.

On the ~18:52Z dispatch aside: the fix makes it moot — deploys now ride pushes, not hand dispatches. Re-checking a workflow_dispatch POST's response code before concluding a deploy was attempted stays good practice (a non-2xx creates nothing); noted in GOTCHAS #96.

Closing.

**Close-report — ruled by agent under ADR 0174 (veto anytime; two-way door).** The broker rail's automatic trigger is wired for the first time. Shape 1 from the filing (fold the deploy into `ci` as a job) — the "no new machinery" option. **What landed** — commit `55dc7da2`: - **`ci.yml` gains a `deploy-broker` job** — `needs: publish-broker`, `runs-on: elitebook-03` (the admin-mesh peer, #745/GOTCHAS #90 — `matou-workstation` cannot reach the broker droplet's mesh), gated `if: github.event_name == 'push' && github.ref == 'refs/heads/main' && needs.publish-broker.outputs.published == '1'`. It rides the **same push** that published the binary — no cross-workflow event. - **`publish-broker` exposes a new `published` output** — `0` by default (written before any early exit), `1` only after every upload for `github.sha` succeeds. `deploy-broker` gates on it rather than re-probing the registry, so a docs-only push / PR / manual `ci` run never deploys, and a sha that was never built is never installed. A failed `publish-broker` skips the deploy via `needs`. - **`broker-deploy.yml` loses its dead `workflow_run` trigger** and keeps `workflow_dispatch` as the manual/rollback door (now *refusing an unpublished sha loud* instead of silently skipping — the automatic no-op path lives in the `published` gate). **Why `workflow_run` had to go, not be fixed:** confirmed structurally — `broker-deploy.yml` was the **only** workflow declaring `workflow_run`, matching the filing's `workflow_run` tally of **0** (per the correction comment above, the run count is 5 — four claimed + waiting run 23170 — every one a manual `workflow_dispatch`, not "four ever"; the zero `workflow_run` events stands). This Forgejo (`15.0.5+gitea-1.22.0`) does not fire the event at all, and it *also* silently un-registers the events it does support (see `ci.yml`'s header, #871/#878). A rail built on the one trigger it fires zero of can never self-heal. The fold depends on `workflow_run` not at all, so it is strictly more robust regardless of the exact count. **Proof (two-way door, provable offline):** `scripts/tests/broker-deploy-trigger-test.sh` — **red before this change** (`FAIL: ci.yml has no deploy-broker job`), **green after** (9 checks). It asserts the fold (job exists, `needs` publish-broker, runs on elitebook-03, gates on `published==1` + push-to-main, publish-broker sets `published` 0/1) **and the class rule that no workflow may carry a `workflow_run` trigger**. It is swept by `ci` via the #873 loop, so a regression reddens `main`. Both workflow YAMLs re-parse; the full `scripts/tests/*.sh` sweep (25 files) is green. Documented as **GOTCHAS #96**; STATUS header updated. **Acceptance** — "a broker-touching push to `main` results in the live broker running that sha, with no human in the loop, and something red if it does not": the trigger is now automatic and rides every broker push; a failed install reds `deploy-broker` (the installer's rollback discipline means a red never touches the live broker). The **live-install landing is untouched here** — it remains #872's residue (the stale hand-placed droplet-side installer that SIGPIPE-rejects genuine brokers); until #872 lands, `deploy-broker` will red on a real broker push exactly as `broker-deploy` 23170 did, which is the correct "something red if it does not". This ticket is about whether the rail *ever fires*; #872 is about what it installs. **On the ~18:52Z dispatch aside:** the fix makes it moot — deploys now ride pushes, not hand dispatches. Re-checking a `workflow_dispatch` POST's response code before concluding a deploy was attempted stays good practice (a non-2xx creates nothing); noted in GOTCHAS #96. Closing.
matou-build-agent 2026-08-26 23:00:24 +00:00
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/idss#874
No description provided.