Keep overlapping actor await publications isolated - #29
Merged
Conversation
A transformed await previously published its result before __resumeAwait restored the owning actor. In a realm with independently bundled actors, another publication could enter that microtask gap and replace the shared continuation identity, so the first actor resumed under the wrong input gate.\n\nReserve that publication gap across runtime copies, release it at __resumeAwait, and retain a checkpoint-end escape hatch for abandoned transformed results. The browser regression loads two gate module copies to preserve the production failure shape.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
This is a correctness follow-up to #24 and #20. The explicit await transform correctly restores the captured actor in
__resumeAwait, but the result promise is fulfilled just before that injected call runs. In a realm containing separately bundled actors, another actor can publish in that microtask gap and replace the realm-shared continuation identity. The first actor then resumes without its own input lock.That violates the actor-owned resumption model behind Cloudflare's Durable Object input gates. It surfaced in Rook as a delegated run nondeterministically failing at
sql.exec(): no input lock availablewhile broadcasting a milestone to its parent.What changed
__resumeAwait.Symbol.for(...), matching the independently bundled runtime shape already handled by current actor identity.This stays in the runtime boundary. Rook needs no gate shim or vendored Agents workaround. #27 remains the separate owner of loopback routing.
Verification
pnpm test— 960 tests passed across unit, workerd, Node, and browser lanes.pnpm typecheck— passed.pnpm check:package— passed.A patch changeset is included; Rook can consume the released version after merge.