feat(features,service,desktop): a GitHub-event trigger chooses whose events fire it, at which moments, and whether drafts and forks do
Merged
DA
3d ago+686+686+012345678901234567890123456789-103-103-012345678901234567890123456789
Dean approved merging this ahead of #2781 (which stays on hold), so the code review bot can be tried end to end against production. Built on #2837's Settings rows.
Summary
Dean: "it should all be configurable in the review bot." So the trigger decisions are no longer hard-coded rules. They're settings of any GitHub-event trigger, shown as rows of the editor's Trigger card under the Event row. Each choice is a SwitchRow, the way Settings lists several switches, and the Type row's detail is the trigger's sentence. The Code review preset (#2781) sets the recommended values; any other GitHub automation can use them too. There's no review-specific code here.
| Setting | Values | Default where a trigger names none | Code review preset |
|---|---|---|---|
From (senders): switches From people, From Luke's agents, From other bots | People · Luke's agents (luke[bot]) · Other bots (Dependabot, Renovate, every other app) | People | People ✓, Luke's agents ✓, Other bots ☐ |
On (moments, pull-request-updated only): switches When opened, When marked ready, When pushed to | Opened · Ready for review · New pushes | all three | all three ✓ |
Skip drafts (drafts: false) | switch | skipped | skipped ✓ |
Include forks (forks) | switch | off | off ✓ |
- Whose event it is. Each delivery is read with its sender:
- Luke's agents, where the sender is the App's own bot (
<slug>[bot], from the newGitHubApp.botLogin); - another bot (
type: Bot); - or a person.
- Luke's agents, where the sender is the App's own bot (
- Pull requests are also read with their moment (opened/reopened,
ready_for_review,synchronize), whether they're a draft, and whether they come from a fork (head in another repository, or in none).triggerMatchesapplies the trigger's settings. - One rule no setting overrides: a push by Luke's agents, to a pull request or a branch, fires nothing, so an agent answering its own run with a push can't loop. The When pushed to row says so in its detail. A failed check on a
luke/branch still fires nothing, as before. - Defaults keep today's behavior for existing triggers: people only, as before (bots never fired). Two defaults change on purpose:
- drafts are now skipped for every pull request event, where before only
pull-request-updatedskipped them; - forks are new and off, because the run's agent holds a write token.
- No GitHub automation exists in production yet; the editor shipped today.
- drafts are now skipped for every pull request event, where before only
- The sentence names the settings: "When a pull request by people or Luke's agents is opened, marked ready, or pushed to in acme/ledger". With everything on: "… by anyone is opened or marked ready in … , drafts and forks included". Issues read "by people", and a check names no sender.
packages/service/README.mdsays all of this.
Evidence
- Platform-independent checks:
pnpm check:affectedpasses. - New tests, each failing without the change:
github-webhook-app.test.ts: two triggers with different settings get eight deliveries (a person opening, marking ready, and pushing;luke[bot]opening and pushing; Dependabot opening; a draft; a fork's PR). The test checks exactly which trigger hears each, and thatluke[bot]'s push fires neither.automation-list-model.test.ts: the sentences with senders, moments, drafts, and forks, and a check's.automation-draft-model.test.ts: a trigger naming no settings opens on the defaults and saves nothing; a changed setting is a change of the trigger; no sender is a problem.automations-page.test.ts: turning on From Luke's agents rewrites the Type row's sentence and creates the trigger with the settings; the list row says the same sentence.
- Changed: the earlier updates test now expects a draft to fire neither automation (drafts are skipped for every PR event by default), and its fixtures carry
sender.loginandhead.repo, as GitHub always sends them.
Invariants
-
./scripts/check.shgreen. (CI) - JSON Schema goldens unchanged.
- Every behavior change has, in this PR, the test that fails without it.
- Gateway envelope goldens unchanged.
- No new
asassertion, run outside the edges, raw async primitive, or dropped Effect. - No hand-rolled file replaced.
-
PRIVACY.mdunchanged. - Package deps unchanged.
Notes
- Mac: this is a UI PR, and CI could not verify the Mac UI.
- The Event row's detail no longer says Luke's agents' events and drafts start nothing, because both are now settings.
🤖 Generated with Claude Code