Skip to content

[Bug]: [Feature]: Add handshake phase logging to gateway/ws subsystem #79603

Description

@bzelones

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

When a WebSocket connection fails, the log only shows handshake-timeout or closed before connect. There is no indication of which phase stalled — TCP accept, WS upgrade, auth validation, session attach, or subscription registration. This makes it impossible to distinguish a network issue from an auth failure from a session manager deadlock.

Steps to reproduce

  1. Start gateway
  2. Trigger or observe a handshake-timeout in gateway/ws logs
  3. Note: only the final outcome is logged, not the phase where it stalled

Expected behavior

ateway should emit a phase log per connection on failure showing the last completed phase:
tcp accepted → ws upgrade started → auth token received → auth validated → session attached → subscriptions registered → ready

Actual behavior

When a WebSocket connection fails, the log only shows handshake-timeout or closed before connect. There is no indication of which phase stalled — TCP accept, WS upgrade, auth validation, session attach, or subscription registration. This makes it impossible to distinguish a network issue from an auth failure from a session manager deadlock.

OpenClaw version

2026.4.15

Operating system

Windows 11 (10.0.26200, x64)

Install method

npm global

Model

N/A

Provider / routing chain

openclaw → openai (not applicable — gateway-level issue)

Additional provider/model setup details

Details (paste into the free-text box):
Default route is openclaw → openai (direct API key auth).
Fallback chain: openai/gpt-5.4 → anthropic/claude-sonnet-4-6 → anthropic/claude-opus-4-7.
No cloudflare-ai-gateway or openrouter in this setup.
Auth profiles configured under auth.profiles.openai:default (mode: api_key).
Config lives in ~/.openclaw/openclaw.json under agents.defaults.model and plugins.entries.

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

No response

Metadata

Metadata

Assignees

Labels

P3Low-priority cleanup, docs, polish, ergonomics, or speculative work.bugSomething isn't workingbug:behaviorIncorrect behavior without a crashclawsweeper:linked-pr-openClawSweeper found an open linked pull request for this issue.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:otherThis issue has meaningful maintainer-visible impact outside the owned taxonomy.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.maturity:stableIssue affects a taxonomy feature currently scored M4/M5.

Type

No type

Fields

Priority

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions