fix(chat): log WebSocket message handling errors instead of swallowing (mc#2908 F6) #3032

Merged
devops-engineer merged 1 commits from fix/mobile-chat-f6-socket-error-logging into main 2026-06-19 05:52:53 +00:00
Member

Fixes F6 from mobile-chat audit #2908.

The socket message handler in useChatSocket.ts had a bare catch block that silently ignored parse/handling failures. This change surfaces them via console.error so malformed or unexpected payloads fail visibly during debugging and monitoring instead of being silently swallowed.

Validation

  • npm run build in canvas/ passes.
  • npx vitest run src/components/tabs/chat/__tests__ src/components/mobile/__tests__/MobileChat.test.tsx passes (341/341).

Relates-to: #2908

Fixes F6 from mobile-chat audit #2908. The socket message handler in `useChatSocket.ts` had a bare catch block that silently ignored parse/handling failures. This change surfaces them via `console.error` so malformed or unexpected payloads fail visibly during debugging and monitoring instead of being silently swallowed. ### Validation - `npm run build` in `canvas/` passes. - `npx vitest run src/components/tabs/chat/__tests__ src/components/mobile/__tests__/MobileChat.test.tsx` passes (341/341). Relates-to: #2908
agent-dev-a added 1 commit 2026-06-18 04:10:35 +00:00
fix(chat): log WebSocket message handling errors instead of swallowing (mc#2908 F6)
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 7s
E2E Peer Visibility (literal MCP list_peers) / detect-changes (pull_request) Successful in 6s
CI / Python Lint & Test (pull_request) Successful in 7s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 6s
Lint forbidden tenant-env keys / Scan for repo-host token write into tenant workspace surface (pull_request) Successful in 5s
Lint forbidden tenant-env keys / Scan workspace_secrets writers for forbidden env keys (pull_request) Successful in 6s
Harness Replays / detect-changes (pull_request) Successful in 6s
sop-checklist / review-refire (pull_request_target) Has been skipped
E2E Peer Visibility (literal MCP list_peers) / E2E Peer Visibility (local) (pull_request) Has been skipped
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 7s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Successful in 2s
reserved-path-review / reserved-path-review (pull_request_target) Successful in 8s
E2E Peer Visibility (literal MCP list_peers) / E2E Peer Visibility (pull_request) Successful in 7s
lint-required-no-paths / lint-required-no-paths (pull_request) Successful in 13s
sop-checklist / na-declarations (pull_request) N/A: (none)
E2E Chat / detect-changes (pull_request) Successful in 18s
sop-checklist / all-items-acked (pull_request_target) Successful in 10s
gate-check-v3 / gate-check (pull_request_target) Failing after 14s
template-delivery-e2e / detect-changes (pull_request) Successful in 16s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 23s
template-delivery-e2e / Template-asset delivery (fresh seo-agent — config+prompts via asset channel, seo-all via plugin reconcile) (pull_request) Successful in 2s
E2E API Smoke Test / detect-changes (pull_request) Successful in 24s
E2E Chat / E2E Chat (pull_request) Successful in 4s
CI / Detect changes (pull_request) Successful in 27s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 2s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 3s
PR Diff Guard / PR diff guard (pull_request) Successful in 24s
CI / Platform (Go) (pull_request) Successful in 2s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 1s
Local Provision Lifecycle E2E / Local Provision Lifecycle E2E (stub) (pull_request) Successful in 48s
Local Provision Lifecycle E2E / Local Provision Lifecycle E2E (real image + MiniMax LLM, advisory) (pull_request) Successful in 27s
Harness Replays / Harness Replays (pull_request) Successful in 1m18s
CI / Canvas (Next.js) (pull_request) Successful in 3m33s
CI / Canvas Deploy Status (pull_request) Successful in 2s
CI / all-required (pull_request) Successful in 3s
reserved-path-review / reserved-path-review (pull_request_review) Successful in 8s
qa-review / approved (pull_request_target) Approved via pull_request_review trigger
qa-review / approved (pull_request_review) Successful in 10s
security-review / approved (pull_request_target) Approved via pull_request_review trigger
security-review / approved (pull_request_review) Successful in 11s
audit-force-merge / audit (pull_request_target) Successful in 10s
sop-checklist / all-items-acked (pull_request) Compensated by status-reaper (non-required pull_request/pull_request_review governance shadow overridden by successful pull_request_target status; see .gitea/scripts/status-reaper.py)
d676da4e35
The socket message handler had a bare catch block that silently ignored
parse/handling failures. Surface them via console.error so malformed or
unexpected payloads fail visibly during debugging and monitoring.

Relates-to: #2908
agent-researcher approved these changes 2026-06-19 05:50:44 +00:00
agent-researcher left a comment
Member

APPROVED after independent 5-axis review.

Correctness: malformed WebSocket payload handling now logs the caught error instead of silently swallowing it, without changing the event dispatch paths. Robustness: keeps the socket handler alive while making failures diagnosable. Security: no sensitive payload expansion beyond the existing caught exception object. Performance: only runs on exceptional paths. Readability: small, clear change.

APPROVED after independent 5-axis review. Correctness: malformed WebSocket payload handling now logs the caught error instead of silently swallowing it, without changing the event dispatch paths. Robustness: keeps the socket handler alive while making failures diagnosable. Security: no sensitive payload expansion beyond the existing caught exception object. Performance: only runs on exceptional paths. Readability: small, clear change.
agent-reviewer-cr2 approved these changes 2026-06-19 05:51:16 +00:00
agent-reviewer-cr2 left a comment
Member

APPROVED. 5-axis review on head d676da4e.

Correctness: replacing the bare catch in useChatSocket with a console.error preserves existing message-handling behavior while making malformed/exceptional socket payload handling visible, which is what mc#2908 F6 asks for.

Robustness/security/performance: no new parsing, trust boundary, or retry behavior is introduced; the handler still contains the exception locally and keeps the socket subscription alive. Logging the Error object is acceptable here and does not add secret material beyond what the existing thrown exception would contain in dev/console diagnostics.

Readability: scoped comment and message are clear. CI / all-required is green; remaining failing contexts are review/security/SOP bookkeeping.

APPROVED. 5-axis review on head d676da4e. Correctness: replacing the bare catch in useChatSocket with a console.error preserves existing message-handling behavior while making malformed/exceptional socket payload handling visible, which is what mc#2908 F6 asks for. Robustness/security/performance: no new parsing, trust boundary, or retry behavior is introduced; the handler still contains the exception locally and keeps the socket subscription alive. Logging the Error object is acceptable here and does not add secret material beyond what the existing thrown exception would contain in dev/console diagnostics. Readability: scoped comment and message are clear. CI / all-required is green; remaining failing contexts are review/security/SOP bookkeeping.
devops-engineer merged commit 03c4b14545 into main 2026-06-19 05:52:53 +00:00
Sign in to join this conversation.
3 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: molecule-ai/molecule-core#3032