Skip to content

runtime: fix canonical call context and drop delivery semantics - #375

Merged
lannbot merged 1 commit into
mainfrom
fix/wasmtime-async-semantics
Sep 14, 2026
Merged

lannbot merged 1 commit into
mainfrom
fix/wasmtime-async-semantics

Conversation

@lannbot

@lannbot lannbot commented Sep 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fix spec-confirmed bugs found through the supplementary Wasmtime async corpus, and adopt the operator-authorized drop-delivery correction from component-model PR719.

  • Give synchronous FACT calls and host-boundary realloc their required fresh canonical task/thread context. Preserve logical identity separately from physical JSPI continuation ownership, including deferred admission, nested yield, cancellation, and post-hop trap cleanup.
  • Resolve async-start post-return through the post-return table, not the callback table. Apply post-return restrictions only at verified FACT post_return import edges, preserving normal references to the same function.
  • Report a genuinely admission-blocked async callee as STARTING without draining its unrelated lock holder. Preserve eager FACT behavior and allow legal core-start synchronous calls without inventing an outer task.
  • Accept declaration-only components containing unused blocking imports; validate wrapping against actual constructed entries.
  • Deliver stream DROPPED at event consumption after peer drop while preserving progress; retain completed future values and upgrade cancelled future events only when the peer is gone. Assumption pinned to PR719 head35e9769957627c2bee5cd445b998b08b3c652c86; Component Model submodule unchanged. Its larger paired-end refactor is not adopted.
  • Avoid O(count) allocation for guest-to-guest payloadless streams. Trap invalid error-context result areas before realloc instead of leaking an internal assertion.

Real translated regressions cover nested/deferred admission and suspension, after-hop trap cleanup, cancellation while waiting, post-return restrictions and import-edge locality. Drop-delivery tests exercise detached original buffers, exact/partial/zero progress, real wait/poll/cancel/drop paths, and max-count packing. Mutation checks proved the delivery and nested-suspension regressions fail without their fixes.

Coverage delta

Supplementary Wasmtime: 29 formerly failed commands now pass:

  • 9 declaration-only instantiations
  • 17 context/task assertions and cascades
  • 3 bounds/count assertions

New census: 88 files / 850 commands; 544 passed (343 setup,201 assertions),128 classified failures,4 deferred-thread skips,174 excluded commands, zero unexpected outcomes or infrastructure failures. Diagnostic-only mismatches remain classified; no broad message equivalences were added. Related gaps remain tracked by #372.

Official corpus: sync-streams:208 now passes. Removed that exact xfail and adjusted aggregate counts; retained WebKit's independent multi-memory cascade overlay.

Verification

  • Independent scoped reviews and final integration review: LGTM.
  • All recipes of just gates < /dev/null completed across the full run and resumed remaining recipes. Initial lint/type and old test-identity failures were corrected; a later shell run stopped only at the proven stale aggregate count, then just shells browsers smoke-tls smoke-c0 < /dev/null passed after updating it.
  • Runtime:1037 passed,0 failed,3 existing ignored. Seeded runtime:1034 passed,0 failed,6 existing ignored.
  • Official corpus:1286 passed commands,125 xfail,0 unexpected failures; seeded1283 passed. Existing deferred/profile exclusions remain.
  • Supplementary Wasmtime FIFO/seed and public guest gates passed.
  • Pinned SpiderMonkey/Node and findings-only Bun match expectations; JSC pinned skipped on arm64. Chromium/Firefox page,worker,shared-worker and OPFS lanes passed.
  • TLS/C0 smokes passed with existing not-applicable/translation-only cases. No consumer edits were made; full before/after snapshots were recorded for the main gate run, but the resumed smoke run did not obtain a complete fresh pre-run snapshot.
  • Logs: /tmp/opencode/wasmtime-async-fixes-gates.log, /tmp/opencode/wasmtime-async-fixes-remaining-gates.log.

No manifests, protocol marks, or convention goldens changed. Automerge will be armed and watched through delivery.

@lannbot
lannbot enabled auto-merge September 14, 2026 05:31
@lannbot
lannbot merged commit 509f3a5 into main Sep 14, 2026
3 checks passed
@lannbot
lannbot deleted the fix/wasmtime-async-semantics branch September 14, 2026 05:36
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.

2 participants