Skip to content

fix: allow subscription changes during experiment notifications - #164

Merged
vazarkevych merged 1 commit into
growthbook:mainfrom
peterolkhov:codex/fix-reentrant-experiment-subscriptions
Nov 17, 2026
Merged

vazarkevych merged 1 commit into
growthbook:mainfrom
peterolkhov:codex/fix-reentrant-experiment-subscriptions

Conversation

@peterolkhov

Copy link
Copy Markdown
Contributor

A subscription that calls its own unsubscriber currently makes GrowthBook.run() raise RuntimeError: Set changed size during iteration, even though the experiment was evaluated successfully. Calling destroy() or adding a subscriber from a callback has the same problem.

Iterate over a snapshot, as the async client already does. The current notification completes against that snapshot; subscription changes apply to the next notification. Assignment deduplication and callback exception handling stay the same.

Added regressions for unsubscribing, destroying, registering, and a callback that raises. Verified the new failure cases on the original code, then ran the full suite (1,783 passed), MyPy, and the blocking Flake8 check.

@greptile-apps

greptile-apps Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] This PR appears safe to merge.

Reviews (1) · Last reviewed commit: "fix: allow subscription changes during e..." · Reviewed by Greptile

@vazarkevych
vazarkevych merged commit 22c75d5 into growthbook:main Nov 17, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants