Skip to content

main branch: codebase analysis — 10 bugs and inconsistencies identified, no code changes#1

Draft
Copilot wants to merge 1 commit intomainfrom
copilot/analyze-and-criticize
Draft

main branch: codebase analysis — 10 bugs and inconsistencies identified, no code changes#1
Copilot wants to merge 1 commit intomainfrom
copilot/analyze-and-criticize

Conversation

Copy link

Copilot AI commented Mar 1, 2026

Read-only audit of the main branch (Bot A, single LightGBM). No files were modified.

High severity

  • Silent equity corruption (execution.py:296): missing price falls back to avg_cost, zeroing unrealized P&L and corrupting the equity curve without any log signal
  • Division before float cleanup (execution.py:103): abs(qty) < 1e-10 guard runs after division — if quantity is e.g. 1e-11, avg_cost transiently becomes ~1e13 before being zeroed
  • Telegram failures invisible in prod (telegram_cmd.py:77,399,412): all three except Exception blocks log at DEBUG; auth failures and handler crashes produce no visible signal

Medium severity

  • Risk rejections never alert (execution.py:202): blocked orders log a WARNING but never invoke the RISK_VIOLATION path in alerting.py — portfolio silently drifts
  • RiskLimits defaults contradict AGENTS.md: three of five core limits are wrong in code vs. docs (max_sector_weight: 50% in code vs 25% documented; max_drawdown_limit: 20% vs 15%; max_position_weight: 25% vs 30%)
  • Lossy equity curve compaction (execution.py:306): fixed ::10 subsampling on every compaction cycle progressively erases historical peaks/troughs, understating drawdown
  • Survivorship bias silent at call site (data/ingestion.py): fetch_sp500_tickers() always returns current S&P 500 constituents with no warning; backtest callers silently receive inflated returns

Low severity

  • Dead hasattr guard (execution.py:246): hasattr(self, "positions") is always True
  • Duplicate import logging inside functions (features.py:369,503): shadows the module-level logger defined at line 11
  • Global _last_update_id mutated via global (telegram_cmd.py:48): shared across test runs unless explicitly reset

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

@vercel
Copy link

vercel bot commented Mar 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
dashboard Error Error Mar 1, 2026 1:24am

Copilot AI changed the title [WIP] Analyze and criticize existing codebase Codebase analysis: identified bugs and inconsistencies (no code changes) Mar 1, 2026
Copilot AI changed the title Codebase analysis: identified bugs and inconsistencies (no code changes) main branch: codebase analysis — 10 bugs and inconsistencies identified, no code changes Mar 1, 2026
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.

2 participants