Skip to content

fix(dispatch)!: cut stage checks per event from six to two and stop skipped ones hiding reviews - #9977

Draft
MichaelYochpaz wants to merge 1 commit into
fullsend-ai:mainfrom
MichaelYochpaz:consolidate-dispatch-checks
Draft

MichaelYochpaz wants to merge 1 commit into
fullsend-ai:mainfrom
MichaelYochpaz:consolidate-dispatch-checks

Conversation

@MichaelYochpaz

Copy link
Copy Markdown

Summary

Every Fullsend event adds six stage checks to a PR (Triage, Code, Review, Fix, Retro, Prioritize), but at most one of them does any work. This PR runs the built-in stages in two matrix jobs named after the routed stage, for example dispatch / Agent (review). That fixes two problems:

  • Fewer checks (Excessive PR checks are affecting usability #7677): each event shows 2 stage checks instead of 6. A no-op push shows 7 Fullsend checks instead of 11.
  • No more hidden reviews: GitHub shows only the newest check for each name. Today, a no-op event during a review (a push, a label change, an approval) replaces the running dispatch / Review with a skipped one. GitHub counts a skipped check as passing, so the PR can be merged before the review finishes. Now a run with nothing to do skips both jobs under their placeholder names, which never match a running check.

Related Issue

Related to #7677. It's closed, but the extra checks it describes are still there.

Changes

  • reusable-dispatch.yml: the six static stage jobs become two:

    • agent runs triage, review, retro and prioritize;
    • coder runs code and fix.

    It's two jobs, not one, so that only code and fix get contents: write and packages: read (ADR 0114). The matrix is built from Route's output in a single expression, the same way as harness-run. A literal list doesn't work, because the GitHub emulator expands it too early.

  • Steps and concurrency groups: unchanged. Each stage's steps are now gated on matrix.stage.

  • Review permissions: the review stage's job token no longer has pull-requests: write. Review writes with its minted App token, and the failure reporter only uses the issue-comment endpoints.

  • Behaviour drivers (GitHub and Forgejo): they match the new job names and still accept the old ones, so tests against workflows pinned to older versions keep working.

  • Docs and scaffold tests: updated. A new test checks that every built-in stage runs in exactly one job, with the expected permissions.

⚠️ Breaking change

The check names change from dispatch / Review to dispatch / Agent (review), and the same for the other stages (for example dispatch / Coder (fix)). Scripts that match the old names need updating.

Please don't make the new checks required. No check is created for a stage that intentionally doesn't run: fork PRs, reviews started only by /fs-review, and rebases that leave the diff unchanged. Requiring the old names never guaranteed that a review ran either, because a skipped check counted as passing. A stable review status is planned as a follow-up.

Testing

  • make lint passes (stage changes first, then run)
  • Tests added/updated for new or modified logic

Passed locally:

  • Go tests: internal/scaffold, pkg/behaviourtest/..., internal/forge/..., internal/harnessdispatch/..., internal/repos, internal/clipass;
  • go vet and the workflow-trigger tests;
  • the emulator's matrix-expansion and condition code, run against the new file for each of the six stages plus an empty one. Each stage ran once, in the right job.

Needs a maintainer's help: this repo's Fullsend workflow calls reusable-dispatch.yml@main, so Fullsend runs on this fork PR still use the old workflow, and the PR can't demonstrate the fix on itself. Could someone:

  1. approve the workflow runs;
  2. after reviewing, comment /ok-to-test <sha> live;
  3. if possible, help with a real-GitHub check before merge, for example by pushing this branch to the repo for a test PR? It should show that a no-op event during a review leaves Agent (review) running, and that review posts normally without pull-requests: write.

Heads-up: this overlaps with #7007, which pins the current stage jobs in a test. I'm happy to coordinate on which one lands first.

Checklist

  • PR title follows Conventional Commits (correct type, ! for breaking changes)
  • Commits are signed off (DCO) — human and human-directed agent sessions only
  • I wrote this contribution myself and can explain all changes in it

Every event created six static stage jobs (Triage, Code, Review, Fix,
Retro, Prioritize), at most one of which did any work. GitHub shows the
newest check per name on a pull request, so a no-op event's skipped
"Review" check replaced a review that was still running, and GitHub
counts a skipped check as passing.

Run the built-in stages in two stage-matrix jobs instead: agent (triage,
review, retro, prioritize) and coder (code and fix, which need
contents: write and packages: read per ADR 0114). Like harness-run, each
job builds its matrix from one expression over route's stage output, so
the routed stage becomes a one-entry matrix and the check is named after
it, for example "Agent (review)". A run that routes no stage skips both
jobs under their unexpanded placeholder names, which never match a
running check. Each event now shows two stage checks instead of six.

Stage steps are unchanged and gated on matrix.stage. Concurrency groups
keep their values. The agent job keeps the permissions triage, retro and
prioritize had, so the review stage's job token no longer has
pull-requests: write. Review writes to pull requests with its minted
App token, and failure comments are issue comments, which retro already
posts without that scope.

The behaviour drivers match the new job names and still accept the old
ones, so tests against workflows pinned to older versions keep finding
agent jobs. The GitHub driver treats a run as unresolved until the
stage-matrix job for a built-in agent is listed.

BREAKING CHANGE: The built-in stage checks are renamed from
"dispatch / Review" (and Triage, Code, Fix, Retro, Prioritize) to
"dispatch / Agent (review)" or "dispatch / Coder (fix)" style names.
Update scripts that match the old names. Do not make the new per-stage
checks required: no check is created for a stage that intentionally
does not run, such as a rebase that leaves the reviewed diff unchanged,
reviews triggered only by /fs-review, or fork pull requests. Requiring
the old names never guaranteed that a review ran, because a skipped
check counted as passing. A stable review status is planned separately.

Signed-off-by: Michael Yochpaz <myochpaz@redhat.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant