Feature 1: A1→A2 Empty Folder Retry Logic - Track retry attempts (max 3) for campaigns with no master assets - Mark campaigns as permanently failed after 3 attempts - Stop processing and sending emails for permanently failed campaigns - Two new email templates: retry notification and permanent failure - Database migration adds 4 new columns to campaign_status table - Comprehensive documentation in A1_RETRY_LOGIC.md Feature 2: Orchestrator Off-Hours Cadence - Add 30 minutes to all task intervals during off-hours - Off-hours: 10 PM - 5 AM weekdays + all day Saturday/Sunday - Tasks only run at minutes 0 and 30 during off-hours - Configurable and easy to enable/disable - Daily Report (7 PM) remains unchanged Files changed: - NEW: database/migrations/003_add_a1_retry_tracking.sql - NEW: MARKDOWN_DOCS/A1_RETRY_LOGIC.md - MODIFIED: scripts/shared/database.py (added 3 methods) - MODIFIED: scripts/a1_to_a2_box_uploader.py (added retry logic) - MODIFIED: scripts/shared/notifier.py (added 2 templates) - MODIFIED: scripts/orchestrator-prod.py (added off-hours config) - MODIFIED: RUN_ORCHESTRATOR.md (added off-hours docs) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
32 lines
1.5 KiB
SQL
32 lines
1.5 KiB
SQL
-- Migration: Add A1 retry tracking to campaign_status table
|
|
-- Purpose: Prevent infinite error emails for empty A1 campaigns
|
|
-- Date: January 31, 2026
|
|
|
|
\echo 'Adding A1 retry tracking fields to campaign_status table...'
|
|
|
|
ALTER TABLE campaign_status
|
|
ADD COLUMN IF NOT EXISTS a1_retry_count INTEGER DEFAULT 0,
|
|
ADD COLUMN IF NOT EXISTS a1_last_retry_at TIMESTAMP,
|
|
ADD COLUMN IF NOT EXISTS a1_permanently_failed BOOLEAN DEFAULT FALSE,
|
|
ADD COLUMN IF NOT EXISTS a1_failure_reason TEXT;
|
|
|
|
\echo 'Fields added successfully'
|
|
|
|
-- Create index for faster queries
|
|
CREATE INDEX IF NOT EXISTS idx_campaign_status_a1_failed ON campaign_status(a1_permanently_failed);
|
|
|
|
\echo 'Index created'
|
|
|
|
-- Add comments for documentation
|
|
COMMENT ON COLUMN campaign_status.a1_retry_count IS 'Number of times A1→A2 processing attempted with empty folder';
|
|
COMMENT ON COLUMN campaign_status.a1_last_retry_at IS 'Timestamp of last retry attempt';
|
|
COMMENT ON COLUMN campaign_status.a1_permanently_failed IS 'TRUE if campaign failed all 3 retry attempts';
|
|
COMMENT ON COLUMN campaign_status.a1_failure_reason IS 'Description of why campaign was marked as permanently failed';
|
|
|
|
\echo ''
|
|
\echo '============================================================'
|
|
\echo 'Migration 003 complete!'
|
|
\echo '============================================================'
|
|
\echo 'Added fields: a1_retry_count, a1_last_retry_at, a1_permanently_failed, a1_failure_reason'
|
|
\echo 'Purpose: Track A1 empty folder retries (max 3 attempts)'
|
|
\echo '============================================================'
|