diff --git a/alembic/versions/2026_03_25_0106-787109c06571_code_version_db_migration.py b/alembic/versions/2026_03_25_0106-787109c06571_code_version_db_migration.py new file mode 100644 index 000000000..2428c3128 --- /dev/null +++ b/alembic/versions/2026_03_25_0106-787109c06571_code_version_db_migration.py @@ -0,0 +1,31 @@ +"""code_version db migration + +Revision ID: 787109c06571 +Revises: 01dbfbf87496 +Create Date: 2026-03-25 01:06:29.590429+00:00 + +""" + +from typing import Sequence, Union + +import sqlalchemy as sa + +from alembic import op + +# revision identifiers, used by Alembic. +revision: str = "787109c06571" +down_revision: Union[str, None] = "01dbfbf87496" +branch_labels: Union[str, Sequence[str], None] = None +depends_on: Union[str, Sequence[str], None] = None + + +def upgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + op.add_column("workflows", sa.Column("code_version", sa.Integer(), server_default=sa.text("2"), nullable=True)) + # ### end Alembic commands ### + + +def downgrade() -> None: + # ### commands auto generated by Alembic - please adjust! ### + op.drop_column("workflows", "code_version") + # ### end Alembic commands ### diff --git a/skyvern-frontend/src/routes/workflows/RunWorkflowForm.tsx b/skyvern-frontend/src/routes/workflows/RunWorkflowForm.tsx index 8cc4b745d..70b7fd260 100644 --- a/skyvern-frontend/src/routes/workflows/RunWorkflowForm.tsx +++ b/skyvern-frontend/src/routes/workflows/RunWorkflowForm.tsx @@ -190,7 +190,7 @@ type RunWorkflowRequestBody = { max_screenshot_scrolls?: number | null; extra_http_headers?: Record | null; browser_address?: string | null; - run_with?: "agent" | "code" | "code_v2"; + run_with?: "agent" | "code"; ai_fallback?: boolean; }; @@ -265,18 +265,17 @@ function transformToWorkflowRunRequest( return transformed; } -const VALID_RUN_WITH = new Set(["agent", "code", "code_v2"]); +const VALID_RUN_WITH = new Set(["agent", "code"]); function deriveRunWith( workflow?: WorkflowApiResponse, override?: string | null, -): "agent" | "code" | "code_v2" { +): "agent" | "code" { if (override && VALID_RUN_WITH.has(override)) - return override as "agent" | "code" | "code_v2"; - if (workflow?.run_with === "code_v2") return "code_v2"; - if (workflow?.adaptive_caching && workflow?.run_with === "code") - return "code_v2"; + return override as "agent" | "code"; + if (workflow?.run_with === "agent") return "agent"; if (workflow?.run_with === "code") return "code"; + if ((workflow?.code_version ?? 0) >= 1) return "code"; return "agent"; } @@ -287,7 +286,7 @@ type RunWorkflowFormType = Record & { cdpAddress: string | null; maxScreenshotScrolls: number | null; extraHttpHeaders: string | null; - runWith: "agent" | "code" | "code_v2"; + runWith: "agent" | "code"; aiFallback: boolean | null; }; @@ -394,15 +393,6 @@ function RunWorkflowForm({ status: "published", }); - const { data: blockScriptsV2 } = useBlockScriptsQuery({ - cacheKey, - cacheKeyValue: cacheKeyValue ? `${cacheKeyValue}:v2` : "v2", - workflowPermanentId, - status: "published", - }); - - const hasCodeV2 = Object.keys(blockScriptsV2 ?? {}).length > 0; - const [hasCode, setHasCode] = useState(false); useEffect(() => { @@ -569,25 +559,6 @@ function RunWorkflowForm({ } satisfies ApiCommandOptions; }} /> - {hasCodeV2 && ( - - )}