[codex] Fix probe timeout alert handling#147
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fcc2f5c214
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| positions_count=len(positions), | ||
| ) | ||
| return response_body, 200 | ||
| except (ConnectionError, TimeoutError) as exc: |
There was a problem hiding this comment.
Classify OSError probe connection failures too
When the probe's IBKR connection fails with a socket-level OSError after the adapter exhausts retries, this new handler is skipped and the generic except Exception path still sends the full traceback and omits failure_category=ibkr_connection. I checked application/runtime_broker_adapters.py, where connect_ib() explicitly treats (ConnectionError, TimeoutError, OSError) from the IB connect call as connection-attempt failures and re-raises the last error, so cases like network unreachable/no route to host remain unhandled by the concise connection notification path added here.
Useful? React with 👍 / 👎.
Summary
/probewithfailure_category=ibkr_connectionRoot Cause
The probe performs a real IBKR connection and account snapshot check. When IB Gateway/TWS accepts TCP but does not complete the API handshake,
ib_insyncraisesTimeoutError; the generic probe exception handler then sent the full Python traceback to notifications.Validation
/usr/bin/python3 -m py_compile main.py notifications/telegram.py tests/test_request_handling.pyPYTHONPATH=/home/ubuntu/Projects/QuantPlatformKit/src:/home/ubuntu/Projects/UsEquityStrategies/src:/home/ubuntu/Projects/HkEquityStrategies/src /usr/bin/python3 tests/test_connect_timeout_alert.py/probetimeout notification: report recordsibkr_connection, notification contains noTracebackNotes
Local
pytestandruffare not installed on this VPS; CI runs both with dependencies installed.