Skip to content

Automate browser based workflows with AI

Remove default cache-key-value param from workflow debug URL (#SKY-7361) (#5008)

Celal Zamanoğlu4709a3d63a6f
diff --git a/skyvern-frontend/src/components/GlobalNotificationListener.tsx b/skyvern-frontend/src/components/GlobalNotificationListener.tsx
index ad0bd7b5d..aafaa340b 100644
--- a/skyvern-frontend/src/components/GlobalNotificationListener.tsx
+++ b/skyvern-frontend/src/components/GlobalNotificationListener.tsx
@@ -3,7 +3,6 @@ import {
useNotificationStream,
type VerificationRequest,
} from "@/hooks/useNotificationStream";
-import { enable2faNotifications } from "@/util/env";
function notificationLabel(req: VerificationRequest): string {
if (req.task_id) return `Task "${req.task_id}"`;
@@ -35,11 +34,6 @@ function VerificationCodeHandler({ req }: { req: VerificationRequest }) {
}
function GlobalNotificationListener() {
- if (!enable2faNotifications) return null;
- return <GlobalNotificationListenerInner />;
-}
-
-function GlobalNotificationListenerInner() {
const { verificationRequests } = useNotificationStream();
if (verificationRequests.length === 0) return null;
diff --git a/skyvern-frontend/src/hooks/useVerificationCodeAlert.ts b/skyvern-frontend/src/hooks/useVerificationCodeAlert.ts
index 8fa6df206..3fff5389f 100644
--- a/skyvern-frontend/src/hooks/useVerificationCodeAlert.ts
+++ b/skyvern-frontend/src/hooks/useVerificationCodeAlert.ts
@@ -1,7 +1,6 @@
import { useState, useEffect, useRef, createElement } from "react";
import { toast } from "@/components/ui/use-toast";
import { VerificationToastContent } from "@/components/VerificationToast";
-import { enable2faNotifications } from "@/util/env";
/** How long (minutes) before we consider the 2FA request timed out */
const VERIFICATION_TIMEOUT_MINS = 15;
@@ -82,7 +81,6 @@ function useVerificationCodeAlert({
// Browser notification + in-app toast (fire once per waiting transition)
useEffect(() => {
- if (!enable2faNotifications) return;
if (!isWaitingForCode || notifiedTags.has(notificationTag)) return;
notifiedTags.add(notificationTag);
diff --git a/skyvern-frontend/src/routes/root/RootLayout.tsx b/skyvern-frontend/src/routes/root/RootLayout.tsx
index d97a14518..2f1b726e2 100644
--- a/skyvern-frontend/src/routes/root/RootLayout.tsx
+++ b/skyvern-frontend/src/routes/root/RootLayout.tsx
@@ -7,6 +7,7 @@ import { Sidebar } from "./Sidebar";
import { useDebugStore } from "@/store/useDebugStore";
import { GlobalNotificationListener } from "@/components/GlobalNotificationListener";
import { SelfHealApiKeyBanner } from "@/components/SelfHealApiKeyBanner";
+import { enable2faNotifications } from "@/util/env.ts";
function RootLayout() {
const collapsed = useSidebarStore((state) => state.collapsed);
@@ -25,7 +26,7 @@ function RootLayout() {
<div className="h-full w-full">
<div className={horizontalPadding}>
<SelfHealApiKeyBanner />
- <GlobalNotificationListener />
+ {enable2faNotifications && <GlobalNotificationListener />}
</div>
<Header />
<main
diff --git a/skyvern-frontend/src/routes/workflows/editor/Workspace.tsx b/skyvern-frontend/src/routes/workflows/editor/Workspace.tsx
index b50070fd5..a10f6f837 100644
--- a/skyvern-frontend/src/routes/workflows/editor/Workspace.tsx
+++ b/skyvern-frontend/src/routes/workflows/editor/Workspace.tsx
@@ -305,6 +305,17 @@ function Workspace({
: constructCacheKeyValue({ codeKey: cacheKey, workflow }),
);
+ // Track whether the cache-key-value was explicitly provided in URL or user-selected.
+ // When false, the auto-computed value should NOT appear in the URL.
+ const cacheKeyValueIsExplicitRef = useRef(!!cacheKeyValueParam);
+
+ // Helper that marks the cache key value as explicitly user-selected before updating state.
+ // Centralizes the ref+state pair so future handlers can't forget to set the ref.
+ const setExplicitCacheKeyValue = useCallback((v: string) => {
+ cacheKeyValueIsExplicitRef.current = true;
+ setCacheKeyValue(v);
+ }, []);
+
const [showAllCode, setShowAllCode] = useState(false);
const [leftSideLayoutMode, setLeftSideLayoutMode] = useState<
"single" | "side-by-side"
@@ -372,6 +383,22 @@ function Workspace({
useEffect(() => {
const currentUrlValue = searchParams.get("cache-key-value");
+
+ if (!cacheKeyValueIsExplicitRef.current) {
+ // Auto-computed value: remove param from URL if present
+ if (currentUrlValue !== null) {
+ setSearchParams(
+ (prev) => {
+ const newParams = new URLSearchParams(prev);
+ newParams.delete("cache-key-value");
+ return newParams;
+ },
+ { replace: true },
+ );
+ }
+ return;
+ }
+
const targetValue = cacheKeyValue === "" ? null : cacheKeyValue;
if (currentUrlValue !== targetValue) {
@@ -1191,12 +1218,12 @@ function Workspace({
}
showAllCode={showAllCode}
onCacheKeyValueAccept={(v) => {
- setCacheKeyValue(v ?? "");
+ setExplicitCacheKeyValue(v ?? "");
setCacheKeyValueFilter("");
closeWorkflowPanel();
}}
onCacheKeyValuesBlurred={(v) => {
- setCacheKeyValue(v ?? "");
+ setExplicitCacheKeyValue(v ?? "");
}}
onCacheKeyValuesKeydown={(e) => {
if (e.key === "Enter") {
@@ -1289,7 +1316,7 @@ function Workspace({
setPage(page);
}}
onSelect={(cacheKeyValue) => {
- setCacheKeyValue(cacheKeyValue);
+ setExplicitCacheKeyValue(cacheKeyValue);
setCacheKeyValueFilter("");
closeWorkflowPanel();
}}
@@ -1364,7 +1391,7 @@ function Workspace({
setPage(page);
}}
onSelect={(cacheKeyValue) => {
- setCacheKeyValue(cacheKeyValue);
+ setExplicitCacheKeyValue(cacheKeyValue);
setCacheKeyValueFilter("");
closeWorkflowPanel();
}}
@@ -1420,7 +1447,7 @@ function Workspace({
setPage(page);
}}
onSelect={(cacheKeyValue) => {
- setCacheKeyValue(cacheKeyValue);
+ setExplicitCacheKeyValue(cacheKeyValue);
setCacheKeyValueFilter("");
closeWorkflowPanel();
}}