Skip to main content

Module release_watch

Module release_watch 

Source
Expand description

Watches every open release-bump pull request until it lands.

crate::bump opens a chore/release-vX.Y.Z pull request with auto-merge armed and then stops looking. A required check that goes red (a flaky windows or browser job) leaves auto-merge waiting forever, and nothing pages anybody because the notices there only fire when the pull request cannot be opened. This module is the part that keeps looking.

It runs inside magi serve as its own task, like crate::waiter, and is tied to no run: a pending bump is coalesced across runs and outlives the one that opened it. The forge is the source of truth (every open pull request whose head branch starts with chore/release-v, in every checkout magi knows); the pending marker is not consulted, so a missing one changes nothing.

  • The decision is pure. [decide] maps a checks snapshot and the recorded [WatchState] to one [Step]. A forge answer that cannot be read is Unknown: nothing moves, not even the stall clock.
  • A failed run is rerun once, durably. The run id is written to the state file before gh run rerun <id> --failed is called, so a restart never reruns twice; if the call then fails, the cost is one escalation to a human, never a rerun loop.
  • Escalation is a notice plus a question (crate::bump::NOTICE_NODE, no cwd, no run). Nothing is ever merged, closed or pushed: the watcher only reruns jobs. Silence is a hold. The owner’s choice is applied by the watcher itself on its next lap, recorded in WatchState::applied so an answer is applied once.
  • [release] mode = "local" replaces all of the above for that repository’s release pull requests. No check is awaited, reran or stalled on. The watcher asks the owner (merge / hold, bound to the head it observed), merges with --match-head-commit, and after the merge drives crate::release_local - tag, then the configured commands - with its progress in the watch record. A failure is a notice and a question (retry / leave it), never a blind retry. See [decide_local].
  • Notice wording is fixed per stage and carries only the pull request, so a repeated poll never relights it; everything that varies (job names, links) rides in the question.

Constants§

HOLD
Choice: stay quiet until a check or the head changes.
LEAVE_IT
Choice: stop watching this pull request.
RERUN_AGAIN
Choice: rerun the failed jobs once more. The three choices are matched verbatim when applied.
RETRY
Choice (local mode): run the failed release again from where it stopped.