[Bounty proposal] fix(open-meteo): guard forecast sequence bounds and prevent null-unit concatenation TypeError
Symptom
- Forecast
IndexErroron Incomplete Daily Metrics: Inplugins/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 thandaily["time"], indexing on day 1 or later raisesIndexError: list index out of range. This aborts the entire forecast call and returns"Open-Meteo forecast request failed: list index out of range". TypeErroron Null Unit Concatenation: Inget_current_weather,get_weather_forecast, andget_air_quality, string concatenation expressions such as' ' + units.get(...)raise an unhandledTypeError: can only concatenate str (not "NoneType") to strwhen the API response containsnullvalues for unit fields in JSON.- 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.pylines 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 throwingIndexErrororTypeError. - Implemented
_format_unit_suffix(unit_val, prefix=" ")to avoidTypeErrorwhen 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 registeredopen-meteo-app-testsin.github/checks-manifest.yaml.
PR ready: #13923
Bounty Payout Destination (EVM / Base USDC): 0xb5aFc89b57Fa8270bB7261348179D28099BEa2a0
cc @josancamon19 @kodjima33
Posted from the wrong connected GitHub account — please disregard this comment. I’ll follow up from the PR author account instead.
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!
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!
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!
Closing as already fixed on current main.
Merged PRs #13923 and #14681; current main has _format_unit_suffix and null optional defaults