fix: dynamic-code shutdown no longer waits forever on stuck user code#1746
Conversation
ShutdownAsync no longer waits forever when in-flight user code ignores cancellation. After the timeout it completes waiters with a warning while deferring pool dispose to the running action's finally, keeping the scheduler Unity-free via an injected log hook. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Warning Review limit reached
Next review available in: 31 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
LGTM (reviewer: Fable). Matches the agreed Option A design: bounded WhenAny wait with a cancelable Delay (timer cleaned up on the normal path), timeout completes the shutdown TCS via TrySetResult(true) while pool dispose stays deferred to the running action's finally, warning goes through an injected hooks sink so the scheduler stays Unity-free (Debug.LogWarning wired at the facade edge), and the domain-reload fire-and-forget path is untouched. The three tests cover idle, cooperative-cancel, and ignore-cancel timeout including the deferred single dispose and re-entrant ShutdownAsync. Verified locally: 9/9 green at a5994f2. One informational note (no change needed): a canceled Task.Delay does not feed UnobservedTaskException — only faulted tasks do — so the ContinueWith observer is harmless but not strictly required. |
26d48e9
into
feature/dynamic-code-cancellation-hardening
Summary
ShutdownAsyncnow waits at most 5s (ctor-overridable) for in-flight work to finish disposing resources.User Impact
execute-dynamic-codeuser code ignored cancellation.Changes
TrySetResult(true)+ warning; no force-dispose under a running action.LogWarninginjected viaDynamicCodeExecutionSchedulerHooks; facade wiresDebug.LogWarning(scheduler stays pure C#).Task.Delayso early completion does not leave a timeout timer running.Refs
/tmp/claude-shared/pr-3-2-design.md/tmp/claude-shared/pr-3-2-review-answers.mdVerification
dotnet test tests/DynamicCodeExecutionScheduler.UnitTests(9/9)uloop compile0/0Made with Cursor