Skip to content

fix(wasm): acknowledge worker cancellation retries - #598

Open
peter-jerry-ye wants to merge 2 commits into
mainfrom
codex/wasm-worker-cancellation
Open

fix(wasm): acknowledge worker cancellation retries#598
peter-jerry-ye wants to merge 2 commits into
mainfrom
codex/wasm-worker-cancellation

Conversation

@peter-jerry-ye

@peter-jerry-ye peter-jerry-ye commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

The native cancellation protocol in #595 can notify the event loop before a job completes, while the Wasm retry check still always returns false. Use thread_pool/cancel_worker_with_retry for both initial cancellation and job-notification checks. Its result distinguishes timer retry (0), continued waiting (1), and a finished job with an available result (2), so the guest needs only one host import for both operations. Initial cancellation still waits for the completion notification to retire the worker, matching native scheduling. Moonrun keeps the historical cancellation protocol for already-compiled Wasm guests. Enable the existing worker regressions on Wasm.

Also connect the Wasm Linux port-reuse wrapper to the host socket operation and enable its existing regression coverage. This closes the compiled guest's native/Wasm API differences in the runtime backport.

This PR targets main without a GitHub stack. Merge #597 first: the worker-limit regressions enabled here assume the signal listener no longer occupies a pool worker. With the historical signal listener, the one-worker queued-job test cannot start its job. The paired Moon cancellation backport must also have reached moonbitlang/moon's main before this PR merges. This is a coordinating guest change for #595; do not apply runtime-port queue labels to it.

Signal prerequisite: #597. Paired runtime PR: moonbitlang/moon#2176.

@coveralls

coveralls commented Sep 10, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 1163

Coverage increased (+0.1%) to 77.813%

Details

  • Coverage increased (+0.1%) from the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • 49 coverage regressions across 3 files.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

49 previously-covered lines in 3 files lost coverage.

File Lines Losing Coverage Coverage
src/internal/event_loop/event_loop.mbt 35 77.01%
src/internal/event_loop/signal.mbt 13 55.88%
src/internal/event_loop/network.mbt 1 75.0%

Coverage Stats

Coverage Status
Relevant Lines: 5386
Covered Lines: 4191
Line Coverage: 77.81%
Coverage Strength: 11208.14 hits per line

💛 - Coveralls

@peter-jerry-ye
peter-jerry-ye added this pull request to stack #599 September 10, 2026 05:43
@peter-jerry-ye
peter-jerry-ye removed this pull request from stack #599 September 10, 2026 07:13
@peter-jerry-ye
peter-jerry-ye force-pushed the codex/wasm-signal-handler branch from 2975e15 to b705729 Compare September 10, 2026 07:13
@peter-jerry-ye
peter-jerry-ye force-pushed the codex/wasm-worker-cancellation branch from a342ce4 to a022acc Compare September 10, 2026 07:13
@peter-jerry-ye
peter-jerry-ye changed the base branch from codex/wasm-signal-handler to main September 10, 2026 07:13
@peter-jerry-ye
peter-jerry-ye marked this pull request as ready for review September 10, 2026 07:13
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 10, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-10T07:16:23.464570Z a022acc Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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.

3 participants