Opus finding
_reconcile_fill silently swallows partial-fill data when size_matched is the string "0"
lowbugmedium
- agent/tools/wallet.py:142-152
The chained `or` falls through on any falsy value. If size_matched is the string "0" or numeric 0 (no fill yet) we end up with "0" — fine. But if the API returns size_matched=0 and matched_size is the actual filled amount, the 0 will short-circuit to matched_size, which is OK. The real problem is the opposite: a legitimate "0" return is treated as falsy and we walk through alternative keys that may not exist. Low-severity ambiguity; the function still returns 0 correctly today, but logic is fragile if the V2 API ever changes shape.
Recommendation
Use explicit `if key in order` lookups rather than chained `or` to disambiguate "key absent" vs "key present with zero value".