Skip to content

fix: release waitFor listeners on cancellation - #83

Merged
cevr merged 1 commit into
mainfrom
fix/wait-for-cleanup
Sep 7, 2026
Merged

fix: release waitFor listeners on cancellation#83
cevr merged 1 commit into
mainfrom
fix/wait-for-cleanup

Conversation

@cevr

@cevr cevr commented Sep 7, 2026

Copy link
Copy Markdown
Owner

Cancelling actor.waitFor left its state listener registered. Later transitions still called the cancelled wait's predicate. A predicate defect during the subscription recheck leaked the listener too.

Own listener registration with Effect.acquireUseRelease. Keep the current-state fast path and post-subscription recheck. Release on success, defect, and cancellation. Public types and actor stop behavior stay unchanged; awaitFinal and sendAndWait inherit the cleanup.

waitFor
- add listener -> recheck/await -> remove on success
+ acquire listener -> recheck/await -> release on every exit

Validation: both real-actor regressions fail before the fix. Full gate passes: 385 tests, 853 assertions, typecheck, lint, format, build, and all example gates. One independent Counsel review found no blocker. Includes a patch changeset.

@cevr
cevr merged commit c0aea35 into main Sep 7, 2026
1 check passed
@github-actions github-actions Bot mentioned this pull request Sep 7, 2026
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.

1 participant