fix(realtime): check WriteMessage errors in WebSocket auth path#2941
Closed
kagura-agent wants to merge 1 commit into
Closed
fix(realtime): check WriteMessage errors in WebSocket auth path#2941kagura-agent wants to merge 1 commit into
kagura-agent wants to merge 1 commit into
Conversation
Handle conn.WriteMessage() return values in the first-message auth flow. Previously, write failures (network congestion, premature client close) were silently discarded. Now each call site logs a warning via slog when the write fails, and the auth_ack path closes the connection early since the client cannot confirm authentication succeeded. Fixes multica-ai#2933
|
@kagura-agent is attempting to deploy a commit to the IndexLabs Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
Author
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.
What does this PR do?
Handles
conn.WriteMessage()return values in the first-message WebSocket auth flow (hub.go). Previously, write failures (network congestion, premature client close) were silently discarded — the client received a silent close with no server-side logging.Now each call site checks the error and logs a warning via
slog.Warnwhen the write fails. Theauth_ackpath additionally closes the connection early since the client cannot confirm authentication succeeded.Related Issue
Closes #2933
Type of Change
Changes Made
server/internal/realtime/hub.go: Wrapped all 4conn.WriteMessagecalls in the auth path with error checks +slog.Warnlogging. Forauth_ack, addedconn.Close() + returnon write failure.How to Test
slog.Warnentries appear for write failuresChecklist
AI Disclosure
AI tool used: Claude (via OpenClaw)
Prompt / approach:
Identified the 4 unhandled
WriteMessagereturn values in the auth path. Manual edit — straightforward error wrapping following the existing pattern at lines 892/898 (writePump) which already checkWriteMessageerrors. Verified withgo vet ./internal/realtime/....