-
Notifications
You must be signed in to change notification settings - Fork 150
feat(rivetkit): workflows #3734
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: 01-21-feat_rivetkit_add_actor_run_handler
Are you sure you want to change the base?
feat(rivetkit): workflows #3734
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 4 Skipped Deployments
|
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
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. |
a1796cf to
4ca7516
Compare
4ca7516 to
cff619f
Compare
cff619f to
3700d45
Compare
3700d45 to
fbdbcd3
Compare
fbdbcd3 to
246d677
Compare
70b8762 to
2fe5b7d
Compare
246d677 to
a3fbdd7
Compare
PR Review: Workflow Engine for RivetKitOverviewThis PR introduces a comprehensive durable workflow engine for RivetKit TypeScript. This is a major addition (~9,257 lines) that implements a reentrant execution framework for building fault-tolerant, long-running workflows. Summary AssessmentOverall: Strong implementation with production-ready patterns This is high-quality code that demonstrates deep understanding of durable execution semantics. The implementation includes sophisticated features like:
Code Quality AnalysisStrengths ✅
Issues & Concerns 🔍1. Critical: Race Condition in Message Consumption (High Priority)Location: export async function consumeMessage(
storage: Storage,
driver: EngineDriver,
messageName: string,
): Promise<Message | null> {
const index = storage.messages.findIndex(
(message) => message.name === messageName,
);
if (index === -1) {
return null;
}
const message = storage.messages[index];
// Delete from driver first - if this fails, memory is unchanged
await driver.delete(buildMessageKey(message.id));
// Only remove from memory after successful driver deletion
storage.messages.splice(index, 1);
return message;
}Problem: If the workflow crashes between deleting from KV and removing from memory, the message will be lost on next load (since it's deleted from KV but storage.messages still has it in memory). Impact: Message loss in crash scenarios. Recommendation: Consider a two-phase approach:
Alternatively, accept this as "at-most-once" delivery and document it clearly. 2. Performance: Excessive Metadata Loading (Medium Priority)Location: Every retry attempt loads metadata from driver. If metadata is already loaded in 3. Timeout Behavior May Be Surprising (Medium Priority)Location: The comment correctly notes that timeouts don't cancel underlying operations. This can lead to resource leaks if step operations don't respect
4. Missing Input Validation (Low Priority)Several functions lack input validation:
5. Inconsistent Error Messages (Low Priority)Some errors are user-facing while others are internal. Consider standardizing error messages with actionable guidance. Security Considerations 🔒
Performance Considerations ⚡
Test Coverage Analysis 🧪Strengths:
Gaps:
Recommendation: Add tests for KV failures, partial batch writes, concurrent messages, and loop iteration limits. Architecture Review 🏗️Isolation ModelThe driver design assumes external isolation (Durable Objects, actors). This is well-documented and appropriate. Consideration: What happens if isolation is violated? (e.g., two processes run same workflow ID)
Serialization StrategyUses BARE schema for binary serialization. Good choice for compact storage, schema evolution, and type safety. Note: Ensure BARE schema changes are backward compatible or migrations are handled. Recommendations SummaryMust Fix (Before Merge)
Should Fix (High Priority)
Nice to Have (Medium Priority)
Documentation Improvements
ConclusionThis is excellent work and demonstrates a mature understanding of durable execution patterns. The code quality is high, error handling is sophisticated, and the API is well-designed. Recommendation: APPROVE with minor fixes The identified issues are mostly documentation gaps and potential edge cases. The core implementation is solid and ready for production use with proper driver implementations. Key Action Items:
Great job on this implementation! 🎉 Reviewed using Rivet CLAUDE.md guidelines and TypeScript best practices. |
a3fbdd7 to
b4b061f
Compare
2fe5b7d to
329640c
Compare
329640c to
4e8ca02
Compare
b4b061f to
8a67460
Compare
4e8ca02 to
f1e4e30
Compare
8a67460 to
a5391dd
Compare
Pull Request Review: Workflow Engine for RivetKitThis PR introduces a comprehensive durable workflow engine to RivetKit. The implementation is well-architected with strong TypeScript types, comprehensive test coverage, and excellent documentation. StrengthsArchitecture & Design
Code Quality
Test Coverage
Documentation
Issues & RecommendationsHigh Priority
Medium Priority
Low Priority
Security & Performance
Final VerdictThis is high-quality code with excellent architecture. The implementation is production-ready with minor improvements recommended. Recommendation: APPROVE Should Fix Soon:
Estimated Effort: ~4-6 hours for all improvements Great work! The workflow engine is a solid foundation for building reliable distributed systems. |

No description provided.