-
Notifications
You must be signed in to change notification settings - Fork 135
fix: make all uses of protocol handle v4 <-> v3 #3528
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
fix: make all uses of protocol handle v4 <-> v3 #3528
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
3 Skipped Deployments
|
PR Review: Fix Protocol Version Handling (v4 ↔ v3)SummaryThis PR implements comprehensive protocol version compatibility between v4 (mk2) and v3 (mk1) of the runner protocol. The changes ensure seamless communication between gateways/runners using different protocol versions through appropriate serialization/deserialization and conversion functions. Code Quality & Architecture ✅Strengths:
Key Design Patterns:
Potential Issues 🔍1. Protocol Version Storage (Minor)Location: engine/packages/pegboard-gateway/src/lib.rs:157-172, lib.rs:301-318 The PR adds database reads for runner_protocol_version on every HTTP/WebSocket request. This adds a database read to the hot path of every request. Recommendation: Add a simple in-memory cache for runner protocol versions to avoid repeated database reads. 2. Missing mk2 Stop Command Implementation (Moderate)Location: engine/packages/pegboard/src/workflows/actor/mod.rs:324-339, 358-372, 505-517, 522-535, 651-663 Multiple places have TODO comments for mk2 stop commands. While v3 (mk1) runners receive stop commands properly, v4 (mk2) runners do not receive stop signals. This could lead to actors not being cleaned up properly or resource leaks on mk2 runners. Recommendation: Prioritize implementing the mk2 stop command mechanism or document why it is safe to skip for now. 3. Error Handling in Version Conversion (Minor)Location: engine/sdks/rust/runner-protocol/src/versioned.rs:1979-1984 Converting deprecated tunnel acks to response aborts could mask protocol issues. Consider logging a warning when this fallback is triggered. Performance Considerations ⚡The PR adds conditional serialization based on protocol version. Branch prediction should handle this efficiently since protocol version is stable per runner. No significant performance concern. Security Concerns 🔒None identified. The PR maintains the existing security model and does not introduce new attack surfaces. Test Coverage 📋Observation: No test files were modified in this PR. Recommendations:
Code Style & Conventions ✅Compliant with CLAUDE.md:
Recommendations Summary
VerdictApprove with suggestions ✅ The PR successfully implements protocol version compatibility with a solid architecture. The main concerns are:
The code is well-structured, follows conventions, and maintains backward compatibility effectively. No blocking issues identified. Review Date: 2025-12-02 |
ab6c409 to
7ddbf54
Compare
bc2bb7c to
6f07705
Compare
Pull Request Review: fix: make all uses of protocol handle v4 <-> v3SummaryThis PR implements comprehensive protocol version compatibility handling between v4 (mk2) and v3 (mk1) versions across the pegboard system. The changes ensure that the system can communicate with runners using different protocol versions. Code Quality & Best Practices ✅Strengths:
Observations:
Potential Issues & Concerns
|
Pull Request ReviewSummaryThis PR implements bidirectional protocol version compatibility between v4 (mk2) and v3 (mk1) of the runner protocol. The changes add protocol version tracking per runner and update all communication paths to handle version conversion appropriately. ✅ Strengths
🔍 Code QualityGood Practices
Areas for Improvement1. Error Handling in Ping Task (engine/packages/pegboard-runner/src/ping_task.rs:26-39) The ping logic only sends pings for mk2 protocol versions but silently does nothing for mk1. Consider adding a log statement or comment explaining why mk1 does not need pings, or implement mk1 ping support if it should be symmetric. 2. Missing Error Context (engine/packages/pegboard-gateway/src/shared_state.rs:166-186) The database read for protocol version lacks context on failure. Consider adding 3. Potential Race Condition (engine/packages/pegboard-gateway/src/lib.rs:154-171) The protocol version is read from the database for each request, but there is no guarantee it exists yet if the runner just connected. What happens if the runner has not written its protocol version yet? Should there be a default/fallback? 🐛 Potential Bugs1. Deprecated TunnelAck Conversion (engine/sdks/rust/runner-protocol/src/versioned.rs:1979-1982) The conversion from v3 2. Inconsistent Protocol Version Checks The code uses ⚡ Performance Considerations1. Database Reads Per Request (engine/packages/pegboard-gateway/src/lib.rs:164-171, lib.rs:304-315) The protocol version is read from the database for every HTTP and WebSocket request. This could be a performance bottleneck for high-traffic actors. Recommendation: Consider caching the protocol version in memory (e.g., in SharedState) since it should not change after runner initialization. 2. Message Conversion Overhead Every message going through the gateway undergoes version checking and potential conversion. While necessary, consider whether hot paths could benefit from version-specific fast paths. 🔒 Security ConcernsLow Risk: The changes do not introduce obvious security vulnerabilities. Protocol version handling appears safe. Note: Ensure that the protocol version stored in the database cannot be manipulated by untrusted actors to cause version confusion attacks. 🧪 Test CoverageMissing Test Evidence: The PR does not include visible test file changes. Recommendations:
📋 Minor Issues
🎯 RecommendationsHigh Priority
Medium Priority
Low Priority
✨ Overall AssessmentThis is a well-structured PR that comprehensively handles a complex protocol versioning requirement. The main concerns are around:
The code follows repository conventions and demonstrates good understanding of the codebase architecture. With the recommended improvements, this will be a solid foundation for multi-version protocol support. Status: Approve with recommendations for follow-up improvements ✅ |
7ddbf54 to
72a5b39
Compare
6f07705 to
9da2f02
Compare
Pull Request Review: Protocol v4 ↔ v3 CompatibilityOverviewThis PR implements comprehensive backward compatibility between protocol v4 (mk2) and v3 (mk1), ensuring that all uses of the runner protocol handle version transitions correctly. The changes span 33 files with 1,075 additions and 566 deletions. ✅ Strengths
|
PR Review: Protocol Version Handling (v4 <-> v3)This PR implements bidirectional protocol version conversion between v4 (mk2) and v3 (mk1) for the runner protocol. Overall, the implementation is comprehensive and well-structured. Here are my findings: ✅ Strengths
🐛 Potential Issues1. Missing ping message handling for mk1 runners (pegboard-runner/src/ping_task.rs:26-38)The ping task only sends ping messages for mk2 runners: if protocol::is_mk2(conn.protocol_version) {
let ping_msg = versioned::ToClientMk2::wrap_latest(...);
// send ping
}Issue: mk1 (v3) runners won't receive ping messages, which could cause them to timeout. Either add an else branch for mk1 pings or document why they're not needed. 2. Potential race condition in protocol version reads (pegboard-gateway/src/lib.rs:159-171 & 301-314)The code reads runner protocol version from the database in parallel with subscribing to actor stopped events: let (mut stopped_sub, runner_protocol_version) = tokio::try_join!(
self.ctx.subscribe(...),
udb.run(|tx| async move {
tx.read(&ProtocolVersionKey::new(runner_id), Serializable).await
})
)?;Issue: If the runner hasn't fully initialized yet, the protocol version might not be set. Consider adding error handling or a default fallback. 3. Inconsistent error handling in version conversion (versioned.rs:1979-1982)When converting DeprecatedTunnelAck from v3 to v4: v3::ToServerTunnelMessageKind::DeprecatedTunnelAck => {
// v4 removed DeprecatedTunnelAck, this should not occur in practice
// but if it does, we'll convert it to a response abort as a safe fallback
v4::ToServerTunnelMessageKind::ToServerResponseAbort
}Issue: Silently converting to ResponseAbort could hide protocol issues. Consider logging a warning when this occurs or returning an error. 4. Missing protocol version validationThe code doesn't validate that the protocol version read from the database is actually a supported mk2 version (v4). Consider adding validation: if !protocol::is_mk2(runner_protocol_version) {
// handle unsupported version
}🔒 Security Considerations
🎯 Code Quality
|
72a5b39 to
360920a
Compare
9da2f02 to
5d9024f
Compare
Code Review - Protocol Version Compatibility (v4 <-> v3)SummaryThis PR adds comprehensive handling for protocol version compatibility between v4 (mk2) and v3 (mk1) across the pegboard system. The changes enable proper protocol translation and version-aware message serialization. Positive Aspects ✅
Issues & Concerns
|
360920a to
7837fe9
Compare
5d9024f to
246cd19
Compare
PR Review: Protocol v4 ↔ v3 CompatibilitySummaryThis PR implements bidirectional protocol compatibility between v4 (mk2) and v3 (mk1) for the Rivet runner protocol. The changes enable seamless communication between runners using different protocol versions by storing each runners protocol version in the database and dynamically selecting the appropriate serialization format. ✅ Strengths1. Well-Structured Protocol Versioning
2. Database-Backed Version Tracking
3. Backward Compatibility
|
246cd19 to
1c47db0
Compare
7837fe9 to
42b489e
Compare
Merge activity
|

No description provided.