fix(coderd/x/chatd): avoid closing poller hint channels - #28746
Conversation
914e81b to
be6c02d
Compare
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: be6c02dfcb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
|
Codex Review: Didn't find any major issues. Bravo. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…end-on-closed-channel panic The stream sync poller delivered hints over per-subscriber channels that unregister closed under the poller mutex, while pollOnce sent on them from a lock-free snapshot. A subscriber unregistering mid-poll made pollOnce panic with "send on closed channel", crashing coderd. Any authenticated user could trigger this by opening and closing chat streams (GHSA-7x3x-59xg-4hrc). Convert the poller to a callback fanout, mirroring pubsub.Subscribe: Register now takes a deliver callback and returns only an unregister func, unregister is delete-only (nothing is ever closed), and the consumer funnels poller hints into its existing consumer-owned updateCh with the same streamCtx guard already used for pubsub hints. This makes the panic unrepresentable and also removes the nil-poller closed-channel return that instantly terminated streams via the ok-check. Adds a regression race test churning register/unregister against pollOnce; the previous implementation panics under it.
f4d45b0 to
518736f
Compare
|
Backport to |
|
Backport to |
Closes SEC-515
Prevent a
send on closed channelpanic when a chat stream unregisters during polling.The poller no longer owns or closes subscriber channels. This is safe because delivery is guarded by the stream context, and unregister removes the subscriber from future polls.