Opus finding
Module import side effect: _install_sdk_log_filter() runs at import time
lowmaintainabilityhigh
- agent/tools/markets.py:51-56
Calling _install_sdk_log_filter() at module top-level means merely importing agent.tools.markets installs the filter. The settlement.py docstring explicitly mentions the design choice to live outside agent.tools to avoid pulling in py_clob_client_v2. That tells us import-time side effects in this module matter. While the filter itself is cheap, the policy of doing work at import time is fragile (e.g. tests that capture logs may behave inconsistently depending on import order). Prefer calling it from get_clob_client() (already cached).
Recommendation
Move _install_sdk_log_filter() invocation into get_clob_client() (it's lru_cached so idempotency is preserved) and drop the bare module-level call.