Skip to content

[codex] Fix probe timeout alert handling#147

Merged
Pigbibi merged 1 commit into
mainfrom
codex/fix-probe-timeout-alert
Jun 8, 2026
Merged

[codex] Fix probe timeout alert handling#147
Pigbibi merged 1 commit into
mainfrom
codex/fix-probe-timeout-alert

Conversation

@Pigbibi

@Pigbibi Pigbibi commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • classify IBKR connection failures in /probe with failure_category=ibkr_connection
  • send concise IBKR connection probe notifications instead of full traceback spam
  • add bilingual notification copy and regression coverage for handshake timeout probes

Root 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_insync raises TimeoutError; 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.py
  • PYTHONPATH=/home/ubuntu/Projects/QuantPlatformKit/src:/home/ubuntu/Projects/UsEquityStrategies/src:/home/ubuntu/Projects/HkEquityStrategies/src /usr/bin/python3 tests/test_connect_timeout_alert.py
  • inline stub verification for /probe timeout notification: report records ibkr_connection, notification contains no Traceback

Notes

Local pytest and ruff are not installed on this VPS; CI runs both with dependencies installed.

@Pigbibi Pigbibi merged commit dec4084 into main Jun 8, 2026
1 check passed
@Pigbibi Pigbibi deleted the codex/fix-probe-timeout-alert branch June 8, 2026 15:22

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread main.py
positions_count=len(positions),
)
return response_body, 200
except (ConnectionError, TimeoutError) as exc:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant