Merge pull request '[agent/codex:gpt-5.3-codex-spark] Read docs/RFC.md fully. Find ONE feature described in the sp...' (#13) from main into dev

This commit is contained in:
Virgil 2026-04-03 19:25:13 +00:00
commit 00cbac5da2
2 changed files with 27 additions and 0 deletions

View file

@ -80,3 +80,11 @@ func (s *Scope) FreeAll() {
Free(pointer)
}
}
// IsFreed reports whether FreeAll has been called.
func (s *Scope) IsFreed() bool {
if s == nil {
return true
}
return s.freed.Load()
}

View file

@ -37,3 +37,22 @@ func TestScopePanicsAfterFreeAll(t *testing.T) {
scope.CString("nope")
})
}
func TestScopeIsFreedTracksLifecycle(t *testing.T) {
t.Parallel()
scope := NewScope()
if scope.IsFreed() {
t.Fatal("expected new scope to be active")
}
scope.FreeAll()
if !scope.IsFreed() {
t.Fatal("expected scope to report freed after FreeAll")
}
var nilScope *Scope
if !nilScope.IsFreed() {
t.Fatal("expected nil scope to be treated as freed")
}
}