Skip to content

Event Subscriptions API support in gh (preview): PR stack overview #15070

Closed

Description

@babakks

This issue tracks the stack of pull requests that adds GitHub's Event Subscriptions API to gh, so that people and agents can wait for pull request changes instead of polling.

Background

Agents that need to wait for a pull request to be reviewed, merged, or closed currently poll it with gh pr view or gh api in a loop. The Event Subscriptions API, in preview on github.com, lets a client subscribe to a resource and receive its events over a server-sent events stream. This stack exposes it as a new gh event command set and makes it discoverable to agents:

gh event listen \
  --resource https://github.com/OWNER/REPO/pull/123 \
  --event com.github.pull_request.review.submitted.v1

By default gh event listen exits after the first event, which suits agent harnesses that resume an agent when a background command exits. --count N exits after N events, --follow keeps listening until interrupted, and --timeout exits with status 8. Events are thin: they say what changed and point at it with data.api_url. gh event subscription list, create, view, and delete manage subscriptions directly.

The stack

Each pull request is based on the one before it, so review from the bottom up. The stack is meant to land together; for example, the subscription limit error in gh event listen already points at gh event subscription list and delete.

# Pull request Branch
1 #15071 Add a server-sent events reader and an Event Subscriptions API client babakks/event-client
2 #15072 Add gh event listen babakks/event-listen
3 #15073 Add gh event subscription list babakks/event-sub-list
4 #15074 Add gh event subscription create babakks/event-sub-create
5 #15075 Add gh event subscription view babakks/event-sub-view
6 #15076 Add gh event subscription delete babakks/event-sub-delete
7 #15077 Suggest gh event listen to agents in gh pr and gh api babakks/event-hints
8 #15078 Add agent evals for event-driven waiting, the gh skill section, and preview docs babakks/event-evals
9 #15079 Print each event without waiting for the next heartbeat (by @iancanderson) babakks/event-listen-flush
10 #15080 Report a deleted subscription clearly babakks/event-listen-deleted-sub
11 #15081 Support check suite events and suggest them from gh run view and gh run watch babakks/event-check-suite

PRs 2 to 6, 10, and 11 include a recording of the command against a real pull request. docs/event-listen-preview.md, added in PR 8, describes the preview behavior of the whole stack in one place and is a good overview before diving into the code.

Trying it out

Build gh from the top of the stack (#15081, babakks/event-check-suite) with make, then run the commands above against a pull request you can access. Only github.com is supported, and the account behind the credential must be enabled for the Event Subscriptions preview.

Agent evals

PR 8 adds a local, opt-in agent eval system and an events suite that checks whether Copilot agents complete pull request waiting tasks and use gh event listen rather than polling, with and without the gh skill. In the latest full run, agents with the skill passed five of six scenarios and agents without it passed four; every failing trial polled except the skill-on full-delegation one, which used gh event listen --follow but ran out of time before merging. See PR 8 for how the evals work and the full results.

Known limits and follow-ups

  • Only pull request events are covered, including check suite status changes on a pull request (PR 11). Check run and other event types are not part of this first pass.
  • GitHub Enterprise Server and GHE.com are not supported by the preview API, and gh fails before sending a request to them.
  • The service admits GitHub App installation tokens when their account is enabled for the preview, but only user tokens have been exercised.
  • --follow remains a risk for agents: even when the skill limits it to review loops, an agent can still pair it with long reads.

Activity

  1. added
    enhancement
    and removed
    needs-triage
    on Nov 17, 2026
  2. github-actions commented on Nov 17, 2026

    @github-actions
  3. cli-triage commented on Nov 17, 2026

    @cli-triage
  4. babakks commented on Nov 18, 2026

    @babakks
    MemberAuthor

    Shipped in v2.105.0 🎉

  5. added
    gh-event
    on Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementgh-event

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions