omi icon indicating copy to clipboard operation
omi copied to clipboard

[Bounty proposal] fix(whoop-app): get_body_measurements requests a WHOOP path that does not exist, so the tool always fails with a blank error

Open jzhou1402 opened this issue 2 months ago • 2 comments

Symptom

The Whoop app's get_body_measurements chat tool ("what's my max heart rate / weight / height on Whoop?") can never succeed. Every call comes back as Failed to get measurements: with an empty reason, no matter whose account is connected.

Evidence

plugins/omi-whoop-app/main.py (tool_get_body_measurements) requests:

result = whoop_api_request(uid, "GET", "/body_measurement")

which, with WHOOP_API_BASE = "https://api.prod.whoop.com/developer/v1", resolves to https://api.prod.whoop.com/developer/v1/body_measurement. WHOOP has never served that path. The documented endpoint is .../user/measurement/body (WHOOP API reference: GET /v2/user/measurement/body "Get User Body Measurements", https://developer.whoop.com/api/ ; the v1 form is /v1/user/measurement/body).

Unauthenticated probes against the live API show the difference before auth is even considered:

$ curl -s -o /dev/null -w "%{http_code}\n" https://api.prod.whoop.com/developer/v1/body_measurement
404
$ curl -s -o /dev/null -w "%{http_code}\n" https://api.prod.whoop.com/developer/v1/user/measurement/body
401
$ curl -s -o /dev/null -w "%{http_code}\n" https://api.prod.whoop.com/developer/v1/user/profile/basic
401

Every real route answers 401 (needs a bearer token); /body_measurement answers 404 (no such route). The 404 body is empty, and whoop_api_request returns {"error": response.text, ...}, so the tool's error string is blank as well, which is why the failure has been invisible.

The README advertises the tool (plugins/omi-whoop-app/README.md: "Body Measurements - View height, weight, max HR" and the /tools/get_body_measurements row) and the OAuth flow already requests the read:body_measurement scope, so users are granting a scope for a tool that cannot work.

Fix

  1. Request the documented path: whoop_api_request(uid, "GET", "/user/measurement/body"). The response fields the handler already reads (height_meter, weight_kilogram, max_heart_rate) match the UserBodyMeasurement schema in WHOOP's OpenAPI document.
  2. In whoop_api_request, carry the HTTP status into the error when the upstream body is empty (HTTP 404 instead of "") so a failure of this kind is never reported as a blank reason again. This is the shared boundary all seven Whoop tools go through.

Tests

New hermetic suite plugins/omi-whoop-app/test_body_measurements.py (stdlib-only; no network) executes the production tool_get_body_measurements handler through the requests.get seam:

  • a fake WHOOP that only answers on /user/measurement/body must produce the formatted height/weight/max-HR result, and the handler must send Authorization: Bearer <token> to exactly that URL (fails on main with '.../v1/body_measurement' != '.../v1/user/measurement/body');
  • an empty-body 404 must surface a status-bearing error, not a blank one.

Registered as whoop-app-body-measurement-tests in .github/checks-manifest.yaml (local + ci lanes).

Note: WHOOP's docs now describe v1 as "no longer supported" in favour of v2 (UUID ids for sleep/workout). Moving the whole plugin to v2 is a separate, larger change that needs a live token to verify; this proposal is scoped to the endpoint that is wrong under either version.


Proposed Bounty Reward: $50.00 USD Bounty Payout Destination (PayPal): will be provided by email to [email protected] on payout

cc @josancamon19 @kodjima33

jzhou1402 avatar Sep 14 '26 21:09 jzhou1402

Opened #13962 for this: the tool now requests the documented /user/measurement/body route, and whoop_api_request reports the HTTP status when the upstream body is empty instead of returning Failed to get measurements: with a blank reason.

Hermetic regression suite plugins/omi-whoop-app/test_body_measurements.py (6 tests) drives the production handler through the requests.get seam: 3 failures + 3 errors against unchanged main, all pass with the fix. Registered in .github/checks-manifest.yaml for the local and ci lanes. scripts/pr_preflight.py --lane local reported all 15 selected checks passing.

inklife avatar Sep 15 '26 05:09 inklife

Locking this task / bounty.

As an active contributor with merged PRs (#14224, #14546), claiming lock privilege per official Omi Contribution Guidelines:

  • Clean implementation is submitted in PR #14657: https://github.com/BasedHardware/omi/pull/14657
  • Requests documented /v1/user/measurement/body endpoint with 404 empty state guard.
  • All 17 CI and manifest checks pass 100% green. Ready for review!

shuoYun114 avatar Sep 19 '26 02:09 shuoYun114