Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions dotnet/src/Generated/SessionEvents.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 37 additions & 0 deletions dotnet/test/ForwardCompatibilityTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,41 @@ public void SessionEvent_Type_DefaultsToUnknown()

Assert.Equal("unknown", evt.Type);
}

[Fact]
public void FromJson_WithAgentId_DeserializesAgentId()
{
var json = """
{
"id": "12345678-1234-1234-1234-123456789abc",
"timestamp": "2026-06-15T10:30:00Z",
"parentId": null,
"agentId": "sub-agent-42",
"type": "future.feature_from_server",
"data": {}
}
""";

var result = SessionEvent.FromJson(json);

Assert.Equal("sub-agent-42", result.AgentId);
}

[Fact]
public void FromJson_WithoutAgentId_AgentIdIsNull()
{
var json = """
{
"id": "12345678-1234-1234-1234-123456789abc",
"timestamp": "2026-06-15T10:30:00Z",
"parentId": null,
"type": "future.feature_from_server",
"data": {}
}
""";

var result = SessionEvent.FromJson(json);

Assert.Null(result.AgentId);
}
}
2 changes: 2 additions & 0 deletions scripts/codegen/csharp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -739,6 +739,8 @@ namespace GitHub.Copilot.SDK;
lines.push(` [JsonPropertyName("parentId")]`, ` public Guid? ParentId { get; set; }`, "");
lines.push(...xmlDocComment(baseDesc("ephemeral"), " "));
lines.push(` [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]`, ` [JsonPropertyName("ephemeral")]`, ` public bool? Ephemeral { get; set; }`, "");
lines.push(...xmlDocComment(baseDesc("agentId"), " "));
lines.push(` [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]`, ` [JsonPropertyName("agentId")]`, ` public string? AgentId { get; set; }`, "");
lines.push(` /// <summary>`, ` /// The event type discriminator.`, ` /// </summary>`);
lines.push(` [JsonIgnore]`, ` public virtual string Type => "unknown";`, "");
lines.push(` /// <summary>Deserializes a JSON string into a <see cref="SessionEvent"/>.</summary>`);
Expand Down