Skip to content

feat: add workflow runner with per-step retry support#8

Open
yohaiai wants to merge 2 commits into
unitedbyai:mainfrom
mascotai:feat/step-retry-support
Open

feat: add workflow runner with per-step retry support#8
yohaiai wants to merge 2 commits into
unitedbyai:mainfrom
mascotai:feat/step-retry-support

Conversation

@yohaiai

@yohaiai yohaiai commented Feb 28, 2026

Copy link
Copy Markdown

Summary

  • Adds workflow-runner.ts — a multi-step workflow orchestrator with configurable per-step retry support
  • Each WorkflowStep can specify a retries count (default 0 = no retry, backwards compatible)
  • On retry, the step's app is re-launched for fresh state — critical for time-sensitive operations like TOTP 2FA where the 30-second code window may expire during execution
  • Emits workflow_step_retry dashboard events for retry visibility

Motivation

When automating flows like Instagram login with Chrome-based TOTP 2FA, the 6-digit code rotates every 30 seconds. If the code expires mid-step, the step fails. With retries: 4, we get ~5 attempts to hit a valid window, making success highly likely.

Usage

{
  "app": "com.android.chrome",
  "goal": "Copy TOTP code from Chrome, switch to Instagram, paste and submit",
  "maxSteps": 15,
  "retries": 4
}

Steps without retries behave exactly as before (single attempt, fail immediately on error).

Test plan

  • Verify steps without retries field work identically to current behavior
  • Verify step with retries: N retries up to N times on failure
  • Verify app is re-launched on each retry attempt
  • Verify workflow_step_retry dashboard events are emitted with correct attempt/maxRetries
  • Verify successful retry breaks out and continues to next step
  • Verify exhausted retries marks workflow as failed

Note: This file requires the workflowRun schema table to be added to schema.ts (not included in this PR as it depends on your schema setup).

🤖 Generated with Claude Code

yohaiai and others added 2 commits February 28, 2026 19:03
Add workflow-runner.ts that orchestrates multi-step workflow execution
with configurable per-step retries. This is critical for time-sensitive
steps like TOTP 2FA code entry where the 30-second OTP window may
expire during execution.

Key features:
- WorkflowStep.retries field (default: 0 = no retry)
- App re-launch on each retry attempt for fresh state
- Dashboard notifications for retry events (workflow_step_retry)
- Graceful abort handling during retries
- DB progress tracking per step

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant