Prevent crashes and silent automation interruptions#457
Open
JE-Chen wants to merge 1 commit into
Open
Conversation
Fixes a class of defects where a long-running service dies silently or a whole automation run aborts on an escaping exception: - Coordinate coercion: a float x/y (computed/random var or JSON literal) no longer reaches an un-prototyped SetCursorPos / Xlib fake_input and raises ctypes.ArgumentError / struct.error that aborts the whole script; coerce to int in mouse_preprocess / set_mouse_position (+ Win32 cursor argtypes and a 0-size-screen guard in _convert_position). - Service-loop containment: the hotkey daemon (all platforms), Observer and PopupWatchdog poll loops, and the ChatOps command boundary widened to catch the failure types a normal script / user callback raises (AutoControlException, LookupError, StopIteration, ArithmeticError) instead of the thread dying and silently stopping every binding/rule. - cv2.error from AC_match_template* is now contained as AutoControlScreenException rather than aborting the run. - Server robustness: REST / Webhook / socket-command handlers get read timeouts (+ daemon_threads) so stalled clients can't pin worker threads; USB/IP prunes finished workers; the webhook fire lock is bounded and answers 503 busy rather than piling up handler threads; host_service and WebRTC input dispatch survive transient errors. Test _FakeRequest gains a settimeout no-op to match a real socket.
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
| Duplication | 2 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
|
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.



Follow-up hardening from a crash/hang-focused audit (two agents swept the background-service and automation-hot-path subsystems). Fixes the class of defects where a long-running service dies silently or a whole automation run aborts on an escaping exception. No API changes.
Automation-abort / silent-death (Tier 1)
x/y(computed/random var, or JSON literal{"x":100.5}) reached an un-prototypedSetCursorPos/ Xlibfake_input→ctypes.ArgumentError/struct.error→ escaped the executor. Now coerced tointinmouse_preprocess/set_mouse_position(+ Win32 cursorargtypes,_convert_positionzero-size guard).AutoControlException, which wasn't in_fire_binding's catch → the daemon thread died and every hotkey silently stopped. Widened to catchAutoControlException(mirrors scheduler/triggers).LookupError/StopIteration/ArithmeticError, so a callback doingdict[key]killed the poll loop. Widened.cv2.errorfromAC_match_template*now contained asAutoControlScreenExceptioninstead of aborting the run.Resource leaks / hangs over time (Tier 2)
daemon_threads) so a stalled/slowloris client can't pin a worker thread forever.Threadobject per connection).fire()lock is bounded (120s) and answers 503 busy rather than piling up handler threads while a long script runs (serialisation preserved).host_servicedaemon loop and WebRTC input dispatch survive transient/unexpected errors instead of exiting.Verified: 568 changed-module tests pass locally; full headless suite green (test
_FakeRequestgained asettimeoutno-op to match a real socket).