Skip to content

fix: dynamic-code wrapper no longer drops cancellation on a sync Execute path - #1744

Merged
hatayama merged 1 commit into
feature/dynamic-code-cancellation-hardeningfrom
feat/wrapper-template-pass-cancellation-token
Jul 13, 2026
Merged

fix: dynamic-code wrapper no longer drops cancellation on a sync Execute path#1744
hatayama merged 1 commit into
feature/dynamic-code-cancellation-hardeningfrom
feat/wrapper-template-pass-cancellation-token

Conversation

@hatayama

@hatayama hatayama commented Jul 13, 2026

Copy link
Copy Markdown
Owner

Summary

  • Wrapped execute-dynamic-code snippets no longer generate an unused sync Execute() that called ExecuteAsync(..., default) and discarded the runtime cancellation token.
  • Generation stays async-only; the live path already invokes ExecuteAsync with the combined token.

User Impact

  • Before: Generated wrappers included a sync entry point that would ignore cancellation if ever used.
  • After: Only ExecuteAsync(..., ct) is generated. Cooperative cancellation on the real runtime path is unchanged and no longer shadowed by a dead sync landmine.

Changes

  • Delete sync Execute() from WrapperTemplate (design option A; runtime never called it).
  • String-level EditMode test asserts no public object Execute( / ExecuteAsync(parameters, default) / GetAwaiter().GetResult() in generated source (no compile-and-run E2E).
  • Docs/SKILL.md: no mentions of generated sync Execute() found.
  • Out of scope: pre-existing dead CommandRunner.Execute(ExecutionContext) — recorded for umbrella notes, not deleted here.

Refs

  • Spec: MasaVault 2026-07-13_uloopハング可能性の全数調査結果.md §3 PR 3-1
  • Design: /tmp/claude-shared/pr-3-1-design.md

Verification

  • uloop compile (0/0)
  • EditMode WrapperTemplateTests.Build_ShouldGenerateExecuteAsyncWithCancellationTokenAndOmitSyncExecute
  • Fable final review

Made with Cursor

Review in cubic

The runtime always invokes ExecuteAsync with the real combined token, so
the sync wrapper only discarded cancellation via ExecuteAsync(..., default).
Delete that landmine and assert the generated source stays async-only.

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

Copy link
Copy Markdown
Owner Author

LGTM (reviewer: Fable). Matches the agreed Option A design: the unused sync Execute() wrapper (which discarded the runtime token via ExecuteAsync(parameters, default) and added a sync-over-async landmine) is removed from the template, with a clear why-not comment left in place. The string-level EditMode test asserts both the presence of the ct-taking ExecuteAsync and the absence of the sync path without any compile-and-run E2E, and CommandRunner.Execute stays untouched per the dead-code policy (recorded as an umbrella-note candidate).

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 50ccaa23-10b2-46ee-a718-f4e48bdb7840

📥 Commits

Reviewing files that changed from the base of the PR and between b348ad5 and fe22737.

⛔ Files ignored due to path filters (1)
  • Assets/Tests/Editor/DynamicCodeToolTests/WrapperTemplateTests.cs.meta is excluded by none and included by none
📒 Files selected for processing (2)
  • Assets/Tests/Editor/DynamicCodeToolTests/WrapperTemplateTests.cs
  • Packages/src/Editor/FirstPartyTools/ExecuteDynamicCode/DynamicCompilation/WrapperTemplate.cs

📝 Walkthrough

Walkthrough

WrapperTemplate.Build(...) no longer generates synchronous execution code. A new NUnit fixture verifies that generated wrappers expose cancellation-aware ExecuteAsync without redundant fallback or blocking calls.

Changes

Async wrapper API

Layer / File(s) Summary
Wrapper generation and validation
Packages/src/Editor/FirstPartyTools/ExecuteDynamicCode/DynamicCompilation/WrapperTemplate.cs, Assets/Tests/Editor/DynamicCodeToolTests/WrapperTemplateTests.cs
The template emits only ExecuteAsync with a defaulted CancellationToken, while tests verify that synchronous, redundant fallback, and blocking patterns are absent.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: removing the sync Execute path that discarded cancellation.
Description check ✅ Passed The description accurately summarizes the async-only wrapper change, the test, and the out-of-scope note.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/wrapper-template-pass-cancellation-token

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
hatayama merged commit 4506a7c into feature/dynamic-code-cancellation-hardening Jul 13, 2026
1 of 2 checks passed
@hatayama
hatayama deleted the feat/wrapper-template-pass-cancellation-token branch July 13, 2026 06:53
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