omi icon indicating copy to clipboard operation
omi copied to clipboard

[Bounty proposal] fix(open-meteo): guard forecast sequence bounds and prevent null-unit concatenation TypeError

Open Ivansky1 opened this issue 2 months ago • 5 comments

Symptom

  1. Forecast IndexError on Incomplete Daily Metrics: In plugins/omi-open-meteo-app/main.py (get_weather_forecast), daily arrays were retrieved via (daily.get("weather_code") or [None])[index]. If any metric array (weather_code, temperature_2m_max, temperature_2m_min, precipitation_probability_max, wind_speed_10m_max) is empty, None, or shorter than daily["time"], indexing on day 1 or later raises IndexError: list index out of range. This aborts the entire forecast call and returns "Open-Meteo forecast request failed: list index out of range".
  2. TypeError on Null Unit Concatenation: In get_current_weather, get_weather_forecast, and get_air_quality, string concatenation expressions such as ' ' + units.get(...) raise an unhandled TypeError: can only concatenate str (not "NoneType") to str when the API response contains null values for unit fields in JSON.
  3. Empty Result on Missing Time: If daily["time"] is empty or missing, a blank forecast header was returned with no rows and no explanation.

Evidence

  • plugins/omi-open-meteo-app/main.py lines 293, 336–342, 377–381.
  • Tested: passing partial daily arrays (e.g. 1-element arrays for a 3-day forecast) raises unhandled IndexError.

Fix

  • Implemented _safe_item(items, index, default=None) to safely index sequences without throwing IndexError or TypeError.
  • Implemented _format_unit_suffix(unit_val, prefix=" ") to avoid TypeError when formatting null/non-string unit fields.
  • Added empty forecast detection to return "No forecast data available for {place_name}.".
  • Added comprehensive unit test suite in plugins/omi-open-meteo-app/test_main.py (8 passing tests) and registered open-meteo-app-tests in .github/checks-manifest.yaml.

PR ready: #13923


Bounty Payout Destination (EVM / Base USDC): 0xb5aFc89b57Fa8270bB7261348179D28099BEa2a0 cc @josancamon19 @kodjima33

Ivansky1 avatar Sep 14 '26 20:09 Ivansky1

Posted from the wrong connected GitHub account — please disregard this comment. I’ll follow up from the PR author account instead.

Hodluma avatar Sep 15 '26 21:09 Hodluma

Hi @josancamon19 @kodjima33 — PR #13923 has now been accepted and merged into main. Could you please confirm whether this contribution is eligible for a bounty, the approved amount, and the payment process? Thanks!

Ivansky1 avatar Sep 15 '26 21:09 Ivansky1

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 #14681: https://github.com/BasedHardware/omi/pull/14681
  • Strips explicit JSON ull inputs to trigger field defaults, adds 422 RequestValidationError handler returning HTTP 200 ChatToolResponse.
  • All 17 CI and manifest checks pass 100% green. Ready for review!

shuoYun114 avatar Sep 19 '26 02:09 shuoYun114

Hi @shuoYun114, thanks for the update.

Just to clarify the timeline for the maintainers: PR #13923 addressing this issue was already accepted and merged into main before the new bounty lock / PR #14681 was submitted.

I previously asked for confirmation regarding bounty eligibility, the approved amount, and the payment process for the merged contribution, but I haven't received a maintainer response yet.

Could @josancamon19 or @kodjima33 please clarify:

  • whether the already-merged PR #13923 is eligible for the bounty;
  • whether the later lock / PR #14681 affects that eligibility;
  • and, if #13923 is eligible, what the approved bounty amount and payment process are?

I’d appreciate a maintainer clarification so there’s no ambiguity around the contribution timeline and bounty attribution.

Thanks!

Ivansky1 avatar Sep 19 '26 18:09 Ivansky1

Closing as already fixed on current main.

Merged PRs #13923 and #14681; current main has _format_unit_suffix and null optional defaults

aryanorastar avatar Sep 20 '26 16:09 aryanorastar