[agent/codex:gpt-5.3-codex-spark] Read docs/RFC.md fully. Find ONE feature described in the sp... #25

Merged
Virgil merged 1 commit from main into dev 2026-04-03 19:38:02 +00:00
2 changed files with 9 additions and 4 deletions

View file

@ -79,7 +79,7 @@ func (s *Scope) FreeAll() {
}
if !s.freed.CompareAndSwap(false, true) {
return
panic("cgo.Scope.FreeAll: double-free detected")
}
s.lock.Lock()

View file

@ -17,7 +17,9 @@ func TestScopeFreesAllResources(t *testing.T) {
}
scope.FreeAll()
scope.FreeAll() // idempotent
assertPanics(t, "double-free", func() {
scope.FreeAll()
})
if !buffer.IsFreed() {
t.Fatal("expected buffer to be freed")
@ -57,7 +59,7 @@ func TestScopeIsFreedTracksLifecycle(t *testing.T) {
}
}
func TestScopeCloseIsSafeAndIdempotent(t *testing.T) {
func TestScopeClosePanicsOnDoubleFree(t *testing.T) {
t.Parallel()
var nilScope *Scope
@ -79,7 +81,10 @@ func TestScopeCloseIsSafeAndIdempotent(t *testing.T) {
t.Fatalf("expected close to return nil, got %v", err)
}
scope.Close()
assertPanics(t, "double-free", func() {
scope.Close()
})
if !buffer.IsFreed() {
t.Fatal("expected buffer to be freed after close")
}