generated from MetaMask/metamask-module-template
-
Notifications
You must be signed in to change notification settings - Fork 6
feat(remote-comms): Add incarnation ID infrastructure and handshake module #800
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
sirtimid
wants to merge
3
commits into
main
Choose a base branch
from
sirtimid/issue-689-foundation
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+739
−1
Conversation
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
…odule Add foundation for incarnation detection without wiring it to behavior: - Add getOrCreateIncarnationId() to store for unique kernel instance tracking - Add setRemoteIncarnation() to peer state manager for tracking remote incarnations - Add handshake module with inbound/outbound handshake functions - Extend initializeRemoteComms RPC schema to accept incarnationId parameter (not yet passed through to implementation) This is part 1 of a 2-PR series to add incarnation detection support. Co-Authored-By: Claude Opus 4.5 <[email protected]>
Contributor
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
rekmarks
requested changes
Feb 2, 2026
Member
rekmarks
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like it'll work when wired up! Just a couple of inline things.
- Refactor isHandshakeMessage tests to use it.each() for readability - Rename getOrCreateIncarnationId to provideIncarnationId Co-Authored-By: Claude Opus 4.5 <[email protected]>
rekmarks
approved these changes
Feb 2, 2026
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
getOrCreateIncarnationId()to store for unique kernel instance trackingsetRemoteIncarnation()to peer state manager for tracking remote incarnationsinitializeRemoteCommsRPC schema to acceptincarnationIdparameterDetails
This is part 1 of a 2-PR series to add incarnation detection support (issue #689).
No behavior change - This PR adds the capability without using it yet. The
incarnationIdparameter is accepted by the RPC schema but not yet wired through to the transport layer.Part 2 (PR #788) will wire up the handshake protocol and integrate incarnation detection into the reconnection lifecycle.
Test plan
getOrCreateIncarnationId()in storesetRemoteIncarnation()in peer state managerinitializeRemoteCommsschema acceptingincarnationId🤖 Generated with Claude Code
Note
Medium Risk
Medium risk because it introduces new network handshake/timeout behavior and extends persisted state (kernel/peer incarnation IDs), even though the new handshake isn’t yet integrated into the live comms flow.
Overview
Adds incarnation-ID infrastructure to support detecting peer restarts. The kernel store now persists a UUID
incarnationIdviaprovideIncarnationId(), andPeerStateManagertracksremoteIncarnationIdper peer withsetRemoteIncarnation()returning whether it changed.Introduces a new
handshakemodule that exchangeshandshake/handshakeAckmessages over aChannel, with read/write timeouts and validation viaisHandshakeMessage(). ExtendsinitializeRemoteCommsRPC params schema to accept an optionalincarnationId(currently parsed/validated but intentionally not forwarded to the hook), with accompanying unit tests.Written by Cursor Bugbot for commit 27fde8b. This will update automatically on new commits. Configure here.