Opus finding
get_open_markets silently skips markets when outcomes/prices/clobTokenIds are missing or not JSON
lowapi-contracthigh
- agent/tools/markets.py:175-180
json.loads raises TypeError if Gamma ever returns an already-decoded list/None rather than a JSON-encoded string (this has happened across Polymarket API changes). The except only catches KeyError/ValueError, so a schema change would surface as an uncaught TypeError, crashing the whole fetch instead of skipping the bad row. Also, no logging of skipped rows makes silent data loss hard to diagnose.
Recommendation
Catch `(KeyError, TypeError, ValueError)` and at least debug-log skipped market_ids.