[codex] compact market regime Telegram alerts#169
Conversation
Co-Authored-By: Codex <noreply@openai.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dbd8ff0407
ℹ️ 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".
| "opportunity_watch": "抄底机会", | ||
| "panic_reversal": "抄底机会", | ||
| "taco_rebound": "抄底机会", | ||
| "risk_reduced": "机会被否决", |
There was a problem hiding this comment.
Map risk_reduced alerts to de-levering
For market_regime_control signals with canonical_route == "risk_reduced" and suggested_action == "delever", the existing localization and alert metadata describe a risk-reduced/de-lever state, but the new compact Telegram body renders the only market-state line as "opportunity vetoed"/"机会被否决". In that scenario operators get a misleading status for a de-lever alert; this route should be labeled as risk-reduced/de-levering in both locale maps.
Useful? React with 👍 / 👎.
| message.body, | ||
| metadata.get("situation"), | ||
| metadata.get("recommendation"), | ||
| metadata.get("reason_summary"), |
There was a problem hiding this comment.
Derive the compact locale from displayed text
When an English/default alert falls back to a Chinese-only localized_messages.labels.reason_codes entry, reason_summary contains Chinese even though the compact body does not display that trigger text; including it here makes _message_uses_zh render the visible headings and route label in Chinese while the situation/recommendation remain English. This produces mixed-language Telegram alerts for otherwise English/default notifications, so the compact locale should come from the requested translator or fields that are actually rendered.
Useful? React with 👍 / 👎.
Summary
Root cause
Market-regime alerts built through the shared QuantPlatformKit Telegram channel still sent the generic detailed strategy-plugin subject/body, while the unified market-regime workflow had a repo-local compact renderer.
Validation
python3 -m pytest tests/test_strategy_plugin_telegram_notifications.py::StrategyPluginTelegramNotificationTests::test_publish_strategy_plugin_telegram_alerts_compacts_market_regime_body -qpython3 -m pytest tests/test_strategy_plugin_telegram_notifications.py tests/test_strategy_plugin_alert_dispatcher.py -qpython3 -m pytest tests/test_strategy_plugins.py tests/test_strategy_plugin_telegram_notifications.py tests/test_strategy_plugin_alert_dispatcher.py tests/test_notification_redaction.py -qpython3 -m pytest -qpython3 -m ruff check .Notes
python3 -m buildwas not run because the local Python environment does not have thebuildmodule installed.