Skip to content

fix(ocap-kernel): deserialize CapData rejections in queueMessage RPC handler#928

Merged
grypez merged 2 commits intomainfrom
grypez/fix-rpc-error-propagation
Apr 9, 2026
Merged

fix(ocap-kernel): deserialize CapData rejections in queueMessage RPC handler#928
grypez merged 2 commits intomainfrom
grypez/fix-rpc-error-propagation

Conversation

@grypez
Copy link
Copy Markdown
Contributor

@grypez grypez commented Apr 9, 2026

Vat rejections are serialized as CapData objects before leaving the vat
runtime. Previously, callers of Kernel.queueMessage (the RPC handler and
SubclusterManager) each had their own isCapData/kunser call-site patches
to convert them back into plain Errors. Consolidate the deserialization
into Kernel.queueMessage itself so all callers see plain Error objects
without needing individual workarounds.


Note

Medium Risk
Changes the error propagation contract of Kernel.queueMessage to unwrap CapData rejections into plain Errors, which can affect all callers and tests that previously inspected serialized rejection shapes.

Overview
Kernel message errors now surface as plain Errors. Kernel.queueMessage() catches CapData-shaped rejections from the run queue and deserializes them via kunser before throwing, while non-CapData failures are rethrown unchanged.

This removes duplicate CapData-unwrapping logic from SubclusterManager and updates RPC/unit/e2e/integration tests to assert rejects.toThrow(...) (or regex) instead of matching on a serialized { body: ... } rejection payload. The ocap-kernel changelog is updated to document the fix.

Reviewed by Cursor Bugbot for commit b672c99. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 78.59%
🟰 ±0%
8631 / 10981
🔵 Statements 78.4%
🟰 ±0%
8767 / 11181
🔵 Functions 76.13%
🟰 ±0%
2019 / 2652
🔵 Branches 76.29%
⬆️ +0.02%
3715 / 4869
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/ocap-kernel/src/Kernel.ts 88.39%
⬆️ +0.43%
77.77%
⬆️ +1.30%
82.6%
🟰 ±0%
88.39%
⬆️ +0.43%
288-291, 308, 332, 407-417, 505, 573, 639-642, 655, 665-666, 709, 726
packages/ocap-kernel/src/vats/SubclusterManager.ts 95.65%
⬆️ +0.58%
90.16%
⬆️ +1.28%
100%
🟰 ±0%
95.58%
⬆️ +0.58%
194-197, 251, 334, 339-341, 349
Generated in workflow #4263 for commit b672c99 by the Vitest Coverage Report Action

@grypez grypez force-pushed the grypez/fix-rpc-error-propagation branch 2 times, most recently from 4aca412 to 0b1de28 Compare April 9, 2026 15:34
@grypez grypez changed the title fix(kernel-node-runtime): propagate vat rejection messages in RPC err… fix(ocap-kernel): deserialize CapData rejections in queueMessage RPC handler Apr 9, 2026
@grypez grypez marked this pull request as ready for review April 9, 2026 17:28
@grypez grypez requested a review from a team as a code owner April 9, 2026 17:28
Vat rejections are serialized as CapData objects before leaving the vat
runtime. Previously, callers of Kernel.queueMessage (the RPC handler and
SubclusterManager) each had their own isCapData/kunser call-site patches
to convert them back into plain Errors. Consolidate the deserialization
into Kernel.queueMessage itself so all callers see plain Error objects
without needing individual workarounds.

([#928](#928))
@grypez grypez force-pushed the grypez/fix-rpc-error-propagation branch from 0b1de28 to 2c83090 Compare April 9, 2026 17:59
…zation

All callers of kernel.queueMessage now receive plain Error objects for
vat rejections instead of raw CapData. Update 8 test files across
evm-wallet-experiment, kernel-node-runtime, and kernel-test to assert
rejects.toThrow() instead of rejects.toMatchObject({ body: ... }).
@grypez grypez enabled auto-merge April 9, 2026 18:31
Copy link
Copy Markdown
Member

@rekmarks rekmarks left a comment

Choose a reason for hiding this comment

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

LGTM!

@grypez grypez added this pull request to the merge queue Apr 9, 2026
Merged via the queue into main with commit 8a1b6d0 Apr 9, 2026
54 of 57 checks passed
@grypez grypez deleted the grypez/fix-rpc-error-propagation branch April 9, 2026 19:06
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