-
Notifications
You must be signed in to change notification settings - Fork 141
fix(rivetkit): fix runner reconnection bug #3800
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
base: main
Are you sure you want to change the base?
Conversation
|
🚅 Deployed to the rivet-pr-3800 environment in rivet-frontend
🚅 Deployed to the rivet-pr-3800 environment in rivet-frontend-website-preview
|
How to use the Graphite Merge QueueAdd the label merge-queue to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
5f085e1 to
23802e1
Compare
223a3c5 to
1c0e2ca
Compare
Code Review: Runner Reconnection Bug FixThis PR addresses a critical bug in the runner reconnection logic by fixing duplicate WebSocket connections and race conditions during reconnection. The changes are well-targeted and improve the robustness of the WebSocket lifecycle management. Summary of Changes
Positive Aspects ✅
Concerns and Recommendations
|
Pull Request Review: fix(rivetkit): fix runner reconnection bugSummaryThis PR fixes a WebSocket reconnection bug by:
Code Quality ✅Positive Changes:
Potential Issues
|
PR Review: fix(rivetkit): fix runner reconnection bugSummaryThis PR fixes a reconnection bug in the runner by making the following changes:
Code Quality ✅Positive changes:
Potential Issues 🔍1. Type Declaration Inconsistency (Critical)Location: The type guard __webSocketReady(): this is this & {
__pegboardWebSocket: NonNullable<Runner["#pegboardWebSocket"]>; // ⚠️ Incorrect
}Problem: This creates a type mismatch. The type guard asserts that Impact: Code using this type guard expects
Recommended fix: __webSocketReady(): this is this & {
'#pegboardWebSocket': NonNullable<Runner["#pegboardWebSocket"]>;
}Or better yet, since the WebSocket is now private, remove the type assertion entirely and just make it a simple boolean check: #webSocketReady(): boolean {
return !!this.#pegboardWebSocket && this.#pegboardWebSocket.readyState === 1;
}2. Error Logging LevelLocation: this.log?.error("found duplicate pegboardWebSocket, closing previous");Consideration: Using 3. Missing Context in LogsLocation: this.log?.info("clearing previous reconnect timeout in schedule reconnect");Suggestion: Add context about why this is happening: this.log?.info({
msg: "clearing previous reconnect timeout to avoid duplicates",
reconnectAttempt: this.#reconnectAttempt,
});This follows the structured logging pattern used elsewhere in the codebase. Performance Considerations ✅No performance concerns. The changes are minimal and only add safety checks. Security Concerns ✅Positive: Making Test Coverage
|

No description provided.