Backend hangs on campaign activation + Bot returns 500 on publication endpoint
Resolved 💬 2 comments Opened Feb 4, 2026 by marsiandeployer Closed Feb 4, 2026
Problem
When activating a campaign (DRAFT → ACTIVE transition) with multiple channels:
Issue 1: Race condition in approval notifications
One of the approval notification tasks failed with:
{'success': False, 'error': 'Campaign in draft or archived'}
Root cause: Celery task send_approval_notification_task was queued via transaction.on_commit() but executed BEFORE the campaign was actually saved as ACTIVE.
Issue 2: Bot endpoint returns 500 Internal Server Error
Publication task publish_campaign_channel_async receives HTTP 502/500 from bot endpoint:
curl -X POST http://localhost:8001/telegram/public-campaign-channel \
-H 'Content-Type: application/json' -d '{"test":"ping"}'
# Returns: Internal Server Error (HTTP 500)
Bot logs:
WARNING: Invalid HTTP request received.
Celery logs:
[PublishCampaignChannelAsync] Failed to publish: HTTP 502
Impact
- Users don't receive all approval notifications
- Auto-approved channels don't get published (stuck in retry queue)
Expected behavior
- All approval notifications should be sent reliably
- Bot endpoint should accept publication requests without 500 errors
Files involved
web_app/core/admin.py:1811-1925- campaign activation logicweb_app/core/tasks.py:1319-publish_campaign_channel_asynctaskbot/main.py- bot webhook endpoint
Campaign ID
9a60db3f-5ee4-4323-ae30-0f752c646015
Logs
See Celery worker logs at 19:51:55 UTC
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗