Skip to content

[codex] fix runtime async generator request queue - #4492

Merged
proggeramlug merged 2 commits into
PerryTS:mainfrom
andrewtdiz:codex/async-generator-queue-20260605
Jun 5, 2026
Merged

proggeramlug merged 2 commits into
PerryTS:mainfrom
andrewtdiz:codex/async-generator-queue-20260605

Conversation

@andrewtdiz

Copy link
Copy Markdown
Contributor

Summary

  • wrap lowered async generator next / return / throw methods with a runtime request queue
  • drain same-stack async generator requests through microtasks so ordering matches Node
  • add internal Promise settle listeners and scanner roots so queue bookkeeping does not consume user-visible .then slots
  • add a Node parity fixture for same-stack async generator request ordering

Root Cause

Lowered async generator instance methods could be invoked reentrantly without Node-compatible request queue semantics. That let same-stack next() calls race the in-flight request instead of being serialized behind it.

Fixes #4438

Validation

  • cargo check -q -p perry-runtime --lib
  • cargo build --release -p perry-runtime -p perry with CARGO_TARGET_DIR=/root/perry-worktrees/perry-node-probe-20260604/target CARGO_BUILD_JOBS=1
  • cargo fmt --all -- --check
  • git diff --check and git diff --cached --check
  • ./scripts/check_file_size.sh
  • cargo test -q -p perry-runtime test_gc_init_mutable_scanner_families_rewrite_runtime_slots with shared CARGO_TARGET_DIR
  • direct Node 26 vs Perry diffs for async-generator-request-queue.ts, generator intrinsic/prototype fixtures, stream/readable/from-async-iterable.ts, and Promise queue fixtures

@proggeramlug
proggeramlug marked this pull request as ready for review June 5, 2026 02:03
@proggeramlug
proggeramlug merged commit 0062cdf into PerryTS:main Jun 5, 2026
13 of 14 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.

runtime: deep generator / async-generator / Promise execution semantics (post-#4374 remainder)

2 participants