Skip to content

feat: keep editor ticking while unfocused via scoped SignalTick pump#1963

Merged
hatayama merged 3 commits into
v3-betafrom
feature/autotick-pump
Jul 23, 2026
Merged

feat: keep editor ticking while unfocused via scoped SignalTick pump#1963
hatayama merged 3 commits into
v3-betafrom
feature/autotick-pump

Conversation

@hatayama

@hatayama hatayama commented Jul 23, 2026

Copy link
Copy Markdown
Owner

Summary

  • Unfocused Unity Editors throttle their update loop, which used to stall CLI-driven compile/test progress and leave server-recovery delayCall work stranded forever.
  • This PR adds a scoped SignalTick pump: each JSON-RPC request opens a scope, and pumping continues for a short trailing window after the last activity (including domain-reload startup) so the editor keeps ticking only while uloop has work to do.
  • Unexpected server-loop exits now also fire a one-shot SignalTick after scheduling recovery, so backgrounded idle editors wake up enough to run the recovery path.

Notes

  • Modal dialogs that block the main thread are out of scope; tick reservation cannot unblock them.
  • The Go CLI focus-forcing path is intentionally unchanged; narrowing those conditions is left for a follow-up once this pump has production soak time.

Test plan

  • AutoTickPumpControllerTests — 6/6 pass (filter: regex AutoTickPumpControllerTests)
  • uloop compile — ErrorCount 0, WarningCount 0
  • Full EditMode suite once — FailedCount 0 (2355 passed, 7 pre-existing skipped)
  • Smoke: two consecutive uloop compile runs while the terminal (not Unity) has focus — both Success

Review in cubic

hatayama and others added 2 commits July 23, 2026 23:04
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>
@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

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 Plus

Run ID: e189bad0-1843-4105-9f7c-8904fffb4425

📥 Commits

Reviewing files that changed from the base of the PR and between 468fe9c and a0e021d.

📒 Files selected for processing (1)
  • Packages/src/Editor/Infrastructure/Threading/AutoTickPumpService.cs
📝 Walkthrough

Walkthrough

Adds 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.

Changes

Auto-tick pump integration

Layer / File(s) Summary
Pump state and lifecycle rules
Packages/src/Editor/Infrastructure/Threading/AutoTickPumpConstants.cs, Packages/src/Editor/Infrastructure/Threading/AutoTickPumpController.cs, Assets/Tests/Editor/AutoTickPumpControllerTests.cs
Defines pump intervals and trailing-window timing, tracks active scopes and activity timestamps, and tests the resulting pump decisions.
Editor pump service wiring
Packages/src/Editor/Infrastructure/Threading/AutoTickPumpService.cs, Packages/src/Editor/Infrastructure/InfrastructureEditorStartup.cs, Packages/src/Editor/Infrastructure/Api/JsonRpcRequestProcessor.cs
Registers editor callbacks, throttles SignalTick, exposes disposable pump scopes, and wraps RPC processing in a scope.
Recovery wake-up signaling
Packages/src/Editor/Infrastructure/Server/UnityCliLoopServerController.cs
Signals an editor tick after scheduling delayed recovery from an unexpected server-loop exit.

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
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: scoped SignalTick pumping to keep unfocused editors ticking.
Description check ✅ Passed The description matches the changeset and accurately covers the scoped pump, recovery wake-up tick, and testing.
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 unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/autotick-pump

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 3a8817e and 468fe9c.

⛔ Files ignored due to path filters (4)
  • Assets/Tests/Editor/AutoTickPumpControllerTests.cs.meta is excluded by none and included by none
  • Packages/src/Editor/Infrastructure/Threading/AutoTickPumpConstants.cs.meta is excluded by none and included by none
  • Packages/src/Editor/Infrastructure/Threading/AutoTickPumpController.cs.meta is excluded by none and included by none
  • Packages/src/Editor/Infrastructure/Threading/AutoTickPumpService.cs.meta is excluded by none and included by none
📒 Files selected for processing (7)
  • Assets/Tests/Editor/AutoTickPumpControllerTests.cs
  • Packages/src/Editor/Infrastructure/Api/JsonRpcRequestProcessor.cs
  • Packages/src/Editor/Infrastructure/InfrastructureEditorStartup.cs
  • Packages/src/Editor/Infrastructure/Server/UnityCliLoopServerController.cs
  • Packages/src/Editor/Infrastructure/Threading/AutoTickPumpConstants.cs
  • Packages/src/Editor/Infrastructure/Threading/AutoTickPumpController.cs
  • Packages/src/Editor/Infrastructure/Threading/AutoTickPumpService.cs

Comment thread Packages/src/Editor/Infrastructure/Threading/AutoTickPumpService.cs Outdated
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>
@hatayama
hatayama merged commit 64bef8a into v3-beta Jul 23, 2026
11 checks passed
@hatayama
hatayama deleted the feature/autotick-pump branch July 23, 2026 14:27
@github-actions github-actions Bot mentioned this pull request Jul 23, 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