Skip to content

fix: recover keyboard key state after pause-point interruption with ReleaseAll#1965

Merged
hatayama merged 2 commits into
feature/pause-point-round9from
fix/keyboard-state-after-pause-interruption
Jul 23, 2026
Merged

fix: recover keyboard key state after pause-point interruption with ReleaseAll#1965
hatayama merged 2 commits into
feature/pause-point-round9from
fix/keyboard-state-after-pause-interruption

Conversation

@hatayama

@hatayama hatayama commented Jul 23, 2026

Copy link
Copy Markdown
Owner

Summary

  • Reproduce and fix keyboard state corruption after a pause-point interrupts simulate-keyboard Press: discard pending Input System apply subscriptions on pause, and sync ButtonControl wasPressedThisFrame latches on cleanup so a quick resume cannot look like a re-press.
  • Add paused-tolerant ReleaseAll (device + bookkeeping) with ReleasedKeys in the response, and expose it in default-tools.json (no protocol bump; release-input stamps refreshed).
  • Extend scripts/regression-harness-key-state-after-pause-interruption.sh with two Green scenarios: resume within 3s must not re-press, and >6s pause → ReleaseAll → fresh Press succeeds.

User Impact

After a pause-point hits during keyboard simulation, agents can recover stuck key state with ReleaseAll (even while still paused), and a fast resume no longer silently re-applies a discarded press edge.

Test plan

  • EditMode: KeyboardKeyStateServiceTests (ClearTrackedKeys bookkeeping)
  • PlayMode: KeyboardInputSimulationResponseFactoryTests (Interrupted message includes queued input edge was discarded)
  • uloop compile 0 errors
  • scripts/check-go-cli.sh exit 0
  • scripts/regression-harness-key-state-after-pause-interruption.sh exit 0 (scenarios 1–3)

Evidence notes

  • Repro B Gate: after >6s pause, PressEdgeKeyAlreadyPressedBeforeQueue=true with KeyUp KeyStateTrackedHeld=false (device vs bookkeeping divergence).
  • Delayed-delivery check: resume within 3s previously restored devicePressed=True / sticky IsSpaceHeld without new CLI input; root cause was a stale m_LastUpdateWasPress latch after wasPressedThisFrame monitoring, plus pending-apply discard on pause. Post-fix harness scenario 2 is Green.

Review in cubic

…eleaseAll

Pause-point hits during Press left ButtonControl wasPressedThisFrame latches
and queued applies able to look like a re-press after resume, and bookkeeping
could diverge from the device. Discard pending applies on pause, sync press
latches on cleanup, add paused-tolerant ReleaseAll, and extend the harness
with quick-resume and long-pause recovery scenarios.

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

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@hatayama, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 9 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: 3f1ba98b-a555-4831-976e-27bca7a1fcfc

📥 Commits

Reviewing files that changed from the base of the PR and between 4dcbcdb and dcde65a.

⛔ Files ignored due to path filters (2)
  • Assets/Tests/Editor/KeyboardKeyStateServiceTests.cs.meta is excluded by none and included by none
  • Assets/Tests/Editor/UnityCLILoop.Tests.Editor.asmdef is excluded by none and included by none
📒 Files selected for processing (14)
  • Assets/RegressionHarness/KeyStateAfterPauseInterruption/SpaceHoldPoller.cs
  • Assets/Tests/Editor/KeyboardKeyStateServiceTests.cs
  • Assets/Tests/PlayMode/KeyboardInputSimulationResponseFactoryTests.cs
  • Packages/src/Editor/FirstPartyTools/Common/InputSimulation/UnityCliLoopInputSimulationTypes.cs
  • Packages/src/Editor/FirstPartyTools/Common/InputSystem/InputSystemConfiguredUpdateApplier.cs
  • Packages/src/Editor/FirstPartyTools/SimulateKeyboard/Application/KeyboardKeyState.cs
  • Packages/src/Editor/FirstPartyTools/SimulateKeyboard/KeyboardInputActionExecutor.cs
  • Packages/src/Editor/FirstPartyTools/SimulateKeyboard/KeyboardInputMainThreadCleanup.cs
  • Packages/src/Editor/FirstPartyTools/SimulateKeyboard/KeyboardInputSimulationResponseFactory.cs
  • Packages/src/Editor/FirstPartyTools/SimulateKeyboard/SimulateKeyboardResponse.cs
  • Packages/src/Editor/FirstPartyTools/SimulateKeyboard/SimulateKeyboardUseCase.cs
  • cli/common/tools/default-tools.json
  • docs/regression-harness.md
  • scripts/regression-harness-key-state-after-pause-interruption.sh
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/keyboard-state-after-pause-interruption

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.

Keep pause-point captures intact during ReleaseAll, limit ForceSync to
stale isPressed latches, and tighten the harness so quick-resume timing
is measured from interrupt and paused ReleaseAll preserves TryGetCapturedValue.

Co-authored-by: Cursor <cursoragent@cursor.com>
@hatayama
hatayama merged commit 8857300 into feature/pause-point-round9 Jul 23, 2026
2 checks passed
@hatayama
hatayama deleted the fix/keyboard-state-after-pause-interruption branch July 23, 2026 18:15
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