Skip to content

fix(telegram): log API errors, skip queued alerts when disabled, escape chart URLs #78

Done

Description

@mlgitdev

Description

  1. TelegramService._worker() (app/telegram.py:241-247) discards the requests.post() response without checking status_code or ok, silently swallowing HTTP 400/401/429 errors.
  2. _worker() does not re-check self.enabled / self.paused under self._lock after dequeuing, so pausing/disabling Telegram still sends queued burst alerts.
  3. send_raw() reads self.enabled/self.paused without acquiring self._lock.
  4. chart_url (lines 172, 228) interpolates raw ticker without URL encoding / HTML escaping, and fallback borrow.get('label') is not HTML-escaped.

References: app/telegram.py:91-94, 151, 172, 193, 228, 233-248

Steps to Reproduce

  1. Queue multiple Telegram alerts, then disable Telegram alerts via the topbar button -> queued alerts still dispatch.
  2. Trigger a Telegram 400/401/429 error -> no warning is logged.

Expected Behavior

Inspect HTTP response status & JSON ok (logging errors and honoring retry_after on 429), re-check enabled/paused under lock inside _worker() and send_raw(), and URL-quote + HTML-escape dynamic fields.

Operating System & Version

  • OS: Windows 11 x64 / macOS arm64 / Linux x86_64
  • Version: v2.12.0
  • Display / Scale: Verified via live Chrome CDP (1600x960) & local unit/backend suite

Logs & Additional Context

Backend audit confirmed _worker ignores HTTP responses and does not re-check self.enabled/self.paused.

Activity

  1. self-assigned this
    on Dec 2, 2026
  2. added
    bug
    on Dec 2, 2026
  3. mlgitdev commented on Dec 2, 2026

    @mlgitdev
    OwnerAuthor

    🚀 Resolution In Progress

    A fix for this issue has been implemented and submitted in Pull Request #82 (v2.12.1).

    • Branch: fix/audit-remediation-67
    • PR URL: fix(core): resolve 15 verified audit issues across UI, API, concurrency, audio, and packaging (v2.12.1) #82
    • Summary of Changes: Updated TelegramService._worker() in app/telegram.py to log non-200 / ok=False responses (with 429 retry_after backoff), re-check enabled/paused under lock before sending queued alerts, and URL-quote + HTML-escape ticker/borrow fields. Verified via unit tests.
    • Verification: compileall clean, 84/84 unit tests passing (including tests/test_audit_fixes.py), and live Chrome CDP verification passed.

    This issue will automatically close upon PR #82 review and merge into main.

  4. github-actions commented on Dec 2, 2026

    @github-actions

    ✅ Issue Validation Passed

    • Conventional Commit title syntax (fix(telegram))
    • Verified issue type: BUG
    • Required template sections present and filled out

    This issue is well-structured and ready for work according to the Issue-First Protocol.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions