Skip to content

fix: preserve nullish errors in child worker - #229

Open
Dnyanesh-29 wants to merge 1 commit into
accordproject:mainfrom
Dnyanesh-29:fix/worker-nullish-error-reporting
Open

Dnyanesh-29 wants to merge 1 commit into
accordproject:mainfrom
Dnyanesh-29:fix/worker-nullish-error-reporting

Conversation

@Dnyanesh-29

Copy link
Copy Markdown
Contributor

Summary

  • Preserve error diagnostics when child-process JavaScript evaluation throws null or undefined.
  • Prevent a secondary exception in the worker's error handler from suppressing the IPC error reply.
  • Preserve the existing worker error envelope and close-based settlement behavior.

Problem

The child worker previously called err.toString() when handling thrown values.

Because null and undefined have no toString() method, this caused a secondary exception before the worker could send the original error diagnostic to its parent.

As a result, the parent received an exit failure without the expected IPC error message.

Fix

Handle nullish thrown values explicitly, while retaining existing formatting and IPC behavior for other thrown values.

The change is limited to the worker's catch block and focused regression tests.

Tests

Added real child-process regression coverage for throw null and throw undefined, including an ordinary Error control.

Both nullish cases failed against the original worker and passed after the correction.

Validation:

  • 196 unit tests passed across 19 suites.
  • 46 snapshots passed without changes.
  • 6 Chromium tests passed.
  • License, TypeScript build, ESLint, webpack build, and git diff --check passed.

Related work

Related to #228, which proposes stable Fault semantics and deterministic template execution.

This PR addresses an existing worker diagnostic-loss defect. It does not implement the proposed Fault contract, deterministic sandbox, or other requirements of #228.

AI assistance

Codex assisted with the implementation, regression tests, and review.

Signed-off-by: Dnyanesh-29 <dnyaneshbharambe2006@gmail.com>
@Dnyanesh-29
Dnyanesh-29 requested review from a team and a balanced review from Copilot November 15, 2026 18:56

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@mira-accord-project

Copy link
Copy Markdown
Contributor

Thank you for this pull request, which keeps null and undefined errors from the child worker intact. Dan Selman maintains this repository and has been requested as reviewer. Continuous integration runs need a maintainer's approval before they start, so that is the next step. A maintainer will reply here once they have reviewed the change.


Posted automatically by Mira, an Accord Project agent. A maintainer will follow up; they make the decisions on this.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants