You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(omi-whoop-app): add request timeouts, null score guards, and type validation #14278
In plugins/omi-whoop-app/main.py, several edge cases and reliability risks can lead to unhandled exceptions and service degradation:
Unbounded Network Requests: Calls to
equests.get() and
equests.post() in
efresh_access_token(), whoop_api_request(), and the OAuth callback handler lack explicit HTTP timeouts. Under upstream Whoop API degradation or network partitioning, workers can hang indefinitely.
Crash on Null or Missing Scores: Formatters (ormat_recovery_score, ormat_strain_score, ormat_sleep, and ormat_workout) assume that the nested score object and its numeric metrics are always non-null dicts. When Whoop returns None or an empty dictionary (e.g. pending calculation), formatting throws AttributeError or TypeError.
Unsafe String Slicing in Chat Tools: ool_get_recovery, ool_get_strain, and ool_get_sleep perform direct slices ([:10]) on date fields assuming string presence, raising TypeError if date fields are None.
Missing Bounds Validation: Query parameters days and max_results in ool_get_workouts lack defensive integer casting and clamping against malformed input.
Proposed Solution
Introduce a centralized WHOOP_REQUEST_TIMEOUT = 10 constant and apply it across all outgoing network requests.
Add defensive type checks and fallback returns across all score formatters (ormat_recovery_score, ormat_strain_score, ormat_sleep, ormat_workout).
Safely cast and slice date fields in chat tool endpoints.
Clamp and validate integer parameters in ool_get_workouts.
Add hermetic unit test coverage ( est_whoop_hardening.py) validating all edge cases without requiring network access or external credentials.
Activity
fix(omi-whoop-app): add request timeouts, null score guards, and type…
chore(ci): fail plugin requests calls that carry no timeout
chore(ci): fail plugin requests calls that carry no timeout
fix(plugins): bound every requests call with a timeout (#15113)