Conversation
santoshkumarradha
left a comment
There was a problem hiding this comment.
Looks good. The snapshot now isolates all session slices plus nested map and slice metadata, including cycles, while preserving nil values. The focused defensive-snapshot test passes locally.
Performance
✓ No regressions detected |
📊 Coverage gateThresholds from
✅ Gate passedNo surface regressed past the allowed threshold and the aggregate stayed above the floor. |
📐 Patch coverage gateThreshold: 80% on lines this PR touches vs
✅ Patch gate passedEvery surface whose lines were touched by this PR has patch coverage at or above the threshold. |
|
The implementation and all CI checks look good. The CLA is the only remaining step; once that’s signed, this should be good to go. |
AbirAbbas
left a comment
There was a problem hiding this comment.
I built a standalone program against this branch's sdk/go that registers session metadata with a map inside a slice inside a map, a typed []string, a map[string]string, []byte, a reference cycle and nil values, mutates every level of the SessionDefinitions() result and then re-reads the registry. On this branch every one of those stays isolated, nils keep their typed-nil-ness, the cycle stays a cycle and terminates, and the JSON of the definition is unchanged; the same program run against main leaks all of them, so the fix does what it says. go test -race ./agent/... is clean and patch coverage on the touched lines is 80%.
One real problem though, left inline: two metadata slices that share a backing array collide in the copy memo and one of them comes back with the wrong length. It's nondeterministic and silent, and it's a way for the payload to be wrong that doesn't exist on main, so I'd rather see it fixed here than shipped.
Separately, and fine to leave as is: the default: branch hands back pointers, structs with reference fields and arrays as they are, so map[string]any{"cfg": &Cfg{...}} still aliases into the registry. That's outside what this PR set out to do, but a line on cloneSessionMetadataValue saying only maps and slices are deep-copied would save the next reader the experiment.
|
CLA signed. |
santoshkumarradha
left a comment
There was a problem hiding this comment.
Looks good. The updated memo key preserves overlapping slice views, and both defensive snapshot regressions pass locally under the race detector. I also approved the pending fork workflows now that the CLA is signed.
|
Merged current The integration also needs to detach the newly introduced Validation with Go 1.23.12 on macOS arm64 ( |
santoshkumarradha
left a comment
There was a problem hiding this comment.
I rechecked the rebased head. The snapshot clone still preserves shared and cyclic metadata safely, distinguishes overlapping slice views, and now includes the current turn-detection fields from main. The focused Go tests, vet, and diff check pass locally.
|
recheck |
Summary
Agent.SessionDefinitions()returned copiedSessionDefinitionstructs, buttheir slice and metadata fields still shared state with the registered
definitions. This makes each returned definition an isolated snapshot,
including recursively nested metadata maps and slices, overlapping slice views,
and the
TurnDetectionconfiguration and its optional scalar pointers.Nil, zero, and false values are preserved.
Type of change
Test plan
Local validation by Codex on Go 1.23.12 / macOS arm64 (
TMPDIR=/private/tmp):cd sdk/go && go test ./... -count=1(all eight SDK packages)go build ./...cd sdk/go && go vet ./agentgofmt -d agent/session.go agent/session_test.go(no output)go mod tidy -diff(no diff)SessionDefinitions()implementation and passes with this change.Test coverage
Checklist
AI assistance
This change was prepared with OpenAI Codex. The validation listed above was run locally.
Repository-wide scripts were not completed because the local Python environment lacks pytest/ruff.
Hosted checks for the updated head await maintainer workflow approval.