feat: keep editor ticking while unfocused via scoped SignalTick pump#1963
Conversation
Unfocused Unity editors throttle their update loop, which stalls CLI-driven compile/test work. A pure state machine decides when SignalTick pumping should stay active (open scopes or a short trailing window) so the later editor glue can keep ticks flowing without leaving the pump on permanently. Co-authored-by: Cursor <cursoragent@cursor.com>
Wire the scoped SignalTick pump around each JSON-RPC request so unfocused editors keep advancing while CLI work runs, and fire a one-shot SignalTick after scheduling unexpected server-loop recovery so delayCall is not stranded while the editor is asleep. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Warning Review limit reached
Next review available in: 19 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 Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds an editor tick pump controlled by active CLI scopes and a trailing activity window. The pump is registered at startup, wrapped around RPC processing, and triggered for delayed server recovery. Tests cover scope counting, startup activity, and trailing-window boundaries. ChangesAuto-tick pump integration
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant CLI
participant JsonRpcRequestProcessor
participant AutoTickPumpService
participant EditorApplicationTickBridge
CLI->>JsonRpcRequestProcessor: submit RPC request
JsonRpcRequestProcessor->>AutoTickPumpService: BeginScope
AutoTickPumpService->>EditorApplicationTickBridge: SignalTick
JsonRpcRequestProcessor->>JsonRpcRequestProcessor: ExecuteMethod
EditorApplicationTickBridge->>AutoTickPumpService: invoke Pump
AutoTickPumpService->>EditorApplicationTickBridge: SignalTick while scope or trailing window is active
JsonRpcRequestProcessor->>AutoTickPumpService: dispose scope
🚥 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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.
Inline comments:
In `@Packages/src/Editor/Infrastructure/Threading/AutoTickPumpService.cs`:
- Around line 23-24: Update AutoTickPumpService startup and external
SignalTick/Pump handling so the initial one-shot wake cannot be discarded by the
16 ms throttle; ensure an early callback either bypasses throttling or schedules
a retry that guarantees continued pumping for an active scope. Preserve
throttling for subsequent ticks and add a service-level test covering the
startup/BeginScope race before the throttle interval elapses.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: e4fa60ea-3fac-450e-a89e-369c7b9684d1
⛔ Files ignored due to path filters (4)
Assets/Tests/Editor/AutoTickPumpControllerTests.cs.metais excluded by none and included by nonePackages/src/Editor/Infrastructure/Threading/AutoTickPumpConstants.cs.metais excluded by none and included by nonePackages/src/Editor/Infrastructure/Threading/AutoTickPumpController.cs.metais excluded by none and included by nonePackages/src/Editor/Infrastructure/Threading/AutoTickPumpService.cs.metais excluded by none and included by none
📒 Files selected for processing (7)
Assets/Tests/Editor/AutoTickPumpControllerTests.csPackages/src/Editor/Infrastructure/Api/JsonRpcRequestProcessor.csPackages/src/Editor/Infrastructure/InfrastructureEditorStartup.csPackages/src/Editor/Infrastructure/Server/UnityCliLoopServerController.csPackages/src/Editor/Infrastructure/Threading/AutoTickPumpConstants.csPackages/src/Editor/Infrastructure/Threading/AutoTickPumpController.csPackages/src/Editor/Infrastructure/Threading/AutoTickPumpService.cs
An unfocused editor has no natural update loop, so if the one-shot wake from BeginScope/Register is swallowed by the 16ms throttle, the self- sustaining SignalTick chain never starts. Leave the throttle stopwatch unstarted until the first successful pump. Co-authored-by: Cursor <cursoragent@cursor.com>
Summary
delayCallwork stranded forever.SignalTickafter scheduling recovery, so backgrounded idle editors wake up enough to run the recovery path.Notes
Test plan
AutoTickPumpControllerTests— 6/6 pass (filter: regexAutoTickPumpControllerTests)uloop compile— ErrorCount 0, WarningCount 0uloop compileruns while the terminal (not Unity) has focus — both Success