Repository navigation
[dotnet-port-fixes] fix: preserve null session state values - #1267
Quim Muntal (qmuntal) merged 1 commit into
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
API consistency review
Changed Go contract
Upstream evidence reviewed
AssessmentBefore this fix, Go's Warning Firewall blocked 3 domainsThe following domains were blocked by the firewall during workflow execution:
To allow these domains, add them to the network:
allowed:
- defaults
- "proxy.golang.org"
- "storage.googleapis.com"
- "sum.golang.org"See Network Configuration for more information.
|
There was a problem hiding this comment.
🟢 Approval recommended
The focused implementation matches the intended behavior and includes adequate regression coverage.
0 open findings
What changed in this PR
Preserves explicit JSON null values in session state across serialization round trips.
Changes:
- Decode state entries as raw JSON before wrapping them.
- Add regression coverage for reading and overwriting null values.
| File | Description |
|---|---|
agent/session.go |
Preserves null state entries as non-nil wrappers. |
agent/session_test.go |
Tests null round trips and replacement. |
🧠 Review effort: Balanced
Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.
Summary
Preserve explicit JSON null session values during Go
Sessionround trips. The internal unmarshal path now decodes state entries as raw JSON before wrapping them, so a null entry remains a readable state key and can be overwritten instead of becoming a nil internal pointer.Ported .NET PRs
Ported the fix intent from .NET commit
d0ccaa62761ec36c59c139940797978623fb630a, verified as present at pinned upstream SHA40763bed1a5e94a1698ba9ebf009e5622eb099aa: source change and regression tests. The complete upstream change was classified as fix-only: no exported API, option, default, or capability change.The other deeply inspected candidate, .NET commit
763887452f371d8d03a67993ec7adcd95a0e18c2, was excluded because it targets .NET AI-context decorators owningIAsyncEnumeratorinstances; the Go counterpart uses iterator-based context-provider middleware and has no established corresponding enumerator-owning path.Focused duplicate searches were repeated before publication with these exact queries: issue
repo:microsoft/agent-framework-go session null state JSON roundtripand PRrepo:microsoft/agent-framework-go Session UnmarshalJSON stateValue null. Both returned no results.Breaking Changes
No. This preserves existing public APIs and corrects deserialization of an existing serialized value.
Tests and Examples
gofmt -w agent/session.go agent/session_test.gogo test ./agentgit diff --checkAdded
TestSession_UnmarshalJSON_NullStateValueRoundtripsAndCanBeOverwritten, covering publicSet→json.Marshal→json.Unmarshalbehavior and subsequent overwrite.Notes
The fix changes only
agent/session.goandagent/session_test.go. Publication is queued from branchdotnet-port-fix-session-null-roundtrip; no binaries or build artifacts are included.Warning
Firewall blocked 3 domains
The following domains were blocked by the firewall during workflow execution:
proxy.golang.orgstorage.googleapis.comsum.golang.orgTo allow these domains, add them to the
network.allowedlist in your workflow frontmatter:See Network Configuration for more information.