Summary
SetMaxVariables and ResetEnv currently mutate global quota, variable identity, root environment, and stream IDs through engine/vm.go:399-439, engine/variable.go:10-38, engine/env.go:1-46, and engine/stream.go:19-31. Interleaving otherwise independent interpreter instances can therefore change each other's lifecycle state.
Why it matters
Interpreter isolation is required for deterministic execution. A reset in one VM can invalidate assumptions held by another VM, including retained Env bindings and stream identities.
Scope
Move variable-quota and reset ownership into a VM/session allocator while preserving globally unique term identities. Do not use a lock-only fix. This is not a quick win; design and review it separately from the seven focused issues in this set.
Acceptance criteria
Verification
Run the focused isolation test with go test -race and exercise two interleaved VMs with distinct limits, retained environments, and retained stream IDs.
Summary
SetMaxVariablesandResetEnvcurrently mutate global quota, variable identity, root environment, and stream IDs throughengine/vm.go:399-439,engine/variable.go:10-38,engine/env.go:1-46, andengine/stream.go:19-31. Interleaving otherwise independent interpreter instances can therefore change each other's lifecycle state.Why it matters
Interpreter isolation is required for deterministic execution. A reset in one VM can invalidate assumptions held by another VM, including retained
Envbindings and stream identities.Scope
Move variable-quota and reset ownership into a VM/session allocator while preserving globally unique term identities. Do not use a lock-only fix. This is not a quick win; design and review it separately from the seven focused issues in this set.
Acceptance criteria
Envretained by another VM.-race.Verification
Run the focused isolation test with
go test -raceand exercise two interleaved VMs with distinct limits, retained environments, and retained stream IDs.