Run the backlog merge canary
The backlog merge ladder takes a delivered item from review to a merged pull
request: the audit passes and writes the green marker
(backlog.awaiting_human_merge), a person drags the card to Done, and the
merge gate merges on the forge (backlog.completed) or reports that it could not
(backlog.merge_unavailable). The stage canary runs this ladder every night on a
fixture repository, so a defect shows up there and not on production work.
What runs every night
Section titled “What runs every night”The stage-backlog-canary workflow (.forgejo/workflows/stage-backlog-canary.yml)
has its recurring trigger paused by the owner (2026-10-14). Manual dispatch of
scripts/ci/backlog_merge_canary.py nightly logs in to stage as the canary
member and does the following:
- Drives the ladder. For every card in In review that shows the green
marker, it drags the card to Done once. The fixture repository’s
mainbranch requires one approval, so the forge refuses the merge and the gate recordsbacklog.merge_unavailable. The script then approves the pull request as the fixture reviewer and drags the card again, and the merge completes (backlog.completed). A first drag that merges immediately is reported asprotection_missingand fails the run. - Asserts the markers. It reads the canary workspace’s audit trail and
fails unless the last 24 hours hold at least one
backlog.awaiting_human_merge, onebacklog.merge_unavailableand onebacklog.completedrow for the canary project. Review rounds (backlog.return_to_sender,backlog.review_failed,backlog.awaiting_reverify,backlog.reverify_recorded) are counted in the summary but not required, because a fixture cannot force a failed first review. - Files the next fixture issue. Unless a
[canary]issue is still open, it opens one on the fixture repository and imports it into the backlog, so the next night has a delivered item to drive.
A failed run is the alert. The bw-infra Grafana rule on the same markers alerts independently when the canary shows no green marker and no completed merge for 24 hours.
The release gate
Section titled “The release gate”Do not switch the backlog loop on for a production project until the canary has
been green for 7 consecutive days. To check, dispatch the workflow on main with
check set to release-gate. It exits successfully only when each of the last
seven 24-hour windows holds all three markers, and the job summary lists each
window with the markers it lacked.
Set up the canary
Section titled “Set up the canary”The canary needs this setup once. These are operator steps on the forge and on stage:
- Fixture repository on the forge, with branch protection on
mainthat requires one approval, and an approval allowlist that contains only the fixture reviewer account. The Forgejo credential of the SupaCloud project must belong to another account, so the merge gate cannot approve its own pull request. - Canary workspace on stage that holds only the canary project, with the
audit_log_workspacefeature. The canary project uses the fixture repository, has the backlog automation on with thepr_onlymerge policy and an explicit project autonomy level of 50, and has no required CI status checks. - Canary member: a password account without two-factor authentication. It is an admin of the canary workspace, because the audit log is admin-only.
- Repository variables:
BACKLOG_CANARY_SUPACLOUD_URL,BACKLOG_CANARY_WORKSPACE_ID,BACKLOG_CANARY_PROJECT_ID,BACKLOG_CANARY_FORGEJO_REPO(owner/name). - Repository secrets:
BACKLOG_CANARY_MEMBER_EMAIL,BACKLOG_CANARY_MEMBER_PASSWORD,BACKLOG_CANARY_REVIEWER_TOKEN(a token of the fixture reviewer with repository write access).
Test the script
Section titled “Test the script”python3 -S -m unittest scripts/ci/backlog_merge_canary_test.pyThe tests fake the transport, so they need no stage access.