Skip to content

Event streaming (11/11): Support check suite events and suggest them from gh run view and gh run watch - #15081

Merged
BagToad merged 2 commits into
babakks/event-listen-deleted-subfrom
babakks/event-check-suite
Nov 17, 2026
Merged

BagToad merged 2 commits into
babakks/event-listen-deleted-subfrom
babakks/event-check-suite

Conversation

@babakks

@babakks babakks commented Nov 17, 2026

Copy link
Copy Markdown
Member

Layer 11 of 11 in the stack tracked by #15070.

Description

Agents asked to wait for the CI of a pull request tend to poll gh run watch or gh run view until the workflow runs finish. The event subscriptions API now sends com.github.pull_request.check_suite.status.changed.v1 when a check suite on the head commit of a pull request completes, with its data.conclusion (for example success or failure). A check suite is the group of checks from one source, such as one workflow run.

This change makes that event available in gh event listen and points agents at it:

  • gh event listen accepts the new event type, lists it in its help and shell completion, and has an example that waits for the next check suite and prints its conclusion. The help explains that a pull request usually has several check suites, each sending its own event, so waiting for all checks means reading them after each event.
  • When an agent runs gh run view or gh run watch on a workflow run that is not completed and belongs to a github.com pull request, the command prints a hint on stderr with the full gh event listen command for that pull request. It follows the existing hint printed by gh pr view and other pull request commands, with notes adapted to checks: read them with gh pr checks after each event, and run the listener again while any are pending. gh run watch prints it before it starts watching, so it is visible even if the watch is stopped. gh run view prints it with --json too, but not with --web or --log.
  • The gh run view and gh run watch help texts gain a paragraph saying that, to wait for the workflow runs of a github.com pull request, gh event listen with this event is the alternative to polling.
  • The gh agent skill and docs/event-listen-preview.md describe the new event and the run hints.

To share the hint layout, PrintListenHint in pkg/cmd/event/shared/hint.go now uses a private helper; its output is unchanged.

How did you test this change?

I built gh from this branch and recorded the session below against babakks#17, a pull request in a test repository, setting COPILOT_CLI=1 where the agent hints were exercised.

  1. When I ran gh run view --help and gh run watch --help, I saw the new paragraphs pointing at gh event listen and com.github.pull_request.check_suite.status.changed.v1.
  2. Given I had dispatched the govulncheck.yml workflow on the pull request branch, when I ran gh run view <run> with COPILOT_CLI=1 while the run was in progress, I saw the hint with gh event listen --resource https://github.com/babakks/cli/pull/17 --event com.github.pull_request.check_suite.status.changed.v1, followed by the usual run summary.
  3. When I ran gh run watch <run> with COPILOT_CLI=1, I saw the same hint before the watch started, and it was still on screen after I stopped the watch with Ctrl-C.
  4. Given I had dispatched the workflow again and the earlier run had completed, when I ran gh event listen --resource <pr> --event com.github.pull_request.check_suite.status.changed.v1 --jq .data.conclusion, I saw failure once the run completed, and the command exited after that first event. gh run view <run> --json conclusion then reported failure for the dispatched run.
11-check-suite.mp4

Key points

  • The hint names the pull request, not the run, because check suite events are subscribed per pull request. A run that does not belong to a pull request gets no hint.
  • The hint suggests the default one-shot listener and leaves --count and --follow out. The number of check suites per pull request is not known in advance, so reading the checks after each event and listening again is more reliable than a fixed count.
  • Completed runs get no hint, since there is nothing left to wait for.

Notes for reviewers

Start with PrintChecksListenHint in pkg/cmd/event/shared/hint.go, then the call sites in pkg/cmd/run/view/hint.go, pkg/cmd/run/view/view.go, and pkg/cmd/run/watch/watch.go, and their tests. The first commit adds the event type to gh event listen; the second adds the run hints and help text.

Authorship and follow-up

Who wrote this:

  • A human wrote it.
  • An agent wrote it under close human direction.
  • An agent wrote it independently, and no human has guided the implementation beyond the initial prompt.

Who answers review comments:

  • @babakks will read and reply directly. Name the account.
  • An agent will draft replies and @babakks will read them before they are posted.
  • Nobody has explicitly committed to replying.

babakks and others added 2 commits November 17, 2026 16:36
Add com.github.pull_request.check_suite.status.changed.v1 to the known
event types, so it shows in help, completions, and subscription view.

A pull request usually has several check suites, each sending its own
event with data.conclusion, so the listen help, the gh skill, and the
preview doc explain reading the checks after each event to wait for CI.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: bbce5a7f-103c-4e67-99c9-2d6dc3f6a02b
When an agent views or watches an unfinished workflow run of a github.com
pull request, print a hint on stderr that suggests listening to the check
suite status event instead of polling. The help text of both commands
mentions the same alternative.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: bbce5a7f-103c-4e67-99c9-2d6dc3f6a02b
@babakks
babakks requested a review from a team as a code owner November 17, 2026 17:11
@babakks
babakks requested review from tidy-dev and a balanced review from Copilot and removed request for a team November 17, 2026 17:11
@babakks
babakks added this pull request to stack #15082 November 17, 2026 17:14
@babakks
babakks requested review from BagToad and removed request for tidy-dev November 17, 2026 17:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Pending commit statuses can cause indefinite waits, and branch-only matching can suggest events for an outdated PR; required test coverage is also missing.

6 open issues
What changed in this PR

Completes the event-streaming stack tracked in #15070 by exposing check-suite completion events and helping agents discover event-driven waiting for pull request CI on github.com.

Changes:

  • Adds the check-suite event to event help, shell completion, and listener examples.
  • Adds agent-only hints to unfinished gh run view and gh run watch invocations, sharing the existing hint layout.
  • Updates run help, tests, agent guidance, and preview documentation.
File Description
skills/​gh/​SKILL.md Documents event-driven CI waiting and checking remaining suites.
pkg/​cmd/​run/​watch/​watch.go Adds agent detection, waiting guidance, and a pre-watch hint.
pkg/​cmd/​run/​watch/​watch_test.go Tests hint output for agent and human callers.
pkg/​cmd/​run/​view/​view.go Adds waiting guidance and hints for regular and JSON output paths.
pkg/​cmd/​run/​view/​view_test.go Tests hints across run states, caller types, and JSON output.
pkg/​cmd/​run/​view/​hint.go Centralizes view-specific hint eligibility and printing.
pkg/​cmd/​event/​shared/​hint.go Shares hint formatting and adds check-suite waiting advice.
pkg/​cmd/​event/​shared/​help.go Adds the check-suite event name and description.
pkg/​cmd/​event/​shared/​completion_test.go Updates the unknown-event completion fixture.
pkg/​cmd/​event/​listen/​listen.go Explains check-suite events and adds a conclusion-printing example.
docs/​event-listen-preview.md Documents check-suite payloads and run-command hints.

Review effort: Balanced

Comment on lines +33 to +35
readNote: fmt.Sprintf("Each check suite, such as a workflow run, sends its own event with its conclusion "+
"when it completes; after each event, read the checks with `gh pr checks %s`, and if any are still "+
"pending, run the listener again.", pullRequestURL),
Comment thread pkg/cmd/run/view/hint.go
if opts.InvokingAgent == "" || run.Status == shared.Completed {
return
}
eventShared.PrintChecksListenHint(opts.IO.ErrOut, ghrepo.GenerateRepoURL(repo, "pull/%d", prNumber))
Comment thread pkg/cmd/event/shared/completion_test.go Resolved
Comment thread pkg/cmd/run/view/view.go Resolved
Comment thread pkg/cmd/run/watch/watch.go Resolved
Comment thread pkg/cmd/run/watch/watch_test.go Resolved
@BagToad
BagToad merged commit 42d52b4 into trunk Nov 17, 2026
19 checks passed
@BagToad
BagToad deleted the babakks/event-check-suite branch November 17, 2026 19:18
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.

3 participants