A second build dispatch fails the queued one: kit build N+1 != N (whakatohea-demo builds 8/9) #166

Closed
opened 2026-09-27 15:51:20 +00:00 by ben · 1 comment
Owner

Symptom (whakatohea-demo, 2026-09-25)

rebuild whakatohea-demo dispatched build 8 at 19:14Z. At 19:24Z a second dispatch made build 9, from an unknown source (a second rebuild, or IDSS's community-app card try again). The only coa-builds runner (bens-mac-04, one job at a time) picked up build 8 at 19:40Z. It failed in 7 s at prepare: ::error::kit build 9 != 8 (coa-builds run 21). Build 9 (run 22) then succeeded. Nothing was lost, but the failure callback reported a real-looking failure for build 8, and a steward watching the build sees red.

Cause

startBuild (server/src/build-pipeline.ts) computes build = status.build + 1, rewrites communities/<slug>/kit.json with the new number, dispatches, and sets state: building. It does not check whether a build is already queued or running. The runner fetches kit.json at run time and refuses a mismatch (coa-builds scripts/forgejo/coa-build.sh: kit build $kbuild != $BUILD). So any second dispatch before the first run's prepare stage makes the first run fail. With one runner and ~20 min builds, that window is wide.

Want (pick one; proposed default: 1)

  1. Refuse a rebuild while one is in flight. When status.state === 'building', startBuild/rebuild return the in-flight build number (as rebuild already does when it reads building back) and dispatch nothing. The operator page and the IDSS card show "building (build N)". Add a staleness escape: a building older than, say, 2 h may be superseded.
  2. Supersede quietly. Keep dispatching, but a run whose kit number moved on exits as superseded, not failure (a distinct callback outcome that does not flip status or show red).

Either way: a regression test for two dispatches in a row that leaves exactly one build that can succeed, with no failure recorded for the other.

Also worth knowing: who dispatched build 9. Check the server log or /api/submit and the build-trigger callers for 19:24Z.

🤖 Generated with Claude Code

## Symptom (whakatohea-demo, 2026-09-25) `rebuild whakatohea-demo` dispatched **build 8** at 19:14Z. At 19:24Z a second dispatch made **build 9**, from an unknown source (a second rebuild, or IDSS's community-app card *try again*). The only coa-builds runner (`bens-mac-04`, one job at a time) picked up build 8 at 19:40Z. It failed in 7 s at prepare: `::error::kit build 9 != 8` (coa-builds run 21). Build 9 (run 22) then succeeded. Nothing was lost, but the failure callback reported a real-looking failure for build 8, and a steward watching the build sees red. ## Cause `startBuild` (`server/src/build-pipeline.ts`) computes `build = status.build + 1`, **rewrites `communities/<slug>/kit.json` with the new number**, dispatches, and sets `state: building`. It does not check whether a build is already queued or running. The runner fetches `kit.json` at run time and refuses a mismatch (`coa-builds scripts/forgejo/coa-build.sh`: `kit build $kbuild != $BUILD`). So any second dispatch before the first run's prepare stage makes the first run fail. With one runner and ~20 min builds, that window is wide. ## Want (pick one; proposed default: 1) 1. **Refuse a rebuild while one is in flight.** When `status.state === 'building'`, `startBuild`/`rebuild` return the in-flight build number (as `rebuild` already does when it reads `building` back) and dispatch nothing. The operator page and the IDSS card show "building (build N)". Add a staleness escape: a `building` older than, say, 2 h may be superseded. 2. **Supersede quietly.** Keep dispatching, but a run whose kit number moved on exits as **superseded**, not failure (a distinct callback outcome that does not flip status or show red). Either way: a regression test for two dispatches in a row that leaves exactly one build that can succeed, with no failure recorded for the other. Also worth knowing: who dispatched build 9. Check the server log or `/api/submit` and the build-trigger callers for 19:24Z. 🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

swarm-claim host=matou-dev-server-01 run=12429 (automated multi-host claim — lowest live claim id works this ticket)
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/coa#166
No description provided.