-
Notifications
You must be signed in to change notification settings - Fork 130
fix(runner): close active requests after onActorStop has finished running #3323
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: fix(runner): close active requests after onActorStop has finished runningSummaryThis PR modifies the actor shutdown sequence to close active HTTP requests and WebSocket connections after the Code Quality & Best PracticesPositive Changes
Issues & Concerns1. Incomplete refactoring - potential bug
|
65f206c to
b372bb1
Compare
30b896a to
09512fc
Compare
Code Review - PR #3323SummaryThis PR fixes a critical bug in the actor lifecycle management by ensuring that closeActiveRequests() is called after onActorStop() completes, rather than before actor removal. This allows the onActorStop handler to send final messages over the tunnel before connections are terminated. Changes Analysisengine/sdks/typescript/runner/src/mod.tsPositive Changes:
engine/sdks/typescript/runner/src/tunnel.tsPositive Changes:
Concerns & Recommendations1. Potential Race Condition (Medium Priority)If requests arrive during onActorStop() execution, they receive a 503 Service Unavailable error and will be retried by Guard. However, there's a window where the retry might fail if the actor is fully removed before the retry completes. Recommendation: Consider adding a state flag (e.g., stopping: boolean) to the ActorInstance interface to track actors in the stopping state. 2. Error Handling in onActorStop (Low Priority)The comment mentions Pegboard will handle timeout with ACTOR_STOP_THRESHOLD_DURATION_MS but I don't see timeout enforcement in this code. Recommendation: Consider adding explicit timeout handling here, or clarify in comments where the timeout is enforced. 3. Manual Enforcement Risk (Low Priority)The comment at line 227 relies on developers remembering to call closeActiveRequests(). Since #removeActor() is private and only called from forceStopActor(), this is currently safe, but it's fragile. Recommendation: Consider making #removeActor() take a boolean flag closeRequests and enforce it, or move closeActiveRequests() inside #removeActor(). 4. Test Coverage (Medium Priority)I don't see test coverage for this specific change. The test file is commented out. Recommendation: Add a test case that verifies onActorStop() can send messages before connections close. Security ConsiderationsNo security concerns identified. The change maintains proper cleanup and doesn't introduce new attack vectors. Performance ConsiderationsMinimal performance impact. The change only reorders operations without adding new work. Final VerdictApproved with suggestions. This is a well-reasoned fix that addresses a real bug. The implementation is clean and well-documented. The suggestions above are minor improvements that could enhance robustness but are not blockers. Recommended Actions Before Merge:
Great work on identifying and fixing this issue! |
09512fc to
77aaf9c
Compare
Pull Request Review: Fix Runner Actor Stop Request HandlingSummaryThis PR fixes a critical timing issue in the TypeScript runner where active requests were being closed before onActorStop could complete, preventing cleanup code from sending messages over the tunnel during shutdown. Code Quality ✅The changes are well-structured and minimal with clear separation of concerns and appropriate documentation. Correctness ✅The fix is correct:
Potential Issues
|
102e612 to
bd0a1b7
Compare
77aaf9c to
6655e70
Compare
Pull Request ReviewSummaryThis PR fixes a timing issue where active requests were being closed before Code Quality ✅Strengths:
Potential Issues
|
Code Review - PR #3323SummaryThis PR fixes a critical timing issue in the actor shutdown lifecycle. Previously, active requests and WebSocket connections were closed before ✅ Positive Changes
|
Merge activity
|
6655e70 to
856a3ff
Compare
bd0a1b7 to
6f5d613
Compare
PR Review: Fix runner to close active requests after onActorStopOverviewThis PR fixes a critical timing issue in the actor lifecycle by ensuring that active HTTP requests and WebSocket connections are closed after onActorStop has completed, rather than before. This allows user code in onActorStop to send final messages through the tunnel before cleanup. Code Quality & Best PracticesPositive Changes
Potential Issues
Performance ConsiderationsThe onActorStop callback now blocks cleanup of active requests. If user code hangs or takes too long, requests remain open until ACTOR_STOP_THRESHOLD_DURATION_MS timeout fires. Consider documenting expected behavior and timeout values. Test CoverageThe test file is entirely commented out. Recommend adding specific tests for:
SummaryThis is a good fix that addresses a real lifecycle ordering issue. The core change is correct and important. Must Fix:
Should Consider:
Overall: Approve with minor changes recommended |
Code Review - PR #3323SummaryThis PR fixes an important timing issue in the actor shutdown lifecycle by moving the call to close active requests after the Code Quality & Best Practices ✅Strengths:
Issues Found1. Documentation Bug 🐛 (
|

No description provided.