Repository navigation
Closed as not planned
Closed as not planned
Copy link
Labels
complexity-mediumComplexity: medium (board points 5-8)priority-p1Critical pathtype-featureNew functionality
Description
Problem
When a task or scheduled execution fails (Claude Code error, timeout, transient network issue, agent temporarily unhealthy), the execution is simply marked as failed with no automatic recovery. Operators must manually re-trigger failed tasks, which defeats the purpose of autonomous operation.
Currently:
TaskExecutionServicemarks failures inschedule_executionsand moves on- Scheduled jobs fire once per cron tick — if that run fails, the next attempt is the next cron interval (could be hours/days)
- No distinction between transient failures (network blip, rate limit) and permanent failures (bad prompt, missing credentials)
Proposed Solution
1. Retry Configuration (per-schedule and per-task)
Add retry settings to schedules and ad-hoc task triggers:
# Schedule-level config
retry:
max_retries: 3 # 0 = no retries (current behavior)
backoff: exponential # fixed | linear | exponential
initial_delay_seconds: 30
max_delay_seconds: 600 # cap for exponential backoff
retry_on: # optional filter (default: all failures)
- timeout
- transient_error2. Database Changes
Extend schedule_executions:
retry_attempt(INTEGER DEFAULT 0) — which attempt this is (0 = first run)retry_of(TEXT, FK) — links to the original execution that failednext_retry_at(TEXT) — when the next retry is scheduled (NULL if no more retries)
Extend agent_schedules:
retry_max(INTEGER DEFAULT 0)retry_backoff(TEXT DEFAULT 'exponential')retry_initial_delay(INTEGER DEFAULT 30)retry_max_delay(INTEGER DEFAULT 600)
3. Retry Engine
In TaskExecutionService, after a failure:
- Check if retries are configured and
retry_attempt < retry_max - Calculate next delay using backoff strategy
- Schedule a one-shot retry job via APScheduler
add_job(trigger='date', run_date=...) - Update execution record with
next_retry_at - Emit WebSocket event
execution_retry_scheduled
4. UI Changes
- Schedule form: Add retry configuration section (collapsible, advanced)
- Task trigger modal: Optional retry count field
- Execution Detail page: Show retry chain (attempt 1 → 2 → 3) with links
- Tasks tab: Badge showing "Retry 2/3" on retrying executions
5. MCP Tools
- Extend
create_agent_schedule/update_agent_schedulewith retry params - Extend
chat_with_agent(async mode) with retry options
6. Observability
- Dashboard timeline should show retry attempts as linked execution boxes
- Notifications for final failure after all retries exhausted
- Retry statistics in agent dashboard (retry rate, success-after-retry rate)
Scope
| Component | Changes |
|---|---|
| Database | Migration for new columns on schedule_executions and agent_schedules |
| Backend | TaskExecutionService retry logic, scheduler one-shot jobs |
| Frontend | Schedule form, execution detail, tasks tab badges |
| MCP | Extended schedule and chat tool parameters |
Out of Scope
- Circuit breaker pattern (could be a follow-up)
- Per-step retries in Process Engine (already has its own retry logic)
- Dead letter queue (log + notification is sufficient for now)
Acceptance Criteria
- Schedules can be configured with retry count and backoff strategy
- Failed executions automatically retry up to the configured limit
- Retry chain is visible in Execution Detail page
- Final failure (retries exhausted) sends a notification
- MCP tools support retry configuration
- Manual task triggers support optional retry count
- Existing schedules with no retry config continue to work (backward compatible)
Metadata
Metadata
Assignees
Labels
complexity-mediumComplexity: medium (board points 5-8)priority-p1Critical pathtype-featureNew functionality
Activity
vybe commentedon Apr 10, 2026
Closing as superseded by #271, which has a tighter, more focused spec for scheduler retry mechanism.