Opus finding
get_open_markets crashes on non-list Gamma payloads
mediumbugmedium
- agent/tools/markets.py:167-173
If Gamma briefly returns an error envelope (e.g. `{"error": ...}`) with HTTP 200, iterating yields the dict's keys (strings) and `m.get(...)` raises AttributeError. There's no shape validation on `data`. Given this is called from the agent's hot path on every Lambda invocation, an upstream blip becomes a hard crash rather than an empty result.
Recommendation
Validate `isinstance(data, list)`; if not, log and return [].