Revert "Add support for conditional blocks when running with script caching (#4603)" (#4616)

This commit is contained in:
Shuchang Zheng
2026-02-03 00:42:25 -08:00
committed by GitHub
parent 1fcd659c38
commit 91c01f9bea
3 changed files with 25 additions and 191 deletions

View File

@@ -4,7 +4,6 @@ import hashlib
import importlib.util
import json
import os
import re
import uuid
from dataclasses import dataclass
from datetime import datetime
@@ -2027,17 +2026,7 @@ async def run_script(
context.workflow_run_id = workflow_run_id
context.organization_id = organization_id
# Check if script contains conditional blocks (not supported in CLI execution)
# The marker "# === CONDITIONAL:" is generated by _build_block_statement() for conditional blocks.
with open(path, encoding="utf-8") as f:
script_content = f.read()
if re.search(r"# === CONDITIONAL:", script_content):
raise Exception(
"This script contains conditional blocks which are not supported in CLI execution. "
"Conditional blocks require the workflow engine's DAG traversal to properly evaluate "
"branch conditions at runtime. Please run this workflow through the API instead."
)
# run the script as subprocess; pass the parameters and run_id to the script
# Dynamically import the script at the given path
spec = importlib.util.spec_from_file_location("user_script", path)
if not spec or not spec.loader: