Repository navigation
Add Aspire Bot: self-maintaining repo loop with layered kill switches - #2208
Conversation
Adds gh-aw agentic workflows (triage, dependency steward, CI doctor, PR reviewer, PR fixer, improver, weekly retro) that write only through safe outputs under the Aspire Bot GitHub App, plus a deterministic control plane that merges low-risk bot and Dependabot PRs with a SHA-pinned squash merge after a SHA-bound review verdict and a green CI Gate. The ASPIRE_BOT_MODE repository variable (active | paused | stopped; unset means stopped) controls the whole loop. Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
The repository already stores ASPIRE_BOT_APP_ID as a secret, next to ASPIRE_BOT_PRIVATE_KEY, but the workflows read vars.ASPIRE_BOT_APP_ID. That variable doesn't exist, so minting the App token would fail once ASPIRE_BOT_MODE is paused or active. Read secrets.ASPIRE_BOT_APP_ID instead and recompile the gh-aw lock files with gh-aw v1.2.2. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved critical findings allow automatic merges to bypass control-plane safeguards, classify unsafe changes as low risk, and expose repository-scoped App credentials to unmerged workflow code.
10 open issues
Reject moved or reordered non-version workflow lines · New Validate dependency sources from the lockfile at the head SHA · New Block merges while the human-review label is present · New Refresh PR eligibility immediately before merging · New Recheck repository mode before every merge · New Exclude bot PRs and disable existing auto-merge · New Restrict credentialed dispatches to the default branch · New Count every fixer run, including failed attempts · New Enforce PR eligibility at manual and publish boundaries · New Serialize publication across all PR-producing workflows · New
What changed in this PR
Introduces Aspire Bot, a repository-maintenance loop combining seven agent workflows with a deterministic merge controller. ASPIRE_BOT_MODE controls rollout, and Dependabot PRs stop receiving automatic merge enrollment.
Changes:
- Adds agents for triage, dependency maintenance, CI diagnosis, PR review and repair, improvements, and weekly retrospectives.
- Adds risk classification, SHA-bound review validation, pinned merge requests, a status dashboard, and control-plane tests.
- Adds setup guidance and generated-workflow handling for Dependabot and GitHub’s diff display.
| File | Description |
|---|---|
.github/workflows/shared/aspire-bot.md |
Shared credentials, rules, PR format, and review verdict format. |
.github/workflows/aspire-bot-triage.md |
Classifies issues and requests missing information. |
.github/workflows/aspire-bot-selftest.yml |
Runs policy validation and control-plane tests. |
.github/workflows/aspire-bot-retro.md |
Produces weekly reports and workflow-improvement PRs. |
.github/workflows/aspire-bot-pr-reviewer.md |
Defines PR reviews with SHA-bound verdicts. |
.github/workflows/aspire-bot-pr-reviewer.lock.yml |
Compiled reviewer workflow and output handling. |
.github/workflows/aspire-bot-pr-fixer.md |
Defines follow-up fixes for failing bot PRs. |
.github/workflows/aspire-bot-improver.md |
Defines approved-issue, documentation, and test improvements. |
.github/workflows/aspire-bot-dependency-steward.md |
Proposes fixes for dependency and scanning alerts. |
.github/workflows/aspire-bot-control.yml |
Schedules and authenticates deterministic reconciliation. |
.github/workflows/aspire-bot-ci-doctor.md |
Diagnoses main-branch CI failures. |
.github/skills/agentic-workflows/SKILL.md |
Adds routing guidance for gh-aw development tasks. |
.github/policies/label-prs.yml |
Stops adding auto-merge to Dependabot PRs. |
.github/policies/auto-merge.yml |
Updates descriptive text; executable rules remain unchanged. |
.github/dependabot.yml |
Excludes generated workflow locks from action updates. |
.github/aw/actions-lock.json |
Pins gh-aw setup actions. |
.github/aspire-bot/scripts/test_aspire_bot.py |
Tests classification, modes, verdicts, and merge decisions. |
.github/aspire-bot/scripts/aspire_bot.py |
Implements reconciliation, merge decisions, and status reporting. |
.github/aspire-bot/README.md |
Documents architecture, rollout, and operations. |
.github/aspire-bot/policy.json |
Defines risk rules, labels, limits, and verdict syntax. |
.github/agents/agentic-workflows.md |
Adds a gh-aw development assistant definition. |
.gitattributes |
Marks workflow lockfiles as generated. |
Review effort: Balanced
Kill switches: - An aspire-bot:stop label on any open issue or PR stops every agent before activation and blocks all merges. Anyone with triage access can add it. - ASPIRE_BOT_MERGE must be `enabled` for any merge, on top of ASPIRE_BOT_MODE. - Circuit breaker: the control plane adds aspire-bot:stop to the status issue when CI fails on main after an Aspire Bot merge, or when 10 automated PRs merge in 24 hours. - The App credentials move to the aspire-bot environment, restricted to main, so runs started from other branches can't reach them. Review feedback: - Compare version-only lines in order within each change block. - Parse npm lockfiles at the merge base and head; added or changed packages must resolve from registry.npmjs.org. - needs-human-review blocks merges. - Merge in a separate job that re-reads the mode and merge switch, checks the stop label, and re-validates each PR right before merging. - The auto-merge policy skips aspire-bot and dependencies PRs, and the control plane disables GitHub auto-merge on them. - Count every fixer run as an attempt, and check manual fixer runs before activation. - Run the PR-producing workflows in one queue and recount open PRs right before publishing. Also fix the yarn.lock source pattern, which flagged registry URLs, and decode gh output as UTF-8. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Declare on.permissions (issues and pull-requests read, plus contents read for the fixer's eligibility check) so the pre-activation job can read labels explicitly. Before, its token had no permissions, and the check relied on public-repo reads; if that read failed, agents would silently never run. Raise maxAutoMergesPerDay from 10 to 50. Over the last six months, Dependabot PRs merged up to 36 times in 24 hours, and at least 8 calendar days had 10 or more, so a limit of 10 would have stopped the whole bot most weeks. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
- policy.json: small sample-code fixes (5 files, 100 lines) are medium risk on Aspire Bot PRs whose every push came from Aspire Bot (repository activity log). Tests, scripts, Dockerfiles, package-source configs, build wrappers, and MSBuild imports stay high. - Control plane: classify medium, label tier-medium, verify push provenance, and while CI fails on main, flag aspire-bot:ci-failure items with needs-human-review and comment once per failing commit on the status issue. - Reviewer and fixer skip before the agent starts when there is no work. - CI doctor PRs carry aspire-bot:ci-failure. - Reviewer prompt: reject fixes that weaken checks, since its approval now gates sample code. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The main ruleset requires one approval. Instead of making the App a bypass actor, the control plane adds aspire-bot:merge-ready to an eligible PR, and a new GitOps rule (.github/policies/aspire-bot.yml) approves it, but only when the Aspire Bot App (aspire-repo-bot) adds the label. The control plane merges only when that approval is on the validated head SHA, and dismisses policy approvals and removes the label when the PR changes or stops being eligible, since the ruleset doesn't dismiss stale approvals. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
James Newton-King (JamesNK)
left a comment
There was a problem hiding this comment.
All 37 control-plane fixture tests passed locally in an offline container at this commit. No live App, repository actions, or merge workflows were exercised.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Adam Ratzman (adamint)
left a comment
There was a problem hiding this comment.
Approved at 4cc5f5e: merge-boundary CI/verdict rechecks added, all CI green, all threads resolved.


Agent assessment
Self-reported assessment, not an independent review.
Assessed revision:
c8961c69bc7c61d30a57b177201c12abdba7cab7↑
gh aw compile --strictsucceeds; the only warning (cache-poisoning on CI doctor) predates this change.↑ Full reconcile dry run against this repo classifies all 11 Dependabot PRs as before.
↓ The activity log actor for App pushes is assumed to be the App's bot login; unverified until the first bot PR.
↓ The fixer gate's positive path wasn't exercised live (no
aspire-botPRs exist yet).↑ No ruleset bypass: a live dry run labels an eligible Dependabot PR
merge-readyand dismisses a stale policy approval left on an older commit.↓ The policy service's
isActivitySendermatch onaspire-repo-botand the ruleset'srequire_extra_approval_for_unattributed_changesare unverified until the first live merge.↓ CI on this revision is pending.
Aspire Bot: a self-maintaining loop with layered kill switches
This makes
aspire-samplesmaintain itself. Agents find work, open PRs, review them, fix them, merge the low- and medium-risk ones, and run a weekly retro to improve themselves. Humans stay in control through layered kill switches, and each one stops the bot on its own:aspire-bot:stoplabel on any open issue or PRASPIRE_BOT_MODEvariablestoppedor unset.pausedpreviews writes and merges nothing.ASPIRE_BOT_MERGEvariableenabledaspire-bot:stopwhen CI fails onmainafter an Aspire Bot merge, or when 50 automated PRs merge in 24 hours (Dependabot peaked at 36 in the last six months).aspire-bot:holdorneeds-human-reviewflowchart LR Signals[Issues, alerts, Dependabot PRs, CI failures] --> Agents[gh-aw agents<br/>safe outputs only] Agents -->|PR| Reviewer[PR reviewer<br/>SHA-bound verdict] Reviewer -->|request-changes| Fixer[PR fixer] --> Reviewer Reviewer --> Gate[Deterministic control plane<br/>policy.json risk tiers] Gate -->|low or medium risk, approved, CI Gate green,<br/>every switch allows it| Merge[Merge job: re-validate, then<br/>squash merge pinned to head SHA] Gate -->|high risk, 3 failed fixes,<br/>or CI failing on main| Human[needs-human-review] Gate -->|main broke after a bot merge,<br/>or too many merges| Stop[aspire-bot:stop]What's included
.github/aspire-bot/,aspire-bot-control.yml): deterministic Python with unit tests. It runs only from the default branch. It classifies risk frompolicy.json, verifies the reviewer's verdict against the head SHA, disarms GitHub auto-merge on bot and Dependabot PRs, and maintains the Aspire Bot status issue. Merges run in a separate job. GitHub reads repository variables when each job starts, so that job sees mode and merge switch changes made mid-run. It checks the stop label, re-reads each PR, and merges withPUT /pulls/N/mergeandsha=<validated head>, so a later push makes GitHub refuse the merge.strict: true). Each one checks the stop label before it activates:aspire-bot:approved, enforced by gh-aw integrity filtering)registry.npmjs.org.label-prs.ymlno longer addsauto-mergeto Dependabot PRs; the control plane merges them instead.auto-merge.ymlskips PRs labeledaspire-botordependencies.dependabot.ymlskips the generated*.lock.ymlfiles.Security review notes
ASPIRE_BOT_APP_IDandASPIRE_BOT_PRIVATE_KEY, as secrets of the newaspire-botenvironment. They're used only byactions/create-github-app-token(SHA-pinned v3.3.0) in the control plane and the gh-aw-generated jobs, and gh-aw redacts both from logs.main: every job that uses them declares theaspire-botenvironment (deployment: false), and the environment only allowsmain. A run started from any other branch, including a manually dispatched modified agent, can't reach them.auto-mergeoraspire-bot:stop. PR and push outputs are restricted byallowed-files(samples, tests, and version pins inci.yml). Only the retro can touchaspire-bot-*workflows, and its PRs are always high risk.main: nothing merges until it passes. The control plane addsneeds-human-reviewto openaspire-bot:ci-failureissues and PRs (the CI doctor labels both), and comments on the status issue once per failing commit.github/gh-aw-actions/setup@v1.2.2(pinned in.github/aw/actions-lock.json). The stop-label check usesactions/github-scriptv9.0.0 at the SHA gh-aw already pins.mainruleset requires one approval, and Aspire Bot can't approve its own PRs. When a PR passes every check, the control plane addsaspire-bot:merge-ready, and a new GitOps rule (.github/policies/aspire-bot.yml) approves it. The rule fires only when theaspire-repo-botApp adds the label, and it never enables auto-merge. The control plane merges only if that approval is on the validated head SHA. When the PR changes or stops being eligible, it dismisses the approval and removes the label, because the ruleset doesn't dismiss stale approvals. Classic branch protection still requires CI Gate.Behavior change
After this merges, Dependabot PRs are no longer merged automatically until
ASPIRE_BOT_MODEisactiveandASPIRE_BOT_MERGEisenabled. Even with the mode unset, the control plane removes the oldauto-mergelabel and disables GitHub auto-merge on open Dependabot PRs.Rollout
Before merging, a repository admin:
aspire-botenvironment with deployment branches limited tomain, addsASPIRE_BOT_APP_IDandASPIRE_BOT_PRIVATE_KEYas environment secrets, and deletes the repository secrets with those names.Then:
ASPIRE_BOT_MODEunset. Agents skip, and nothing merges.ASPIRE_BOT_MODE=paused, then review the staged previews and the status issue.ASPIRE_BOT_MODE=active. Agents open, review, and fix PRs, and maintainers merge them.ASPIRE_BOT_MERGE=enabled.See
.github/aspire-bot/README.mdfor the full design and runbook.Validation
gh aw compile --strict: all 7 workflows compile, and recompiling changes nothing.issues: readandpull-requests: readfor the stop-label check.ASPIRE_BOT_MERGEunset.