-
Notifications
You must be signed in to change notification settings - Fork 135
chore: remove msg id parts from protocol, move id utils to runner protocol crate #3508
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
3 Skipped Deployments
|
Pull Request ReviewThis PR refactors message ID handling in the runner protocol. Overall the architectural changes are sound, but there is a critical bug that needs fixing. Critical Issue - Protocol Conversion BugLocation: engine/sdks/rust/runner-protocol/src/versioned.rs lines 264 and 597 In the v3_to_v2 conversion functions for both ToClient and ToServer, there is incorrect slice copying logic. The code copies from request_id into message_id before request_id is fully initialized, and writes message_index to the wrong array. Current problematic code at line 264:
This will break v2/v3 protocol compatibility. Code QualityStrengths:
Minor Issues:
Other ObservationsSecurity: ID collision handling is reasonable with 100 retry attempts, though 32-bit request IDs may see collisions around 65k concurrent requests. Current retry logic handles this gracefully. Performance: Moving to structured types and fixed-size arrays is good for performance. Test Coverage: No tests added for the new util.rs functions or protocol conversion logic. Recommend adding unit tests for these critical paths. Architecture: Excellent separation of concerns moving ID utilities to protocol crate. Dependency changes appropriately reduce coupling. Recommendations
Verdict |
31af31a to
8dcebb7
Compare
37a57d1 to
66d58b1
Compare
Pull Request ReviewThis PR refactors message ID handling by removing parsing functions from the pegboard crate and consolidating ID utilities into the runner-protocol crate. Overall, this is a good architectural improvement that better encapsulates protocol concerns. Positive Changes
Code Quality ObservationsGood practices:
Minor concerns:
Testing Recommendations
Security and PerformanceNo security concerns identified. Performance should improve slightly by removing string parsing operations. SummaryThis is a solid refactoring that improves code organization. Main suggestions: clarify log messages and verify v2/v3 conversion comments match implementation. Recommendation: Approve with minor suggestions |
Pull Request ReviewThis PR refactors the message ID handling by consolidating ID utilities into the ✅ Strengths
🔍 Areas for Improvement1. Missing error context in versioned.rs:264// Line 264 in versioned.rs
request_id[8..10].copy_from_slice(&msg.message_id.message_index.to_le_bytes());This line copies 2 bytes of Recommendation: Add a comment explaining why message_index is being written to the request_id buffer, or refactor for clarity. 2. Incomplete util.rs documentationThe Recommendation:
3. Hard-coded message_index in version conversionIn versioned.rs lines 189 and 525, when converting from v2 to v3, the code sets message_index: 0, // Hard-codedQuestion: Is this correct behavior? If we're converting an existing v2 message that might have been mid-stream, should we preserve some message ordering information? This could potentially cause issues with message ordering during protocol version transitions. 4. Silent message drop without loggingIn shared_state.rs:310, when a message is received for a disconnected request, it only logs at debug level: tracing::debug!(
request_id=%protocol::util::id_to_string(&message_id.request_id),
"in flight has already been disconnected, dropping message"
);Recommendation: Consider using 5. Removed debug loggingLine 188 in shared_state.rs removed this debug log: - tracing::debug!(?message_id, ?payload, "shared state send message");Question: Was this intentional? This could make debugging tunnel message issues harder. If the payload is too large to log, consider adding structured logging with just the message ID and payload size. 6. Error message changeLine 76 in tunnel_to_ws_task.rs changes the error message from: - tracing::warn!("websocket message timeout");
+ tracing::warn!("garbage collected");Recommendation: "garbage collected" is less descriptive than "websocket message timeout". Consider keeping the original message or using "websocket garbage collected due to timeout" for clarity. 🔐 Security Considerations
🧪 Testing Recommendations
📝 Minor Nitpicks
✅ What's Working Well
🎯 SummaryThis is a well-executed refactoring that improves code organization and type safety. The main concerns are:
After addressing these items, this PR will be in excellent shape. Great work on maintaining backwards compatibility through the versioned protocol system! Recommendation: Approve with minor revisions to address the confusing buffer manipulation and consider the logging changes. Review generated with assistance from Claude Code |
Merge activity
|

No description provided.