Skip to content

fix: harden execute-dynamic-code against reload busy sticks and worker lifecycle races#1765

Merged
hatayama merged 4 commits into
v3-betafrom
feature/dynamic-code-slot-recovery
Jul 13, 2026
Merged

fix: harden execute-dynamic-code against reload busy sticks and worker lifecycle races#1765
hatayama merged 4 commits into
v3-betafrom
feature/dynamic-code-slot-recovery

Conversation

@hatayama

@hatayama hatayama commented Jul 13, 2026

Copy link
Copy Markdown
Owner

Summary

  • execute-dynamic-code no longer stays permanently busy after Undo/reload mishaps, and reset-crossing disposed-runtime failures now return clear retry guidance.
  • Shared Roslyn worker lifecycle no longer briefly resurrects after server reset, and first-time worker DLL builds no longer freeze the Unity main thread.

User Impact

  • Before: After reload/reset, dynamic-code could report permanent “already in progress”, surface raw ObjectDisposedException, briefly revive a Roslyn worker during shutdown races, or block the Editor while building the worker DLL.
  • After: Slot leaks are fixed, disposed-runtime maps to restarting/retry guidance, shutdown uses a generation latch so retries cannot revive the worker, and worker DLL builds run on the thread pool with the existing timeout safety net.

Included PRs

Editor gate (required before merge)

Repo-local dist/darwin-arm64/uloop against this checkout:

  1. compile → Success
  2. two execute-dynamic-code calls → Success / Success (no busy stick)
  3. RequestScriptReload (client may see retryable disconnect during reload)
  4. two post-reload execute-dynamic-code calls → Success / Success, no already in progress

Notes: /tmp/claude-shared/group6-editor-gate.md, /tmp/claude-shared/group6-umbrella-notes.md

Follow-ups (do not block)

See umbrella notes: distinct busy diagnostics, main-thread Undo path, shared_worker_lifecycle_closed → 6-2 UX mapping, string-match restarting identification, Host StartWorkerProcess test coverage compromise.

Test plan

  • CI green on v3-beta target
  • Spot-check post-reload execute-dynamic-code is not permanently busy
  • Optional: delete temp Roslyn worker DLL and confirm Editor stays responsive during rebuild

Made with Cursor

Review in cubic

hatayama and others added 4 commits July 14, 2026 00:38
…oad (#1761)

Co-authored-by: Cursor <cursoragent@cursor.com>
…disposed mid-reset (#1762)

Co-authored-by: Cursor <cursoragent@cursor.com>
@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@hatayama, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 19 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9aae3575-eeea-4d69-9c9c-b6f145cb4a07

📥 Commits

Reviewing files that changed from the base of the PR and between 247cb0c and e408f69.

⛔ Files ignored due to path filters (3)
  • Packages/src/Editor/FirstPartyTools/ExecuteDynamicCode/Execution/CommandRunnerExecutionSlot.cs.meta is excluded by none and included by none
  • Packages/src/Editor/FirstPartyTools/ExecuteDynamicCode/Execution/CommandRunnerUndoHooks.cs.meta is excluded by none and included by none
  • tests/DynamicCodeExecutionScheduler.UnitTests/DynamicCodeExecutionScheduler.UnitTests.csproj is excluded by none and included by none
📒 Files selected for processing (16)
  • Assets/Tests/Editor/DynamicCodeToolTests/ExecuteDynamicCodeUseCaseTests.cs
  • Assets/Tests/Editor/DynamicCodeToolTests/SharedRoslynCompilerWorkerHostTests.cs
  • Packages/src/Editor/FirstPartyTools/ExecuteDynamicCode/DynamicCodeExecutionResponseFactory.cs
  • Packages/src/Editor/FirstPartyTools/ExecuteDynamicCode/DynamicCompilation/SharedRoslynCompilerWorkerAssemblyBuilder.cs
  • Packages/src/Editor/FirstPartyTools/ExecuteDynamicCode/DynamicCompilation/SharedRoslynCompilerWorkerHost.cs
  • Packages/src/Editor/FirstPartyTools/ExecuteDynamicCode/DynamicCompilation/SharedRoslynCompilerWorkerSession.cs
  • Packages/src/Editor/FirstPartyTools/ExecuteDynamicCode/ExecuteDynamicCodeResponse.cs
  • Packages/src/Editor/FirstPartyTools/ExecuteDynamicCode/ExecuteDynamicCodeUseCase.cs
  • Packages/src/Editor/FirstPartyTools/ExecuteDynamicCode/Execution/CommandRunner.cs
  • Packages/src/Editor/FirstPartyTools/ExecuteDynamicCode/Execution/CommandRunnerExecutionSlot.cs
  • Packages/src/Editor/FirstPartyTools/ExecuteDynamicCode/Execution/CommandRunnerUndoHooks.cs
  • Packages/src/Editor/FirstPartyTools/ExecuteDynamicCode/Execution/DynamicCodeExecutionScheduler.cs
  • Packages/src/Editor/FirstPartyTools/ExecuteDynamicCode/Execution/DynamicCodeExecutionSchedulerHooks.cs
  • Packages/src/Editor/ToolContracts/UnityCliLoopConstants.cs
  • tests/DynamicCodeExecutionScheduler.UnitTests/CommandRunnerExecutionSlotTests.cs
  • tests/DynamicCodeExecutionScheduler.UnitTests/DynamicCodeExecutionSchedulerTests.cs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/dynamic-code-slot-recovery

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@hatayama

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@hatayama
hatayama merged commit 625282d into v3-beta Jul 13, 2026
10 checks passed
@hatayama
hatayama deleted the feature/dynamic-code-slot-recovery branch July 13, 2026 16:19
@github-actions github-actions Bot mentioned this pull request Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant