Skip to content

Notify Telegram on runtime entry failures - #128

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

Notify Telegram on runtime entry failures#128
Pigbibi merged 1 commit into
mainfrom
codex/runtime-error-telegram-fallback

Conversation

@Pigbibi

@Pigbibi Pigbibi commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add a top-level runtime exception fallback for HTTP entrypoints
  • send Telegram alerts for failures that escape normal strategy-cycle handling
  • cover the fallback path with request handling tests

Tests

  • /usr/bin/python3 -m py_compile main.py tests/test_request_handling.py
  • git diff --check
  • /usr/bin/python3 -m pytest tests/test_request_handling.py was not run locally because pytest is not installed on this VPS

@Pigbibi
Pigbibi merged commit 4dd8d7d into main Jun 2, 2026
1 check passed
@Pigbibi
Pigbibi deleted the codex/runtime-error-telegram-fallback branch June 2, 2026 08:48

@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: 2330665a74

ℹ️ 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
return False
message = _runtime_error_notification_message(exc, route_label=route_label)
for token, chat_id in targets:
send_telegram_message(

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 Honor the configured Telegram API endpoint

When a service relies on CRISIS_ALERT_TELEGRAM_API_BASE_URL (the workflow syncs it into Cloud Run in .github/workflows/sync-cloud-run-env.yml:767-768), this fallback bypasses that setting and calls send_telegram_message, which hard-codes https://api.telegram.org in notifications/telegram.py:322. In those egress/proxy deployments, runtime-entry failures now post to the wrong endpoint and the intended alert is not delivered; route this through the configured crisis Telegram settings/adapter instead of the generic sender.

Useful? React with 👍 / 👎.

Comment thread main.py
def _split_env_list(value: str | None) -> tuple[str, ...]:
return tuple(
item.strip()
for item in str(value or "").replace(";", ",").split(",")

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 Preserve newline-separated crisis chat IDs

When CRISIS_ALERT_TELEGRAM_CHAT_IDS is supplied as newline-separated values, the existing runtime config parser (runtime_config_support.split_env_list) normalizes those into separate recipients, but this new helper only replaces semicolons before splitting on commas. That makes the fallback send one Telegram request with a single chat ID containing newlines, so runtime-entry failure alerts miss all intended crisis chats in that supported configuration; reuse the existing splitter or RUNTIME_SETTINGS.crisis_alert_telegram_chat_ids.

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