Skip to content

Notify Telegram on Firstrade runtime errors#58

Merged
Pigbibi merged 1 commit into
mainfrom
codex/firstrade-runtime-error-telegram-alert
Jun 2, 2026
Merged

Notify Telegram on Firstrade runtime errors#58
Pigbibi merged 1 commit into
mainfrom
codex/firstrade-runtime-error-telegram-alert

Conversation

@Pigbibi

@Pigbibi Pigbibi commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a /run exception fallback that logs the stack trace and attempts Telegram notification before returning 500
  • notify the normal strategy Telegram channel and configured crisis Telegram channel targets, with duplicate target suppression
  • add request handling tests for fatal strategy-cycle errors with and without Telegram config

Verification

  • /usr/bin/python3 -m py_compile main.py tests/test_request_handling.py
  • git diff --check

Targeted pytest could not be run on this VPS because the active Python environment does not have pytest installed.

@Pigbibi Pigbibi merged commit cc26992 into main Jun 2, 2026
1 check passed
@Pigbibi Pigbibi deleted the codex/firstrade-runtime-error-telegram-alert branch June 2, 2026 08:27

@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: d8f6a83a53

ℹ️ 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
Comment on lines +45 to +48
crisis_token = os.getenv("CRISIS_ALERT_TELEGRAM_BOT_TOKEN")
for chat_id in _split_env_list(os.getenv("CRISIS_ALERT_TELEGRAM_CHAT_IDS")):
if crisis_token and chat_id:
targets.append((crisis_token, chat_id))

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 Respect disabled crisis Telegram channels

When a deployment leaves CRISIS_ALERT_TELEGRAM_* configured but sets CRISIS_ALERT_CHANNELS to exclude telegram (the documented/runtime channel list is the enablement control for crisis alerts), this branch still adds those chat IDs and sends every /run fatal-error alert to Telegram. Gate these crisis targets on the channel list including telegram so disabled or staged Telegram credentials do not receive runtime-error notifications.

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