fix: align v1 protocol handshake and tool_result media passthrough#1630
Conversation
kap-server dropped the server-initiated WS heartbeat and no longer emits heartbeat_ms in server_hello, but the published v1 schema still required it, so spec-compliant clients rejected the handshake before subscribing. - mark heartbeat_ms optional in serverHelloPayloadSchema (advisory only) - add a ws-control test for a server_hello without heartbeat_ms - align kimi-web WireServerHello and the server-e2e handshake assertion
- keep raw kosong content-part array for tool results carrying image/video/audio parts instead of flattening to text - restore ReadMediaFile media rendering after session reload/resume
🦋 Changeset detectedLatest commit: 431ec76 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 47c74d68de
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| /** | ||
| * Build the protocol-shaped `Message.content[]` for one history entry: | ||
| * 1. `tool` role → a single `tool_result` part. | ||
| * 1. `tool` role → a single `tool_result` part. Plain-text results keep the |
There was a problem hiding this comment.
Move v2 projection notes to the module header
packages/agent-core-v2/AGENTS.md requires comments in this tree to live solely in the top-of-file block and never beside functions, methods, or statements. These newly added media-passthrough details extend the function JSDoc, so touching this file leaves it out of compliance; move the rationale into the module header or remove the per-function commentary.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Addressed in 431ec76 — moved the media-passthrough rationale into the module header and trimmed the per-function JSDoc back to its previous form.
Per the agent-core-v2 comment conventions, comments live solely in the top-of-file block — move the media-passthrough rationale out of the buildProtocolContent JSDoc into the module header.
Related Issue
No linked issue — this PR fixes two independent protocol-alignment bugs found while developing against kap-server.
Problem
heartbeat_msinserver_hello, but the published v1 schema still required the field, so clients validating against the schema rejected the handshake before subscribing.What changed
1. Make
heartbeat_msoptional in server_helloheartbeat_msoptional inserverHelloPayloadSchema(advisory only).server_hellowithoutheartbeat_ms.WireServerHelloand the server-e2e handshake assertion with the relaxed schema.2. Pass media parts through tool_result projection
Checklist
gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.