Skip to content

CM-4: sync-streams.wast:145 overfits wasmtime's scheduler — upstream test-defect filing kit #43

Description

@lann

Decision (operator, 2026-08-10)

Source+trace verification (exams/wasmtime-exclusivity/wasmtime-actual-semantics.md, PR pending) showed the CM-4 premise was wrong: wasmtime does NOT release its instance-entry gate at resolution. wasmtime = hold rule (gate spans the whole core invocation, like definitions.py's exclusive_thread) + deferred entry decision (an async-lowered caller learns STARTING only after the instance's runnable work is exhausted; ready gate-holders run to exit first) + FIFO queue. deltic currently ships release-at-resolution + eager start — more permissive than wasmtime (admits same-instance execution during a resolved task's mid-frame park; the IROH-1 RefCell collision is reachable here, unreachable under wasmtime). Under the standing 'wasmtime-becomes-the-spec' assumption, deltic migrates to the wasmtime model.

Target semantics (order-robust formulation)

  1. Gate lifetime: exclusiveThread held from entry to invocation exit (initial invocation and each callback invocation), NOT released at resolution mid-frame. Reverts the release-at-BLOCK-for-resolved-holders rule.
  2. Entry decision: an async-lowered guest→guest call reports STARTING only if the callee is still unstarted after the instance's runnable work has been drained to quiescence (not FIFO-pop-one — must stay green under DELTIC_SCHED_SEED shuffles, unlike wasmtime's own FIFO-dependent pass).
  3. DeliverEvent parity: event delivery to a parked-between-invocations callback task is gated the same way as entry (wasmtime concurrent.rs:765).

Affected code (from the release-rule annotations)

  • runtime/src/task/mod.ts:337-340 (resolved-holder release at block; needsExclusive/enter/exit)
  • runtime/src/exec/boundary.ts:1611-1660 (held-guarded callback loop → returns to always-holding invariant), :627, :1170-1184
  • runtime/src/jspi/bridge.ts:540-577 (UPSTREAM DIVERGENCE block — release-at-BLOCK for resolved tasks)
  • lower trampolines / scheduler: deferred entry evaluation (design: where the drain runs; JSPI suspendability classification of async-lowered call trampolines; plain-path impact must stay zero for sync-only components per contracts/intrinsics.md)
  • harness/src/xfail.ts:321 comment (references the old model)

Gates

  • cargo build --workspace; cargo test -p translator-shim -p bindgen -p testgen
  • (cd runtime && deno task check && deno task test)
  • (cd harness && deno task conformance) — incl. sync-streams.wast green, plus DELTIC_SCHED_SEED=1 and =4242 reruns
  • (cd ct-runner && deno task test); wasi-shims, ports as affected
  • exams/iroh-endpoint: expected to flip from ~90% trap to deterministic green (the IROH-1 window closes) — rerun and update upstream-consumer-findings.md IROH-1
  • New targeted runtime test: pump/poke shape asserting STARTING while a resolved holder is parked-unready, admission only after its exit (the wasmtime-model expectations, NOT cm4-run-tests.patch's release-rule expectations)

Authorities

  • exams/wasmtime-exclusivity/wasmtime-actual-semantics.md (trace + line refs, both wasmtime vintages)
  • exams/wasmtime-exclusivity/trace-sync-streams-wasmtime-dev.log
  • third_party/component-model definitions.py (gate lifetime — now agreed with wasmtime)
  • architecture.md §1 corpus-exception clause (corrected wording in the same PR)

Scheduler-core: single-owner track (coder-hard at most) under close orchestrator review, per AGENTS.md.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions