Repository navigation
fix(core): write null Task.ttl instead of omitting it - #1089
Conversation
The 2025-11-25 schema requires Task.ttl and uses null for unlimited retention, but McpJson drops null properties, so such a task went out without the key. Task, GetTaskResult and TaskStatusNotificationParams now add "ttl": null when it is missing. Decoding is unchanged.
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The implementation consistently covers affected wire types with focused regression tests and preserves decoding compatibility.
Review effort: Balanced
Findings: None
What changed in this PR
Fixes task serialization to emit required nullable ttl fields, aligning with the MCP 2025-11-25 schema.
Changes:
- Adds shared serializers that restore
"ttl": null. - Applies them to all task-state wire types.
- Expands serialization and backward-compatible decoding tests.
| File | Description |
|---|---|
tasks.kt |
Applies serializers to task result types. |
notification.kt |
Applies serialization to status notification parameters. |
serializers.kt |
Adds the task-field transforming serializer. |
TasksTest.kt |
Tests task results, lists, and legacy decoding. |
NotificationTest.kt |
Tests notification and JSON-RPC conversion. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
Nice, clean fix — this looks good to merge, thanks!
Produced by Air Automations. Name: Code review / Run: https://air.jetbrains.cloud/org/05cf1a7f-6ab5-713b-abd3-29d0c8a05e2d/automations/409567ec-d3a7-40ac-ba95-8518ec577ac2?run=031d62f9-6886-4d9b-9ee3-2210eb756bf8
There was a problem hiding this comment.
Looks good — happy to approve this one, thanks!
Produced by Air Automations. Name: Code review / Run: https://air.jetbrains.cloud/org/05cf1a7f-6ab5-713b-abd3-29d0c8a05e2d/automations/409567ec-d3a7-40ac-ba95-8518ec577ac2?run=d9720ab9-3822-4bce-be88-1161eb1fa038
|
Documentation maintenance — one stale statement, in a file outside this diff (so it could not be anchored inline).
|
Tasks with unlimited retention now go on the wire with
"ttl": null: the schema requires the key, andMcpJsonused to drop it.closes #1078
How Has This Been Tested?
TasksTestandNotificationTestcases that asserted the omission, and added cases forGetTaskResultwith a nullttl,TaskStatusNotification.toJSON()and decoding a task withoutttl. The serialization cases fail without the fix.kotlin-sdk-coreJVM tests, thetypestests on JS (Node), Wasm (Node) and macosArm64, plus ktlint, detekt andcheckKotlinAbi.CreateTaskResult,GetTaskResult,CancelTaskResult,ListTasksResultandnotifications/tasks/statusagainst the TypeScript SDK 1.30.1 schemas: they pass with"ttl": nulland fail without the key.Breaking Changes
None. The public API is unchanged;
ttlis now always present on the wire.Types of changes
Checklist