Skip to content

fix(workers): preserve missing-module startup errors - #194935

Merged
steipete merged 3 commits into
mainfrom
wa-worker-error-diagnostics
Nov 8, 2026
Merged

steipete merged 3 commits into
mainfrom
wa-worker-error-diagnostics

Conversation

@steipete

@steipete steipete commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes: a missing worker module can replace its useful startup error with DataCloneError and terminate the native worker supervisor.

User Impact

Users receive the original module failure and the failed worker joins cleanly. Non-Error object-valued diagnostic causes become text; primitive causes and real Error metadata remain structured.

Why This Change Was Made

Native host objects in loader-error causes need not be structured-cloneable. The existing error encoder now renders non-Error objects, functions, and symbols as diagnostic text before transport. It owns the normalization, replacing raw-object forwarding without runtime checks. The extra work occurs only while encoding failures.

The tests reuse a shared/cyclic error fixture and the existing supervisor recovery scenario. They cover the missing-module failure, then prove a healthy sibling still exchanges messages and joins. Native error types, shared references, cycles, falsy suppressed values, and opaque diagnostic values remain covered. The final diff adds 16 production lines and removes 2 test lines; no test-budget increase remains.

Evidence

  • Removes OpenClaw's dependency on fix(worker_threads): keep loader error causes cloneable oven-sh/bun#46711 for forwarding loader error causes.
  • macOS arm64, stock Bun main 2596ac5d: the real retained-worker missing-module path fails with DataCloneError before the change and preserves the original loader error plus native join after it. The final consolidated supervisor regression also fails on the base and passes after the fix.
  • The same regression passes on the repository-pinned Bun fork 191755ec11 and Node 26.12.1. Final focused coverage: 8/8 on each runtime.
  • Final full owning files: pinned fork 17/17 passed; Node 17/17 passed. Stock: 16 passed, with one unchanged raw-Worker async-context fixture failing before the retained-worker path (fix(worker_threads): preserve async context for worker events oven-sh/bun#42593).
  • Test-file execution: encoder 0.08–0.23 s; lifecycle 17.2–25.8 s, including its existing 15-second resource-lifetime fixture. Harness wall time including local scheduling was 20.2 s (stock), 40.6 s (fork), and 40.5 s (Node).
  • Strict targeted production-config encoder typecheck, lint, formatting, and staged test-line ratchet pass.
  • The first CI attempt exposed a 65-line inherited test-budget overage despite the initial exact allocation. The tests were consolidated while retaining the cases above; net test growth is now negative and the allocation was removed.
  • Fresh Codex autoreview at P0–P2: scoped-clean for the complete final candidate against c339698bbd7; no actionable findings. Exact-head CI completed successfully in 553 seconds: https://github.com/openclaw/openclaw/actions/runs/42436833695.

Render non-Error diagnostic causes before forwarding native worker failures so loader host objects cannot replace the original error with DataCloneError. Keep primitive causes and structured Error metadata, and verify the real supervisor error and join path on stock Bun, the pinned fork, and Node.

Removes the native error-forwarding dependency on oven-sh/bun#46711.
@clawsweeper

clawsweeper Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review ended

ClawSweeper stopped reviewing this revision because the pull request closed.

View the workflow run.

@steipete
steipete marked this pull request as ready for review November 8, 2026 01:48
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-08T02:04:43.830839Z cc2e640 New commits
ℹ️ 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.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 8, 2026
Reuse one shared and cyclic error graph, extend the downlevel value table, and cover missing worker entries inside the existing supervisor recovery flow before its healthy sibling control. Preserve the original cases while reducing test lines by two against the PR base; remove the now-unneeded allocation.
@steipete
steipete merged commit 058133d into main Nov 8, 2026
119 of 121 checks passed
@steipete
steipete deleted the wa-worker-error-diagnostics branch November 8, 2026 02:17
@steipete

steipete commented Nov 8, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 8, 2026
* fix(workers): preserve missing-module startup errors

Render non-Error diagnostic causes before forwarding native worker failures so loader host objects cannot replace the original error with DataCloneError. Keep primitive causes and structured Error metadata, and verify the real supervisor error and join path on stock Bun, the pinned fork, and Node.

Removes the native error-forwarding dependency on oven-sh/bun#46711.

* fix(workers): narrow serialized diagnostic scalars explicitly

* test(workers): consolidate native failure regressions

Reuse one shared and cyclic error graph, extend the downlevel value table, and cover missing worker entries inside the existing supervisor recovery flow before its healthy sibling control. Preserve the original cases while reducing test lines by two against the PR base; remove the now-unneeded allocation.
maplel pushed a commit to maplel/openclaw that referenced this pull request Nov 24, 2026
* fix(workers): preserve missing-module startup errors

Render non-Error diagnostic causes before forwarding native worker failures so loader host objects cannot replace the original error with DataCloneError. Keep primitive causes and structured Error metadata, and verify the real supervisor error and join path on stock Bun, the pinned fork, and Node.

Removes the native error-forwarding dependency on oven-sh/bun#46711.

* fix(workers): narrow serialized diagnostic scalars explicitly

* test(workers): consolidate native failure regressions

Reuse one shared and cyclic error graph, extend the downlevel value table, and cover missing worker entries inside the existing supervisor recovery flow before its healthy sibling control. Preserve the original cases while reducing test lines by two against the PR base; remove the now-unneeded allocation.

(cherry picked from commit 058133d)

Release adaptation: Only cloneable diagnostic normalization and encoder/lifecycle regressions. Later inherited-code fix 416b357 is independent, not prerequisite; supervisor timing and plugin startup rewrites excluded.

Follow-up dispositions: d82e097 test(process): wait for broker failure before retained replacement (openclaw#202539); 416b357 fix: preserve the real reason a worker failed; 907e17b fix(plugins): avoid Gateway stalls during source preparation (openclaw#200320); adb660f fix: allow retrying refused native worker cleanup (openclaw#198240)

Validation: Direct exported encoder/decoder: baseline fails 3 non-Error diagnostic cases; fixed passes 3; primitive and Error graph regression retained. Normal wrapper lifecycle proof pending compiled-worker setup. diff --check passes.

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit cb68af332a1182ed21b39c10b53b1f6e3036461c)
(cherry picked from commit 7a4af04d616ab677c58fa1f369b947bef45c382a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant