Skip to content

Commit ab2b6a2

Browse files
committed
test: reproduce #396 (v0.3 status.message missing kind/messageId)
Deserializes the exact payload shape from the issue report: a v0.3 task response whose status.message omits both kind and messageId. Asserts both fields fall back to sensible defaults instead of failing deserialization.
1 parent 0839cf8 commit ab2b6a2

1 file changed

Lines changed: 47 additions & 0 deletions

File tree

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
using System.Text.Json;
2+
3+
namespace A2A.V0_3.UnitTests.GitHubIssues
4+
{
5+
public sealed class Issue396
6+
{
7+
[Fact]
8+
public void Issue_396_Passes()
9+
{
10+
var json = """
11+
{
12+
"jsonrpc": "2.0",
13+
"id": "1",
14+
"result": {
15+
"id": "63b2861e-1234-4a1a-9a3a-000000000001",
16+
"contextId": "2c727c41-1234-4a1a-9a3a-000000000002",
17+
"kind": "task",
18+
"status": {
19+
"state": "completed",
20+
"message": {
21+
"role": "agent",
22+
"parts": [ { "kind": "text", "text": "Skill completed." } ]
23+
},
24+
"timestamp": "2026-05-17T15:59:43.401Z"
25+
}
26+
}
27+
}
28+
""";
29+
30+
var deserializedResponseObj = JsonSerializer.Deserialize<JsonRpcResponse>(json, A2AJsonUtilities.DefaultOptions);
31+
Assert.NotNull(deserializedResponseObj);
32+
33+
var task = deserializedResponseObj.Result.Deserialize<AgentTask>(A2AJsonUtilities.DefaultOptions);
34+
Assert.NotNull(task);
35+
36+
Assert.Equal("63b2861e-1234-4a1a-9a3a-000000000001", task.Id);
37+
Assert.NotNull(task.Status.Message);
38+
39+
// kind and messageId were both omitted from status.message; both fall back to
40+
// their defaults instead of failing deserialization.
41+
Assert.Equal("message", task.Status.Message!.Kind);
42+
Assert.False(string.IsNullOrEmpty(task.Status.Message.MessageId));
43+
Assert.Equal(MessageRole.Agent, task.Status.Message.Role);
44+
Assert.Single(task.Status.Message.Parts);
45+
}
46+
}
47+
}

0 commit comments

Comments
 (0)