Fix/mouse click screenshot align #2
Reference in New Issue
Block a user
Delete Branch "fix/mouse_click_screenshot_align"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Improvement Area
Issue
Summary
Fixes clicking and screenshot issues in #3
Changes
Testing
bash tests/run_test.shTesting Notes
Screenshots or Recordings
Deployment / Rollout Notes
Notes
Checklist
bash tests/run_test.sh.Root cause of 'I clicked many times but only got two screenshots': finishing/pausing a session called backend.stop(), which cancelled every in-flight frame request to null. Clicks whose PNG had not finished encoding yet were then dropped — only the first few survived. Fixes: - Stream backend now *drains* on stop: it stops accepting new requests but keeps the worker alive until frames already selected for queued clicks finish encoding. stop({ immediate: true }) keeps the old abandon-now behavior for an unhealthy worker. - Two-stage worker reply: a fast 'frame-selected' ack pins the pairing and proves liveness; the slow PNG payload follows. A slow encode (seconds on software-rendered hosts) is no longer mistaken for a dead worker, which had been forcing the post-click fresh-shot fallback (late screenshots). - Queued clicks carry their guide id and are stored even if the session ends while they wait in the queue. - The tray gesture that stops a session is discarded by matching its recorded screen position, not a time window — a fast workflow click near the stop is no longer collateral damage. (Replaces the earlier grace window, which dropped whole bursts.) - A click on a display with no ready stream resolves null so the caller fresh-shots the correct monitor instead of returning another screen. - STEPFORGE_CAPTURE_LOG=1 prints one line per click decision; the second-instance handler now surfaces the running window instead of exiting silently. - Self-test gains a fast-burst-then-finish scenario (8/8 saved) and the marker/coordinate checks remain at 0.00% offset. Tests: 133 unit + all repo checks passing. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>