Repository navigation
Event streaming (10/11): Report a deleted subscription clearly - #15080
Merged
BagToad merged 1 commit intoNov 17, 2026
Merged
Conversation
Co-authored-by: Copilot <[email protected]> Copilot-Session: bbce5a7f-103c-4e67-99c9-2d6dc3f6a02b
babakks
requested review from
sergiou87
and
a balanced review from Copilot
and removed request for
a team
November 17, 2026 17:11
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The deleted-subscription handling change has no active review issues blocking approval.
No open issues 🎉
What changed in this PR
This layer of the event-streaming stack improves how gh event listen reports a deleted subscription, replacing raw protocol details with actionable advice.
Changes:
- Adds deletion-specific messages tailored to
--resourceand--subscription, preserving exit status 1 and stopping without recreating the subscription. - Adds tests covering deletion in both listening modes.
- Documents that deletion ends listening in both modes.
| File | Description |
|---|---|
pkg/cmd/event/listen/listen.go |
Handles deleted subscriptions with mode-specific recovery advice. |
pkg/cmd/event/listen/listen_test.go |
Tests deletion messages and subscription creation behavior. |
docs/event-listen-preview.md |
Clarifies that deletion is final in both modes. |
Review effort: Balanced
BagToad
approved these changes
Nov 17, 2026
Merged
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Layer 10 of 11 in the stack tracked by #15070.
Description
When an event subscription is deleted, the server ends every open stream for it with a
subscription_endedframe whose reason isdeleted.gh event listenhad no case for that reason, so it fell through to the generic message, which shows raw protocol values and gives no next step:This change handles the
deletedreason explicitly. The command still exits with status 1 and never creates the subscription again, because deleting a subscription is how its listeners are stopped on purpose. The advice depends on how the subscription was chosen:--resource, the command created the subscription itself, so it suggests running the command again to create a new one:--subscription, it reuses the existing advice to listen with--resourceand the same--eventtypes, as it already does for an expired subscription.docs/event-listen-preview.mdnow states that a deleted subscription is final in both modes.How did you test this change?
I built
ghfrom this branch and ran both cases against a pull request in a test repository. The attached video records both runs. Each case ends withecho "exit status: $?"so the exit status is visible.gh event listen --resource <pr> --event com.github.pull_request.merge_conflict.v1and a background job deleted the new subscription 20 seconds later, then I sawsubscription sub_… was deletedfollowed byTo keep listening, run the command again to create a new subscription., and the exit status was 1.gh event subscription viewthen reported the subscription as not found.gh event subscription create, when I rangh event listen --subscription <id>and a background job deleted it 20 seconds later, then I sawsubscription sub_… was deletedfollowed by the advice to run the command again with--resourceand the same--eventtypes, and the exit status was 1.gh event subscription viewthen reported the subscription as not found.Before this change, the same deletion in
--resourcemode printedevent stream ended: subscription_ended (deleted)and exited with status 1.10-listen-deleted-sub.mp4
Key points
--resourcemode, anexpiredsubscription is created again automatically, but adeletedone is not. Recreating it would make deletion useless as a way to stop listeners.Notes for reviewers
Start with the new
deletedcase in the stream end switch inpkg/cmd/event/listen/listen.go, then the two table cases inlisten_test.gocovering each mode.Authorship and follow-up
Who wrote this:
Who answers review comments: