support for openclaw protocol v4 - #151
Open
CameronVetter wants to merge 4 commits into
Open
CameronVetter wants to merge 4 commits into
CameronVetter wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds a new “v3” canonical device-auth payload builder with normalized device metadata, updates the OpenClaw client to negotiate protocol v4, and adjusts session/chat RPC handling to accept multiple response shapes.
Changes:
- Introduce
buildDeviceAuthPayloadV3()and metadata normalization for signing. - Update client connect handshake to use protocol v4 and send normalized platform metadata.
- Make session/history/message APIs more flexible to server response shape differences.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| src/lib/openclaw/device-identity.ts | Adds metadata normalization + new v3 signing payload builder including platform/deviceFamily. |
| src/lib/openclaw/device-identity.test.ts | Adds a unit test asserting normalization behavior in the v3 payload. |
| src/lib/openclaw/client.ts | Switches to protocol v4 negotiation and updates auth/session/chat RPC calls + response parsing. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
CameronVetter
marked this pull request as draft
June 10, 2026 21:11
Author
|
I'm still testing, but initial results look promising. I will move this to ready for review once I get some more runtime on these changes. |
CameronVetter
marked this pull request as ready for review
June 11, 2026 03:51
Author
|
@crshdn I've tested this and I believe it is working completely. |
2 tasks
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.
The meaningful changes are:
The code itself is in src\lib\openclaw\client.ts; I also updated the coupled helper in src\lib\openclaw\device-identity.ts because the v4 handshake depends on that signature format. TypeScript and the new targeted test passed. Full repo validation is still blocked by existing repository/environment issues on Windows: npm test uses rm, and npm run build fails on an unrelated EPERM scandir against C:\Users\camer\Application Data.
This update now advertises minProtocol: 4 and maxProtocol: 4, so it expects a v4 gateway handshake and v4-era request shapes. A protocol v3-only client or gateway would not negotiate successfully.
There is one easy point of confusion: the device-auth signature payload is now v3, but that is not the same as OpenClaw Protocol v3. That signature format is part of the Protocol v4 handshake path.
This addresses #137
Per copilot suggestion now fails loudly on unexpected protocol envelopes instead of silently treating them as empty results.
I added:
So if the gateway returns the wrong shape in production, you’ll now get a clear error like “unexpected response shape for sessions.list” rather than a misleading “no sessions” outcome. TypeScript passes.