Reduce WebSocket log noise - hide normal reconnection messages

Done Bug Medium
Created: Dec 26, 2025
Updated: 6 days ago
PR: View

Description

Recent Comments

T
tinker-reviewer 6 days ago

## Code Review: Ticket #127 - WebSocket Log Noise Fix ✓ PASS ### Bug Normal WebSocket closures (`StatusNormalClosure`) were logged as ERROR, flooding terminal with: ``` [BRIDGE ERROR] WebSocket read error: ... StatusNormalClosure ... [BRIDGE] WebSocket disconnected. Reconnecting in 5s... ``` ### Root Cause All WebSocket disconnections logged identically, regardless of whether they were: - Normal closures (server-side disconnect, expected) - Actual errors (network failures, timeouts) ### Fix Applied **Changes in `agent-bridge.go`:** 1. **Added `disconnectionError` flag** (line 250): ```go disconnectionError := false ``` Tracks whether disconnection was due to error vs normal closure. 2. **Type assertion for CloseError** (lines 257-263): ```go if closeErr, ok := err.(*websocket.CloseError); ok && closeErr.StatusCode == websocket.StatusNormalClosure { disconnectionError = false // Silent reconnection } else { disconnectionError = true // Log actual error log.Printf("[BRIDGE ERROR] WebSocket read error: %v", err) } ``` - Uses proper Go type assertion with `ok` check - Compares `StatusCode` to `websocket.StatusNormalClosure` - Only logs actual errors 3. **Conditional reconnection message** (lines 296-298): ```go if disconnectionError { log.Printf("[BRIDGE] WebSocket disconnected. Reconnecting in %v...", backoff) } ``` - Silent for normal closures - Only shown for actual errors ### Acceptance Criteria Met - ✓ Normal closures not logged as ERROR - ✓ Automatic reconnection messages hidden for normal closures - ✓ Only actual errors logged to terminal - ✓ Quiet mode for successful reconnections ### Code Quality - Proper Go type assertion: `err.(*websocket.CloseError)` - Follows nhooyr.io/websocket library conventions - Clear variable naming and comments - No breaking changes to existing error handling - Minimal, targeted fix (16 lines added, 2 removed) ### No Issues Found Clean bug fix that reduces terminal noise while preserving error visibility. Ready to merge.

Ticket Stats

Status: Done
Priority: Medium
Type: Bug

Comments

1 comments
T
tinker-reviewer Reviewer

Add a Comment

Supports Markdown. Use @agent-name to mention.

Quick reactions:

No Subtasks Yet

Break down this ticket into smaller, manageable subtasks

Activity Timeline

  • tinker-worker

    State transition

    6 days ago

  • tinker-orchestrator

    Transition approve

    6 days ago

  • tinker-worker

    State transition

    6 days ago

  • tinker-reviewer

    Transition pass audit

    6 days ago

  • tinker-reviewer

    Add comment

    6 days ago

  • tinker-worker

    State transition

    6 days ago

  • tinker-worker

    Transition submit review

    6 days ago

  • tinker-worker

    Update ticket

    6 days ago

  • tinker-worker

    State transition

    6 days ago

  • tinker-orchestrator

    Create ticket

    6 days ago