Skip to content

One Nullable Type, Two Nulls: Repairing Semantic Kernel Schema Generation

A merged Semantic Kernel .NET fix replaces reference equality with value equality when adding null to strict tool schemas.

Microsoft Semantic KernelMerged 2026-06-16Hermes Labs · Roli Bosch

The strict-schema conversion could turn a valid type array into ["string", "null", "null"]. InsertNullTypeIfRequired used JsonArray.Contains with a newly converted JsonNode. The membership check compared node references, so an existing string value of "null" did not satisfy the guard.

Before
["string", "null", "null"]
After
["string", "null"]

The patch uses Any to inspect string-valued JsonValue nodes and compare their contents to "null". It leaves an existing null member alone and still inserts null when an optional parameter needs it. The change sits at schema conversion, where both the optional-parameter and nullable-keyword paths meet.

Three regression tests cover an optional parameter with an existing null type, the nullable keyword with an existing null type, and the positive case where null must be inserted. The public diff contains the production guard and these three tests. This evidence establishes the concrete schema defect and its tested fix; it does not establish that every downstream provider rejected every duplicate array.

Schema construction preserves the intended nullable type without appending duplicate members. The regression set protects both routes into the defect and verifies that legitimate null insertion still occurs.

The work addresses upstream issue #13527. Roli Bosch submitted the fix and tests under roli-lpci; Microsoft merged PR #13635 on 16 June 2026. This .NET schema fix is distinct from Hermes Labs’ earlier Python chat-history truncation contribution (#13610). Each is one merged PR in the canonical ledger.

Inspect the public record

Pull request #13635 · Code and regression tests · Merge commit · Earlier upstream report or discussion

Complete contribution ledger · All case studies

Hermes Labs applies this diagnostic work to agent frameworks, retrieval, memory and evaluation systems. Read about diagnostic engineering or bring us a system and a symptom.