Skip to content

feat(ocap-kernel): use E() for kernel service invocation to support remote presences#872

Merged
rekmarks merged 3 commits intomainfrom
rekm/remotable-services
Mar 7, 2026
Merged

feat(ocap-kernel): use E() for kernel service invocation to support remote presences#872
rekmarks merged 3 commits intomainfrom
rekm/remotable-services

Conversation

@rekmarks
Copy link
Copy Markdown
Member

@rekmarks rekmarks commented Mar 7, 2026

Description

Switches KernelServiceManager.invokeKernelService() to use E() from @endo/eventual-send instead of direct property access. This enables CapTP remote presences (whose methods aren't enumerable) to be registered as kernel service objects — a separate process can now create an exo, register it on the kernel over CapTP, and have vats invoke methods on it seamlessly.

Changes

  • KernelServiceManager.ts — Replace direct service[method]() invocation with E(service)[method](), removing the manual method-exists check (E() handles this natively)
  • kernel-facet.ts — Add registerKernelServiceObject to the kernel facet so it's callable over CapTP
  • captp-service-client.js (new) — Worker thread that sets up a CapTP connection to the kernel, creates a test exo, and registers it as a kernel service
  • captp-service-vat.ts (new) — Minimal vat that calls E(testService).doSomething(3, 4) and returns the result
  • captp-service.test.ts (new) — E2E test proving the full round-trip: worker registers exo over CapTP → vat invokes method → call traverses CapTP → result returns
  • service.test.ts — Fix assertion for error message format change (exact match → regex)
  • captp.integration.test.ts — Add registerKernelServiceObject to mock kernel (required by makeKernelFacet)

Testing

The core behavior change is unit-tested in KernelServiceManager.test.ts (updated to cover both local exo and remote presence scenarios). The new e2e test in packages/nodejs/test/e2e/captp-service.test.ts validates the full CapTP round-trip: a real kernel, a worker thread acting as a CapTP client, and a bundled vat that invokes the remotely-registered service. The existing kernel-test service test and kernel-browser-runtime integration tests continue to pass with the updated assertions.


Note

Medium Risk
Changes the kernel’s service invocation path to use E() (asynchronous eventual-send) and exposes service registration over the kernel facet, which can affect error propagation and method resolution for all kernel services.

Overview
Kernel services can now be implemented as remote CapTP presences. KernelServiceManager.invokeKernelService() switches from direct service[method](...) calls to E(service)[method](...), enabling proxy/presence objects whose methods aren’t enumerable.

The kernel facet now exposes registerKernelServiceObject, and tests/mocks are updated accordingly (including looser assertions around error formatting under eventual-send/SES).

Adds a Node.js e2e that spawns a worker CapTP client to register a service exo over CapTP and verifies a vat can call it end-to-end; updates dependencies (@endo/eventual-send in ocap-kernel, @endo/captp for nodejs tests).

Written by Cursor Bugbot for commit e9cd1c0. This will update automatically on new commits. Configure here.

rekmarks and others added 3 commits March 6, 2026 13:56
…emote presences

Switch invokeKernelService from direct property access to E() from
@endo/eventual-send, enabling CapTP remote presences to be registered
as kernel service objects. Expose registerKernelServiceObject on the
kernel facet so callers over CapTP can register services.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…mote presence

Proves the full round-trip: a worker thread creates an exo, registers it
on the kernel over CapTP, a real vat invokes a method on it, the call
traverses CapTP back to the worker, and the result returns.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@rekmarks rekmarks requested a review from a team as a code owner March 7, 2026 00:30
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 7, 2026

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 76.09%
⬇️ -0.02%
6632 / 8715
🔵 Statements 75.98%
⬇️ -0.02%
6738 / 8867
🔵 Functions 73.95%
🟰 ±0%
1653 / 2235
🔵 Branches 75.35%
⬇️ -0.03%
2468 / 3275
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/ocap-kernel/src/KernelServiceManager.ts 93.87%
⬇️ -0.77%
88.88%
⬇️ -2.02%
100%
🟰 ±0%
93.87%
⬇️ -0.77%
193-198
packages/ocap-kernel/src/kernel-facet.ts 100%
🟰 ±0%
100%
🟰 ±0%
100%
🟰 ±0%
100%
🟰 ±0%
Generated in workflow #3884 for commit e9cd1c0 by the Vitest Coverage Report Action

Copy link
Copy Markdown
Contributor

@sirtimid sirtimid left a comment

Choose a reason for hiding this comment

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

LGTM!

@rekmarks rekmarks added this pull request to the merge queue Mar 7, 2026
Merged via the queue into main with commit 4e5da63 Mar 7, 2026
29 checks passed
@rekmarks rekmarks deleted the rekm/remotable-services branch March 7, 2026 01:31
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