Skip to content

Commit 28c25f3

Browse files
ci: add silent-close shim to altimate-qa watchdog (#1930)
Cross-repo notification shim that fires a `repository_dispatch` to AltimateAI/altimate-qa whenever a PR closes here, so the silent-close watchdog can react in seconds instead of waiting up to 5 minutes for its cron tick. What this is ------------ - Triggers on `pull_request: closed` events. - Sends `event_type=pr-closed` with `{repo, pr_number, closed_by, was_merged, title}` payload to AltimateAI/altimate-qa. - Self-disables (warning, exit 0) if `AUTOPILOT_DISPATCH_TOKEN` is not set on this repo. Never fails the PR. Why --- Reference incident: 2026-04-29 12:24 UTC silent bulk-close (47 PRs in 90s, 6 fix PRs lost). The watchdog already existed but ran on a 5-min cron — up to 5 minutes of fix-PR loss before the reopener fired. This shim closes that gap to ~20s end-to-end. The receiving end is altimate-qa PR #366 (feat/silent-close-webhook-shims): adds a `repository_dispatch` trigger to silent-close-watchdog.yml and a `--single-pr` fast path in the reopener script. Setup needed ------------ After merge: add `AUTOPILOT_DISPATCH_TOKEN` (PAT or App token with `repo` scope on AltimateAI/altimate-qa) to this repo's Actions secrets at github.com/AltimateAI/<repo>/settings/secrets/actions. Until that's done the workflow runs but exits early — no harm. Test plan --------- - [ ] After merge + secret set: force-close a test PR here, observe a dispatch run on altimate-qa within ~20s - [ ] Confirm the cron sweep on altimate-qa still runs (5-min schedule unchanged) so partial rollouts don't break detection Reference: AltimateAI/altimate-qa templates/cross-repo-shims/README.md Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent d8ebb4e commit 28c25f3

1 file changed

Lines changed: 67 additions & 0 deletions

File tree

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Silent-Close Shim → altimate-qa watchdog
2+
3+
# Cross-repo notification shim for the silent-close watchdog living in
4+
# AltimateAI/altimate-qa. Fires a `repository_dispatch` to altimate-qa
5+
# the moment a PR closes here, so the watchdog can react in seconds
6+
# instead of waiting for its 5-minute cron tick.
7+
#
8+
# This file is THE canonical version. To onboard a new repo, copy this
9+
# file verbatim to `.github/workflows/silent-close-shim.yml` in the new
10+
# repo and add the `AUTOPILOT_DISPATCH_TOKEN` secret to that repo's
11+
# Actions settings (must be a PAT or App token with `repo` scope on
12+
# AltimateAI/altimate-qa so the dispatch endpoint accepts the call).
13+
#
14+
# Reference: docs/specs/2026-05-01-closed-by-attribution-standard.md
15+
# Reference incident: 2026-04-29 12:24 UTC silent bulk-close (47 PRs).
16+
17+
on:
18+
pull_request:
19+
types: [closed]
20+
21+
permissions:
22+
contents: read
23+
pull-requests: read
24+
25+
concurrency:
26+
group: silent-close-shim-${{ github.event.pull_request.number }}
27+
cancel-in-progress: false
28+
29+
jobs:
30+
notify:
31+
name: Notify altimate-qa watchdog
32+
runs-on: ubuntu-latest
33+
timeout-minutes: 2
34+
steps:
35+
- name: Send repository_dispatch
36+
env:
37+
GH_TOKEN: ${{ secrets.AUTOPILOT_DISPATCH_TOKEN }}
38+
REPO: ${{ github.repository }}
39+
PR_NUM: ${{ github.event.pull_request.number }}
40+
CLOSED_BY: ${{ github.event.sender.login }}
41+
WAS_MERGED: ${{ github.event.pull_request.merged }}
42+
PR_TITLE: ${{ github.event.pull_request.title }}
43+
run: |
44+
if [ -z "${GH_TOKEN}" ]; then
45+
echo "::warning::AUTOPILOT_DISPATCH_TOKEN not set — shim disabled for ${REPO}#${PR_NUM}"
46+
exit 0
47+
fi
48+
49+
payload=$(jq -n \
50+
--arg repo "$REPO" \
51+
--argjson pr_number "$PR_NUM" \
52+
--arg closed_by "$CLOSED_BY" \
53+
--argjson was_merged "${WAS_MERGED:-false}" \
54+
--arg title "$PR_TITLE" \
55+
'{event_type: "pr-closed",
56+
client_payload: {
57+
repo: $repo,
58+
pr_number: $pr_number,
59+
closed_by: $closed_by,
60+
was_merged: $was_merged,
61+
title: $title
62+
}}')
63+
64+
echo "$payload" | gh api repos/AltimateAI/altimate-qa/dispatches \
65+
--input - \
66+
&& echo "Dispatched: ${REPO}#${PR_NUM} closed_by=${CLOSED_BY} merged=${WAS_MERGED:-false}" \
67+
|| echo "::warning::Dispatch failed for ${REPO}#${PR_NUM}"

0 commit comments

Comments
 (0)