Skip to content

perf: uloop launch presses Ignore on the Safe Mode prompt sooner - #3634

Merged
hatayama merged 4 commits into
mainfrom
perf/launch-safe-mode-prompt-latency
Nov 24, 2026
Merged

hatayama merged 4 commits into
mainfrom
perf/launch-safe-mode-prompt-latency

Conversation

@hatayama

@hatayama hatayama commented Nov 24, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • uloop launch presses Ignore on Unity's "Enter Safe Mode?" prompt within a few seconds of the prompt appearing, instead of leaving it up for up to about ten seconds.
  • A dialog that blocks a launch is reported within a few seconds instead of after about five.

User Impact

  • Before: while waiting for the Editor, launch looked for a dialog first after 5 seconds and then once every 10 seconds, and pressing Ignore took a second osascript call after the look found the prompt. A project opened with compile errors could sit on the prompt for roughly 10–13 seconds.
  • After: the launch wait looks 1 second in and then 2 seconds after each look ends, and one call both reads the dialogs and presses Ignore. Measured on macOS with an osascript call log: the look that found the prompt started 2.9 s after the previous look ended (11.0 s before), and finding plus pressing took one 1.14 s call (two calls of 1.31 s and 1.26 s before).

Changes

  • Readiness waits take a dialog look schedule. Only the V3 launch wait uses the faster one; the project runner's reload wait and the V2 launch keep 5 s / 10 s. The gap between looks is now counted from the end of a look, so slow looks cannot run back to back and crowd out the readiness probes (this also stretches the default schedule's gap by the length of a look).
  • Inspector.InspectAndAnswer reads every modal dialog and, in the same osascript call (one window listing on Windows), presses the answer's label only when the frontmost dialog has the answer's title and exactly its buttons in order. Go checks the script's verdict against the dialogs it read and refuses a contradictory result.
  • Launch's Safe Mode answerer uses it. A failed look does not count as the one press, so a slow look while Unity starts cannot turn the press off.
  • PressInDialogTitled lost its only caller and is removed with the title argument it added to the press script.
  • The launch skill says launch stops at a blocking dialog within a few seconds.

Trade-off

  • A look runs between readiness probes, so an Editor that becomes ready during a look is reported only when that look ends. Looks now run more often during a launch. In one measured launch without a dialog (23.7 s), the last look ended 0.38 s before launch returned, so that look delayed it by at most 1.94 s; the actual delay could not be isolated.

Verification

  • scripts/check-go-cli.sh with GOFLAGS=-count=1 (format, vet, golangci-lint v2.15.0, all Go tests, dist check)
  • The new gap test fails when the gap is counted from the start of a look, and passes with the change
  • A launch test fails when the V3 launch waits on the default 5 s / 10 s schedule instead of its own 1 s / 2 s one
  • go run ./cmd/check-skill-size and go run ./cmd/sync-tool-docs --check
  • macOS, real Editor showing the Safe Mode prompt: the answer script pressed nothing for a wrong button order, a missing button, or another title; with the prompt's answer it pressed Ignore in one 1.20 s call, and Unity logged "Exiting safe mode"
  • macOS, uloop launch on a project with a compile error: SafeModePromptIgnored: true, the prompt found and pressed in one call
  • The Windows branch is covered by unit tests with faked window listings only
  • Coverage: common measures 93.1% on macOS both on this branch and on main, so the gap to the Linux baseline is not from this change

The launch wait looked for a dialog first after five seconds and then
at most once per ten seconds, so Unity's Safe Mode prompt could stay up
for about ten seconds before launch pressed Ignore. A launch with
compile errors meets the prompt every time, so its wait now looks one
second in and then two seconds after each look ends.

- Readiness waits take a DialogLookSchedule; the project runner's
  reload wait and the V2 launch keep the five/ten-second default.
- The gap is counted from the end of a look instead of its start: a
  look runs between probes and takes one to two seconds on macOS, so a
  start-based two-second gap would run looks back to back and delay
  noticing that the Editor became ready.
uloop launch found the prompt with one look and pressed Ignore with a
second osascript call, which reads the dialog again and takes about as
long as the look (1.3 s each, measured on macOS). The new
Inspector.InspectAndAnswer reads every modal dialog and, in the same
call, presses the answer's label when the frontmost dialog has the
answer's title and exactly its buttons; Windows presses from the one
listing it returns.

- The exact-button check moves into the script, since Go no longer
  sees the dialog between reading and pressing; Go still checks the
  script's verdict against the dialogs it read and refuses a
  contradictory result.
- A failed look does not count as launch's one press: it read nothing,
  so a slow look while Unity starts must not turn the press off.
- PressInDialogTitled lost its only caller and is removed, together
  with the title argument it added to the press script.
The launch skill said launch stops at a blocking dialog after about
five seconds; the V3 launch wait now looks one second in and every two
seconds after that.
@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The change adds configurable timing for dialog checks, combines dialog inspection with conditional button presses, and updates launch readiness and Safe Mode handling to use that operation. Launch skill notes now say that blocking dialogs stop launch within a few seconds.

Changes: Dialog inspection and launch readiness

Layer / File(s) Summary
Dialog answer operation
cli/common/unityprocess/unitydialog/*
Adds DialogAnswer, AnswerResult, and InspectAndAnswer for matching and answering dialogs on macOS and Windows. Removes title filtering from the separate button-press operation.
Configurable dialog-look schedule
cli/common/clicore/readiness_dialog.go, cli/common/clicore/tool_readiness.go, cli/common/clicore/tool_readiness_dialog_test.go
Adds configurable first-look delay and between-look gap. Subsequent looks are measured from the end of the previous look.
Launch and Safe Mode integration
cli/dispatcher/internal/dispatcher/*, .agents/skills/uloop-launch/SKILL.md, .claude/skills/uloop-launch/SKILL.md, Packages/src/Editor/CliOnlyTools~/Launch/Skill/SKILL.md, cli/dispatcher/shared-inputs-stamp.json, cli/project-runner/shared-inputs-stamp.json
Launch uses a one-second initial delay and a two-second gap for V3; V2 uses the default schedule. Safe Mode handling uses DialogAnswer and AnswerResult. The skill notes and shared-input stamps are updated.

Estimated code review effort: 4 (Complex) | ~40 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant Launch as Launch dispatcher
  participant Readiness as Tool readiness wait
  participant Lookout as DialogLookout
  participant SafeMode as SafeModePromptAnswerer
  participant Inspector as unitydialog Inspector
  participant Editor as Unity Editor
  Launch->>Readiness: Start wait with launch look schedule
  Readiness->>Lookout: Configure scheduled dialog looks
  Lookout->>SafeMode: Request dialog answer
  SafeMode->>Inspector: InspectAndAnswer(DialogAnswer)
  Inspector->>Editor: Inspect dialogs and press matching button
  Editor-->>Inspector: Dialog listing and press result
  Inspector-->>SafeMode: Return AnswerResult
  SafeMode-->>Lookout: Return dialogs after answer handling
Loading

Possibly related PRs

Merge Risk: Minimal · up to 60373

This change makes launch answer Unity's Safe Mode prompt sooner and report blocking dialogs faster. No concrete merge-blocking risk was identified. Windows behavior has only been covered by unit tests with faked window listings.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: uloop launch presses Ignore on the Safe Mode prompt sooner. The changeset matches this. It adds a faster V3 launch dialog-look schedule, a combined InspectAndAnswer ca…
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.
Description check Passed The description is specific to the changeset. It explains the V3 launch dialog look schedule change (first look after 1 second, then 2 seconds after each look ends), the new single-call InspectAndAnsw…
Full details: Title check

Explanation

The title names the main change: uloop launch presses Ignore on the Safe Mode prompt sooner. The changeset matches this. It adds a faster V3 launch dialog-look schedule, a combined InspectAndAnswer call that reads dialogs and presses Ignore in one osascript call, and a gap measured from the end of each look. The title's 'perf' prefix is a conventional commit type and does not affect the assessment.

Full details: Description check

Explanation

The description is specific to the changeset. It explains the V3 launch dialog look schedule change (first look after 1 second, then 2 seconds after each look ends), the new single-call InspectAndAnswer that reads dialogs and presses Ignore, removal of PressInDialogTitled, the skill documentation wording change, and the verification performed. These match the file-level changes in the raw summary.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between a1e7ac7 and 6037300.

Files selected for processing: 8

  • cli/dispatcher/internal/dispatcher/launch_deps.go
  • cli/dispatcher/internal/dispatcher/launch_dialog.go
  • cli/dispatcher/internal/dispatcher/launch_dialog_test.go
  • cli/dispatcher/internal/dispatcher/launch_log_file_test.go
  • cli/dispatcher/internal/dispatcher/launch_safe_mode_prompt_launch_test.go
  • cli/dispatcher/internal/dispatcher/launch_startup_timeout_error.go
  • cli/dispatcher/internal/dispatcher/launch_test.go
  • cli/dispatcher/internal/dispatcher/launch_unity_stop_test.go
Files with no reviewable changes: 1

  • cli/dispatcher/internal/dispatcher/launch_dialog.go

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.

No test failed when the V3 launch waited on the default five and ten
second schedule instead of its own one and two: every launch test
replaces the readiness wait, and the schedule was chosen inside the
wrapper they replace. The launch now hands the schedule to the wait, so
a test can see which one it asked for, and the wrapper is gone.
@hatayama
hatayama merged commit e591437 into main Nov 24, 2026
16 checks passed
@hatayama
hatayama deleted the perf/launch-safe-mode-prompt-latency branch November 24, 2026 15:18
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