fix: natural cursor movement and plan state bug - #508
Merged
Merged
Conversation
This commit addresses two issues:
1. **Stale Approved Plan Bug Fix (Critical)**
- Fixed AllowActivePlanReplacement() guard preventing new plans in plan mode
- When entering Plan/Graph-Plan mode, any prior approval is now unconditionally cleared
- Prevents blocked_active_approved_plan errors that rendered the plan system unusable
- Added regression tests: TestChatAgent_AllowPlanReplacement_OverridesApproved,
TestChatAgent_GraphPlanMode_ClearsStaleApprovedPlan
2. **Natural Cursor Movement Feature**
- Added duration_ms parameter to browser_move_cursor tool
- Cursor now glides with cubic ease-in-out acceleration when duration_ms > 0
- Implements per-step overlay sync so visible cursor tracks movement smoothly
- Maintains backward compatibility: duration_ms=0 (default) keeps instant movement
- Enhanced tool descriptions with anti-pattern warnings and recommended values
Changes:
- pkg/agent/chat_agent.go: AllowActivePlanReplacement clears stale approval flag
- pkg/agent/plan_persistence_test.go: Added 2 regression tests
- pkg/browser/demo_overlay.go: MoveMouseAnimated accepts durationMs with ease-in-out loop
- pkg/browser/demo_overlay_test.go: Updated tests for new signature
- pkg/tools/browser_demo.go: Added DurationMs field to BrowserMoveCursorArgs
- pkg/tools/browser_demo_test.go: Added test for DurationMs parameter
- pkg/tools/browser_interact.go: Updated BrowserClick caller to pass durationMs=0
- pkg/tools/browser_tools.go: Enhanced tool description with anti-pattern guidance
All tests pass. The plan system is now functional in plan mode, and cursor animations
in tutorials can now be smooth and human-like with a single tool call.
rschardosin
force-pushed
the
fix/natural-cursor-movement-and-plan-state-bug
branch
from
September 8, 2026 04:37
bcb32b2 to
56788b2
Compare
rschardosin
deleted the
fix/natural-cursor-movement-and-plan-state-bug
branch
September 8, 2026 15:55
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes two issues:
Critical Bug: Stale Approved Plan Blocking New Plans
blocked_active_approved_planAllowActivePlanReplacement()had a guard that refused to clear theactivePlanApprovedflagAllowActivePlanReplacement()to unconditionally clear the stale approval flag when entering plan modeTestChatAgent_AllowPlanReplacement_OverridesApprovedandTestChatAgent_GraphPlanMode_ClearsStaleApprovedPlanFeature: Natural Cursor Movement for Tutorial Recordings
duration_msparameter toMoveMouseAnimated()that distributes movement over milliseconds using cubic ease-in-out interpolationduration_ms=0(default) preserves instant movementChanges
Backend (Go)
pkg/agent/chat_agent.go— FixedAllowActivePlanReplacement()to unconditionally clearactivePlanApprovedflagpkg/agent/plan_persistence_test.go— Added regression tests for stale plan statepkg/browser/demo_overlay.go— AddeddurationMsparameter with cubic ease-in-out interpolationpkg/browser/demo_overlay_test.go— Updated test signatures for new parameterpkg/tools/browser_interact.go— Updated caller to pass new parameterpkg/tools/browser_demo.go— AddedDurationMsfield toBrowserMoveCursorArgspkg/tools/browser_demo_test.go— Added test for duration parameterpkg/tools/browser_tools.go— Improved tool description with anti-pattern warnings and recommended valuesTesting
duration_msandstepscombinationsduration_ms=600produces smooth ease-in-out motionImpact
duration_msis used