feat(tg): send_trading_report script with HTML->plain fallback - #200
Conversation
…ext may break HTML parse intermittently)
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
| import urllib.request | ||
| from pathlib import Path | ||
|
|
||
| ROOT = Path("/root/AIOS") |
There was a problem hiding this comment.
🔥 The Roast: ROOT = Path("/root/AIOS") — This script is so committed to its /root/AIOS address that it won't even consider running anywhere else. It's the "I only date people from my hometown" of Python scripts.
🩹 The Fix:
| ROOT = Path("/root/AIOS") | |
| ROOT = Path(__file__).resolve().parent.parent |
📏 Severity: warning
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| if not token or not chat: | ||
| return False, "no credentials" | ||
| base = { | ||
| "chat_id": int(chat), |
There was a problem hiding this comment.
🔥 The Roast: "chat_id": int(chat) — Converting to int() with the optimism of a golden retriever. If chat contains a single non-numeric character, this script crashes harder than a cron job at 3 AM.
🩹 The Fix:
| "chat_id": int(chat), | |
| "chat_id": int(chat) if str(chat).lstrip("-").isdigit() else chat, |
📏 Severity: warning
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
| def main() -> int: | ||
| from tg_bot.trading_report import full_report | ||
|
|
||
| messages = full_report() |
There was a problem hiding this comment.
🔥 The Roast: messages = full_report() — Calling an external function with all the safety precautions of a base jumper without a parachute. If full_report() raises, the script exits with a stack trace instead of a graceful error.
🩹 The Fix:
| messages = full_report() | |
| try: | |
| messages = full_report() | |
| except Exception as exc: | |
| print(f"failed to generate report: {exc}") | |
| return 1 |
📏 Severity: suggestion
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
Code Review Roast 🔥Verdict: 3 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)
🏆 Best part: The HTML→plain fallback is genuinely well-executed — quick, simple, and exactly addresses the stated problem without overengineering. 💀 Worst part: The hardcoded 📊 Overall: Like a GPS that only knows one route — it'll get you there, but only if you never leave the neighborhood. Files Reviewed (2 files)
Fix these issues in Kilo Cloud Reviewed by free · Input: 46.2K · Output: 7.4K · Cached: 177.4K |
Скрипт отправки детального трейдинг-отчёта в TG с фолбэком HTML->plain (LLM-текст иногда ломает HTML-парсер).