chore: Move tool execution session state into Domain#1578
Conversation
Extract the single-flight execution slot state into a Domain session so the Application service only orchestrates tool execution and preserves busy exception shaping.
|
Warning Review limit reached
Next review available in: 27 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 (1)
📝 WalkthroughWalkthroughIntroduces ChangesTool Execution Concurrency Gate
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant UnityCliLoopToolExecutionService
participant ToolExecutionSession
Client->>UnityCliLoopToolExecutionService: ExecuteToolAsync(toolName)
UnityCliLoopToolExecutionService->>ToolExecutionSession: TryEnter(toolName)
alt entered
ToolExecutionSession-->>UnityCliLoopToolExecutionService: entered = true
UnityCliLoopToolExecutionService->>UnityCliLoopToolExecutionService: execute tool
UnityCliLoopToolExecutionService->>ToolExecutionSession: Exit()
else busy
ToolExecutionSession-->>UnityCliLoopToolExecutionService: entered = false, runningToolName
UnityCliLoopToolExecutionService->>UnityCliLoopToolExecutionService: CreateBusyException(runningToolName)
UnityCliLoopToolExecutionService-->>Client: busy error
end
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 |
Document why the JSON-RPC security shape test uses an undefined security enum value while the production enum currently only exposes None.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
Assets/Tests/Editor/JsonRpcRequestProcessorCliVersionGateTests.cs (1)
592-605: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueDuplicate registrar-construction wiring.
CreateRegistrarServiceWithToolSettingsre-implements the same wiring asCreateRegistrarService/UnityCliLoopToolRegistrarTestFactory.Createinstead of extending the shared factory to accept an optionalIToolSettingsPort. Test-only duplication, low risk, but could drift if the registrar constructor signature changes again.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@Assets/Tests/Editor/JsonRpcRequestProcessorCliVersionGateTests.cs` around lines 592 - 605, The registrar setup is duplicated between CreateRegistrarService, CreateRegistrarServiceWithToolSettings, and UnityCliLoopToolRegistrarTestFactory.Create, so update the shared test factory to accept an optional IToolSettingsPort and have both helpers delegate to it. Refactor the wiring in UnityCliLoopToolRegistrarTestFactory and CreateRegistrarServiceWithToolSettings to reuse the same construction path instead of manually instantiating UnityCliLoopToolRegistrarService, keeping the test helpers aligned if the registrar constructor changes again.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@Assets/Tests/Editor/JsonRpcRequestProcessorCliVersionGateTests.cs`:
- Around line 592-605: The registrar setup is duplicated between
CreateRegistrarService, CreateRegistrarServiceWithToolSettings, and
UnityCliLoopToolRegistrarTestFactory.Create, so update the shared test factory
to accept an optional IToolSettingsPort and have both helpers delegate to it.
Refactor the wiring in UnityCliLoopToolRegistrarTestFactory and
CreateRegistrarServiceWithToolSettings to reuse the same construction path
instead of manually instantiating UnityCliLoopToolRegistrarService, keeping the
test helpers aligned if the registrar constructor changes again.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 98d5b865-0a38-4126-a5f9-3ed2fbca66ed
⛔ Files ignored due to path filters (2)
Assets/Tests/Editor/ToolExecutionSessionTests.cs.metais excluded by none and included by nonePackages/src/Editor/Domain/ToolExecutionSession.cs.metais excluded by none and included by none
📒 Files selected for processing (4)
Assets/Tests/Editor/JsonRpcRequestProcessorCliVersionGateTests.csAssets/Tests/Editor/ToolExecutionSessionTests.csPackages/src/Editor/Application/UnityCliLoopToolExecutionService.csPackages/src/Editor/Domain/ToolExecutionSession.cs
Summary
User Impact
Changes
ToolExecutionSessionandToolExecutionSessionEnterResultin Domain.Verification
dist/darwin-arm64/uloop compile --project-path "$(git rev-parse --show-toplevel)"dist/darwin-arm64/uloop run-tests --project-path "$(git rev-parse --show-toplevel)" --test-mode EditMode --filter-type regex --filter-value "io.github.hatayama.UnityCliLoop.Tests.Editor.ToolExecutionSessionTests.*"dist/darwin-arm64/uloop run-tests --project-path "$(git rev-parse --show-toplevel)" --test-mode EditMode --filter-type regex --filter-value "io.github.hatayama.UnityCliLoop.Tests.Editor.UnityCliLoopToolExecutionServiceTests.*"dist/darwin-arm64/uloop run-tests --project-path "$(git rev-parse --show-toplevel)" --test-mode EditMode --filter-type regex --filter-value "io.github.hatayama.UnityCliLoop.Tests.Editor.JsonRpcRequestProcessorCliVersionGateTests.*"