feat(ocap-kernel): implement distributed garbage collection protocol#814
Open
feat(ocap-kernel): implement distributed garbage collection protocol#814
Conversation
…779) Implement the DGC protocol so that `deliverBringOutYourDead()` on a RemoteHandle sends a BOYD wire message to the remote kernel, which schedules a local reap, runs GC, and sends back drops/retires. - Widen `scheduleReap` to accept `EndpointId` (vat or remote) - Update GC action parsing to use `insistEndpointId` - Add `bringOutYourDead` delivery type to RemoteHandle - Add ping-pong prevention flag to avoid infinite BOYD loops - Add unit tests for BOYD protocol and GC endpoint widening - Add e2e tests for distributed GC in remote-comms Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||
grypez
reviewed
Feb 6, 2026
| const crankResult = await remote.deliverBringOutYourDead(); | ||
| expect(mockRemoteComms.sendRemoteMessage).toHaveBeenCalledWith( | ||
| mockRemotePeerId, | ||
| expect.any(String), |
Contributor
There was a problem hiding this comment.
Maybe worth us writing a plugin like expect.serialized({ key: value }).
Comment on lines
+168
to
+170
| expect(parsed.seq).toBe(1); | ||
| expect(parsed.method).toBe('deliver'); | ||
| expect(parsed.params).toStrictEqual(['bringOutYourDead']); |
Contributor
There was a problem hiding this comment.
From the root CLAUDE.md:
- If testing all properties of an object, use a single
toStrictEqual()on the entire object instead of multipleexpect()calls
FUDCo
approved these changes
Feb 6, 2026
Contributor
FUDCo
left a comment
There was a problem hiding this comment.
Remarkable how much of this just consisted of renaming things. Very nice.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the DGC (Distributed Garbage Collection) protocol for remote kernel communication (Issue #779).
deliverBringOutYourDead()onRemoteHandlenow sends a['bringOutYourDead']wire message to the remote kernel instead of being a no-op#remoteGcRequested) prevents infinite BOYD loops between kernelsChanges
GC store widening (
gc.ts,garbage-collection.ts):scheduleReapto acceptEndpointId(union ofVatId | RemoteId) instead of justVatIdaddGCActionsandprocessGCActionSetto useinsistEndpointIdinstead ofinsistVatIdvatId/actionsByVattoendpointId/actionsByEndpointfor clarityBOYD protocol (
RemoteHandle.ts):BringOutYourDeadDeliveryto theDeliveryParamsunion typedeliverBringOutYourDead()to send BOYD over the wire via#sendRemoteCommand'bringOutYourDead'case to#handleRemoteDeliverthat sets the ping-pong prevention flag and callsscheduleReap#remoteGcRequestedflag: when BOYD was triggered by an incoming remote request, the subsequent local BOYD is suppressedTests:
Collision note
This PR will have merge conflicts with #811 in
RemoteHandle.tsandRemoteHandle.test.ts. After merging #811, the#remoteGcRequested = trueassignment should be moved after the savepoint commit (marked with a TODO comment).Test plan
🤖 Generated with Claude Code
Note
Medium Risk
Touches kernel remote messaging and GC scheduling logic, so regressions could impact cross-kernel connectivity or object lifecycle; changes are well-covered by new unit and E2E tests but involve protocol/state-machine behavior.
Overview
Implements distributed GC across kernels by making
RemoteHandle.deliverBringOutYourDead()send a real['bringOutYourDead']wire delivery and by handling incoming BOYD deliveries by scheduling a local reap; a#remoteGcRequestedflag suppresses echo BOYD to prevent infinite ping-pong.Widens GC plumbing from vat-only to generic
EndpointId(vat or remote): GC actions parsing/validation andprocessGCActionSetnow group/process by endpoint, andscheduleReapaccepts remote IDs. Adds/updates unit and E2E coverage to verify BOYD send/receive behavior (including seq/ack + persistence), remote reap scheduling, and end-to-end DGC completion without breaking connectivity.Written by Cursor Bugbot for commit 7f4aeac. This will update automatically on new commits. Configure here.