Skip to content

Automate browser based workflows with AI

fix: simplify code block gating and fix empty script execution reasoning (#5047)

pedrohsdb6ce5c10f0ef4
diff --git a/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunCode.tsx b/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunCode.tsx
index b6a9c7e9c..96f682f4f 100644
--- a/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunCode.tsx
+++ b/skyvern-frontend/src/routes/workflows/workflowRun/WorkflowRunCode.tsx
@@ -25,17 +25,18 @@ import { useCredentialGetter } from "@/hooks/useCredentialGetter";
import { useToast } from "@/components/ui/use-toast";
import { Pencil1Icon } from "@radix-ui/react-icons";
-import { useFeatureFlag } from "@/hooks/useFeatureFlag";
import { CopyAndExplainCode } from "../editor/Workspace";
import { ScriptFixInput } from "./ScriptFixInput";
+const enableCodeBlock =
+ import.meta.env.VITE_ENABLE_CODE_BLOCK?.toLowerCase() === "true";
+
interface Props {
showCacheKeyValueSelector?: boolean;
}
function WorkflowRunCode(props?: Props) {
const showCacheKeyValueSelector = props?.showCacheKeyValueSelector ?? false;
- const codeBlockEnabled = useFeatureFlag("CODE_BLOCK_ENABLED");
const queryClient = useQueryClient();
const credentialGetter = useCredentialGetter();
const { toast } = useToast();
@@ -285,7 +286,7 @@ function WorkflowRunCode(props?: Props) {
// Edit button shown when not in edit mode and there's a script to edit
const editButton =
- codeBlockEnabled && canEdit && !isEditing ? (
+ enableCodeBlock && canEdit && !isEditing ? (
<Button
variant="outline"
size="sm"
@@ -299,7 +300,7 @@ function WorkflowRunCode(props?: Props) {
// Save / Cancel buttons shown during edit mode
const editActions =
- codeBlockEnabled && isEditing ? (
+ enableCodeBlock && isEditing ? (
<div className="flex items-center gap-2">
<Button
variant="ghost"
@@ -376,7 +377,7 @@ function WorkflowRunCode(props?: Props) {
{versionSelector}
{!isEditing && code.length > 0 && <CopyAndExplainCode code={code} />}
</div>
- {codeBlockEnabled &&
+ {enableCodeBlock &&
code.length > 0 &&
isFinalized &&
workflowPermanentId && (
@@ -463,7 +464,7 @@ function WorkflowRunCode(props?: Props) {
) : null}
{!isEditing && code.length > 0 && <CopyAndExplainCode code={code} />}
</div>
- {codeBlockEnabled &&
+ {enableCodeBlock &&
code.length > 0 &&
isFinalized &&
workflowPermanentId && (
diff --git a/skyvern/core/script_generations/script_skyvern_page.py b/skyvern/core/script_generations/script_skyvern_page.py
index 6d5516cba..1dcb9d360 100644
--- a/skyvern/core/script_generations/script_skyvern_page.py
+++ b/skyvern/core/script_generations/script_skyvern_page.py
@@ -465,7 +465,7 @@ class ScriptSkyvernPage(SkyvernPage):
await app.DATABASE.update_action_reasoning(
organization_id=str(context.organization_id),
action_id=str(created_action.action_id),
- reasoning=f"Script execution: {intention[:80]}",
+ reasoning=f"Script execution: {intention[:80]}" if intention else "Script execution",
)
else:
asyncio.create_task(