8000 Implement Early Exit and Skip Controls for Workflows · Issue #49 · Shopify/roast · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Implement Early Exit and Skip Controls for Workflows #49

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
7 tasks done
obie opened this issue May 17, 2025 · 2 comments
Open
7 tasks done

Implement Early Exit and Skip Controls for Workflows #49

obie opened this issue May 17, 2025 · 2 comments
Labels
enhancement New feature or request

Comments

@obie
Copy link
Contributor
obie commented May 17, 2025

Early Exit and Skip Controls for Workflows

Background

Workflows sometimes need to terminate early or skip certain steps based on runtime conditions. Currently, there's no way to exit a workflow early or conditionally skip sections without complex workarounds, leading to inefficient execution paths and unnecessary processing.

Proposed Solution

Implement early exit and skip mechanisms to provide more control over workflow execution:

Early Exit Pattern

steps:
  - validate_input
  - 
    exit_if: "{{output.validate_input.fatal_error}}"
    message: "Terminating workflow due to fatal input error"
  - process_data

Skip Steps Pattern

steps:
  - process_data
  - 
    skip_if: "{{output.process_data.no_results}}"
    steps:
      - generate_visuals
      - create_dashboard

Implementation Details

  1. Exit Control

    • Add support for early workflow termination with status message
    • Allow customizable exit codes/status for integration with other systems
    • Ensure proper cleanup and state finalization on early exit
  2. Skip Control

    • Implement conditional skipping of step groups
    • Maintain workflow state consistency when steps are skipped
    • Support clear logging of skipped steps for debugging
  3. Integration with State Management

    • Record exit reasons and skip decisions in workflow state
    • Ensure state repository properly handles early termination
    • Support resumption that respects previous skip/exit decisions
  4. Workflow Validation

    • Validate that exit/skip conditions can be properly evaluated
    • Check for proper step structure in skip blocks
    • Ensure message templates are valid

Technical Approach

  1. Extend workflow configuration schema to support exit_if and skip_if structures
  2. Modify workflow executor to handle early termination and step skipping
  3. Update state persistence to record skip/exit decisions
  4. Implement clear logging and reporting for skipped steps and early exits
  5. Ensure schema validation for new control structures

Acceptance Criteria

  • Workflows can exit early based on conditions
  • Exit status/message is properly recorded and reported
  • Groups of steps can be conditionally skipped
  • Skip/exit decisions are logged clearly for debugging
  • State repository correctly handles early termination
  • Session replay respects previous skip/exit decisions
  • Documentation and examples demonstrate skip/exit usage patterns

Related Issues

Parent Epic: #46 Enhanced Control Flow for Roast Workflows

@obie obie added the enhancement New feature or request label May 17, 2025
@xrendan
Copy link
Contributor
xrendan commented May 19, 2025

This would be nicer and more extensible if instead we implemented an if

Early Exit Pattern

steps:
  - validate_input
  - 
    if: "{{output.validate_input.fatal_error}}"
    steps: 
      - exit! "Terminating workflow due to fatal input error"
  - process_data

Skip Steps Pattern

 steps:
   - process_data
   - 
     if: "{{output.process_data.no_results}}"
     steps:
       - generate_visuals
       - create_dashboard

@xrendan
61B0 Copy link
Contributor
xrendan commented May 19, 2025

This would also really helpful if this construct was exposed to tools so that a particular tool call could be used by the LLM to end the workflow itself

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants
0