Background
The WebSocket protocol in MicroClaw uses inconsistent JSON field names for session identifiers (sessionKey, sessionId, session_id, and key), which breaks compatibility with OpenClaw clients expecting key.
Expected Behavior
All WebSocket request/response payloads and event payloads should use a single field name for session identifier:
Internally, Rust code can keep session_key, but serde should map it to/from key.
Impact
High - Protocol inconsistency impacts client interoperability and can cause session resolution/parsing failures in integrations expecting OpenClaw-compatible payloads.
Proposed Fix
- Keep internal Rust field names as
session_key.
- Use serde mapping for all relevant structs:
- Ensure all JSON payload builders return:
- Remove legacy mixed naming in WebSocket method responses/events.
Verification
cargo check passes.
- Related unit test run passes:
cargo test test_expected_closed_socket_errors_are_downgraded