-
Notifications
You must be signed in to change notification settings - Fork 129
feat(pb): add reschedule_ts to actors #3363
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
|
PR Review: Add reschedule_ts to actorsSummaryThis PR adds a new Code Quality & Best PracticesPositive observations:
Areas for improvement:
Potential Bugs or Issues
Performance Considerations
Security Concerns
Test CoverageObservation: While the changes are relatively straightforward, consider adding test coverage for:
Suggested test locations:
Additional Recommendations
SummaryOverall, this is a solid PR that adds useful observability into actor rescheduling behavior. The main concerns are:
The code follows Rivet conventions well and the implementation is clean. Nice work! 🎉 |
1c1606e to
948f0cc
Compare
16af8a1 to
63252c2
Compare
PR Review: Add reschedule_ts to actorsThanks for this PR! I've reviewed the changes and have some feedback below. SummaryThis PR adds a
Code Quality & Best PracticesPositive:
Issues:
// Before: create_ts, pending_allocation_ts, start_ts, sleep_ts, connectable_ts, destroy_ts
// After: create_ts, start_ts, pending_allocation_ts, connectable_ts, sleep_ts, reschedule_ts, destroy_tsWhile this new ordering is more chronological (create → start → pending → connectable → sleep → reschedule → destroy), this change seems unrelated to the main feature. Consider keeping this in a separate refactoring PR or document the rationale in the PR description.
Potential BugsCritical:
let mut ctx = StandaloneCtx::new(...)?;
ctx.from_workflow = true;
Ok(ctx) // This returns ctx, not new_ctxThe original code had Medium:
state.reschedule_ts = Some(now + i64::try_from(backoff.current_duration())?);While state.reschedule_ts = Some(
now.checked_add(i64::try_from(backoff.current_duration())?)
.ok_or_else(|| anyhow\!("timestamp overflow"))?
);Minor:
let mut backoff = reschedule_backoff(state.reschedule_state.retry_count);The Performance ConsiderationsGood:
Neutral:
Minor concern:
Security ConcernsNo security issues identified. The changes are internal state management with no user input handling or privilege escalation paths. Test CoverageMissing:
Recommendations:
Additional Observations
if state.start_ts.is_none() {
state.start_ts = Some(util::timestamp::now());
}This is a subtle behavioral change. Previously,
// Before: let next_wait = self.wait * 2usize.pow(...) + randomness
// After: let next_wait = self.current_duration() + randomnessThis ensures consistent calculation between RecommendationsMust fix:
Should fix:
Nice to have:
Overall, this is a solid PR that adds useful observability for actor rescheduling. The main gaps are test coverage and some minor clarity issues. Great work on the documentation improvements! |
PR Review: feat(pb): add reschedule_ts to actorsSummaryThis PR adds a Code Quality & Best PracticesPositive:
Issues:
Potential Bugs & Issues
Performance Considerations
Security ConcernsNo security issues identified. The changes are internal state management and don't expose new attack surfaces. Test CoverageCRITICAL ISSUE: No tests included This PR modifies critical actor scheduling logic but includes no tests. The following should be tested:
Recommendation: Add at least basic unit tests for the backoff calculation and integration tests for the reschedule flow before merging. Additional Observations
RecommendationsBefore merging:
Nice to have:
VerdictThe PR is well-structured and follows project conventions, but it lacks test coverage for critical scheduling logic. The bug fix in
Great work on the documentation additions and the clean implementation of the state tracking! |
948f0cc to
c934952
Compare
63252c2 to
7547022
Compare
Code Review for PR #3363: feat(pb): add reschedule_ts to actorsOverviewThis PR adds a Positive Aspects ✅
Issues & Concerns 🔴1. Critical: Potential Integer Overflow (runtime.rs:735)state.reschedule_ts = Some(now + i64::try_from(backoff.current_duration())?);Issue: While Recommendation: Use checked arithmetic: state.reschedule_ts = Some(
now.checked_add(i64::try_from(backoff.current_duration())?)
.ok_or_else(|| anyhow::anyhow\!("reschedule_ts overflow"))?
);2. Bug: Incorrect Backoff Calculation (backoff.rs:88)let next_wait = self.current_duration() + rand::thread_rng().gen_range(0..self.randomness);Issue: The refactored code in let next_wait = self.wait * 2usize.pow(self.i.min(self.max_exponent) as u32) + randomnessBut now it uses Impact: The backoff timing will be incorrect - it will use the backoff for iteration Recommendation: Revert this change or ensure 3. Inconsistent Timestamp Clearing (runtime.rs:732)if reset {
state.reschedule_ts = None;
}Issue: When the retry count is reset, Recommendation: Consider clearing this field when an actor successfully allocates, not when resetting retry count. This would provide more accurate state. 4. Missing Field ClearingThe
Recommendation: Add explicit clearing in appropriate activities:
5. Versioning MissingThe #[serde(default)]
retry_count: usize,While Recommendation: Add a comment explaining the version change and what differs from v1. Code Quality Observations 📋Good:
Could Improve:
Performance Considerations ⚡
Security Concerns 🔒
Recommendations SummaryMust Fix (before merge):
Should Fix: Nice to Have: VerdictThe PR adds useful observability for actor scheduling, but has two critical bugs that need to be addressed:
Please address these issues before merging. Once fixed, this will be a solid improvement to actor state tracking. |
Code ReviewSummaryThis PR adds a Positive Aspects✅ Good documentation: The OpenAPI schema and type definitions include clear descriptions of what Issues & Concerns1. Critical Bug: Incorrect backoff calculation in
|
c934952 to
d3a8681
Compare
7547022 to
4d3c3c9
Compare
4d3c3c9 to
b8fface
Compare
PR Review: Add reschedule_ts to actorsSummaryThis PR adds a Code Quality & Best Practices✅ Strengths
🔍 Code Quality Issues1. Backoff calculation refactoring (packages/util/src/backoff.rs:88) The refactor extracts // Old (line 88-89):
let next_wait = self.wait * 2usize.pow(self.i.min(self.max_exponent) as u32)
+ rand::thread_rng().gen_range(0..self.randomness);
// New (line 88):
let next_wait = self.current_duration() + rand::thread_rng().gen_range(0..self.randomness);Issue: The old code added randomness to the calculated duration. The new code does the same, so this is correct - good refactor! ✓ 2. State mutation timing in compare_retry activity (packages/pegboard/src/workflows/actor/runtime.rs:731-736) The if reset {
state.reschedule_ts = None;
} else {
let backoff = reschedule_backoff(input.retry_count);
state.reschedule_ts = Some(now + i64::try_from(backoff.current_duration())?);
}Concern: This calculation happens during the activity but uses Recommendation: Either:
3. start_ts only set on first start (packages/pegboard/src/workflows/actor/runtime.rs:750-752) if state.start_ts.is_none() {
state.start_ts = Some(util::timestamp::now());
}Question: This changes behavior so If yes, great! If not, this is a behavioral change that should be highlighted. Potential BugsNone identified - The code appears functionally correct, though see timing concern above. Performance Considerations✅ No concerns - The changes are minimal:
Security Concerns✅ No concerns - The
Test CoverageNo tests were added for:
Recommendation: Add tests to verify the
Additional Observations
Recommendations Summary
Overall, this is a solid PR that improves observability into actor rescheduling. The main concern is the potential off-by-one issue in the reschedule timestamp calculation. |
Code Review: feat(pb): add reschedule_ts to actorsOverviewThis PR adds a Positive Observations
Issues and Concerns1. Bug in Backoff Calculation
|
Pull Request Review: Add reschedule_ts to actorsOverviewThis PR adds a Positive Aspects
Issues & Concerns1. Logic Bug in
|
Merge activity
|

No description provided.