fix: execute-dynamic-code returns retryable guidance when runtime is disposed mid-reset#1762
Conversation
Reset/reload can dispose the scheduler while Execute is in flight. Catch ObjectDisposedException only around runtime awaits so CLI gets Success=false with compile-wait-style NextActions instead of a raw ODE, while Warm treats ODE as a silent incomplete warm. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Important Review skippedNo new commits to review since the last review. ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughDynamic code execution now handles disposed runtimes as controlled restarting failures, exposes retry guidance through responses, treats warmup disposal as recoverable, and adds tests for retry and successful follow-up execution. ChangesDynamic runtime restart handling
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant ExecuteDynamicCodeUseCase
participant DynamicCodeExecutionRuntime
participant DynamicCodeExecutionResponseFactory
ExecuteDynamicCodeUseCase->>DynamicCodeExecutionRuntime: Execute dynamic code
DynamicCodeExecutionRuntime-->>ExecuteDynamicCodeUseCase: ObjectDisposedException
ExecuteDynamicCodeUseCase->>DynamicCodeExecutionResponseFactory: Create restarting result
DynamicCodeExecutionResponseFactory-->>ExecuteDynamicCodeUseCase: Failure and recovery actions
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ 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 |
|
@coderabbitai review |
✅ Action performedReview finished.
|
Summary
execute-dynamic-codethat hits a disposed runtime now returnsSuccess=falsewith clear retry guidance instead of a rawObjectDisposedException.User Impact
uloop launch -ris not first-line). Warm remains silent on ODE.Design (agreed plan A)
try-catch exception (documented)
catch (ObjectDisposedException)is used under the allowed pattern “catch at a boundary and return an explicit error value.”ExecuteAsync/TryExecuteIfIdleAsyncawaits (and the Warm sequence’s runtime work). Not the whole UseCase method.dynamic_code_runtime_restarting.Warm asymmetry (fixed by tests)
entered=falsestyle).Success=false+ restartingErrorMessage+NextActions.Repro context from PR 6-1
Confirmed pattern: Warm succeeds → Reset → Execute hits disposed facade/scheduler and throws ODE. This PR maps that Execute-path ODE so agents see a recoverable restart signal.
Changes
UnityCliLoopConstants.ExecuteDynamicCodeResponse.NextActions+ factory helpers for the restarting response.IDynamicCodeExecutionRuntimedouble (Execute → retryable; Warm → no-op then success).Verification
dist/darwin-arm64/uloop compile --project-path <PROJECT_ROOT>→ Successuloop run-tests(regex) for the two new UseCase tests → Passed (2/2)Test plan
ERROR_MESSAGE_DYNAMIC_CODE_RUNTIME_RESTARTINGand NextActions mentioning retry / launch -r not neededMade with Cursor