Skip to content

Resume transformed awaits at the continuation boundary - #24

Merged
MiguelsPizza merged 1 commit into
mainfrom
alex/resume-transformed-await-explicitly
Aug 23, 2026
Merged

Resume transformed awaits at the continuation boundary#24
MiguelsPizza merged 1 commit into
mainfrom
alex/resume-transformed-await-explicitly

Conversation

@MiguelsPizza

Copy link
Copy Markdown
Contributor

Why

The compile-time await transform introduced in #22 restored actor identity before resolving each await and cleared it one microtask later. A nested native promise continuation could run after that window but before the input lock checkpoint ended, so a later transformed await no longer knew which actor owned the continuation.

This surfaced under load in the Rook cutover (Rook #143) as SQL writes running without the input lock during root-agent tool/action flows.

What changed

  • transformed awaits now return a captured outcome
  • the generated continuation restores actor identity at its first post-await instruction
  • identity remains available until the same checkpoint boundary that releases the input lock
  • the legacy gate and async-iterable path remain compatible

Verification

  • 799 unit tests
  • TypeScript builds and conformance examples
  • publint, attw, and package smoke test
  • Fallow: no introduced dead code, complexity, or duplication
  • Rook root-agent Chromium integration: 15/15 passes under 12 concurrent CPU burners; the old implementation failed within 1-3 attempts

The previous helper published actor identity before resolving the awaited promise and cleared it one microtask later. Nested native promise jobs could resume after that window while the actor lock was still held, leaving the next transformed await unable to identify its owner.

Wrap each transformed result and restore its captured context at the first post-await instruction. Keep that identity until the same checkpoint boundary that releases the input lock.
@MiguelsPizza
MiguelsPizza merged commit 6616bcb into main Aug 23, 2026
1 check passed
@MiguelsPizza
MiguelsPizza deleted the alex/resume-transformed-await-explicitly branch August 23, 2026 09:27
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