Skip to content

fix: restore previous spawnRef binding on finalizer cleanup#1416

Merged
MiMoHardFather merged 1 commit into
mainfrom
fix/spawn-ref-restore-on-finalizer
Jun 28, 2026
Merged

fix: restore previous spawnRef binding on finalizer cleanup#1416
MiMoHardFather merged 1 commit into
mainfrom
fix/spawn-ref-restore-on-finalizer

Conversation

@MiMoHardFather

Copy link
Copy Markdown
Collaborator

Summary

  • Fix spawnRef finalizer to restore the previous binding instead of wiping to undefined
  • Prevents breaking tryStartCheckpointWriter when Actor.layer is initialized more than once in the same process (memo'd ManagedRuntimes, overlapping test runtimes)
  • Apply the same fix to all test files that mock Actor.layer

Changes

  • src/actor/spawn.ts: Save prevSpawnRef before overwriting and restore it in the finalizer
  • test/session/checkpoint-*.test.ts: Apply matching fix to test actor mocks
  • test/tool/actor.test.ts: Save/restore spawnRef in beforeAll/afterEach instead of setting to undefined

When Actor.layer is initialized more than once in the same process
(memo'd ManagedRuntimes, overlapping test runtimes), the inner scope's
finalizer was wiping spawnRef to undefined, breaking every subsequent
tryStartCheckpointWriter call. Save and restore the previous binding
instead.
@MiMoHardFather MiMoHardFather merged commit d4cb36b into main Jun 28, 2026
5 of 6 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.

1 participant