-
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
base: 11-18-fix_pb_simplify_runner_wf
Are you sure you want to change the base?
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: make all uses of protocol handle v4 <-> v3SummaryThis PR introduces protocol version handling to support both mk1 (v1-v3) and mk2 (v4) protocol versions across the Pegboard system. The changes ensure backward compatibility when communicating between gateways, runners, and clients using different protocol versions. Code Quality & Best Practices ✅Strengths:
Minor Suggestions:
Potential Bugs or Issues
|
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
|

No description provided.