Skip to content

Automate browser based workflows with AI

Split growth-funnel activation into real, Copilot-test and editor-debug runs (#8903)

Aaron Pereza041c5ec3460
diff --git a/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotChat.tsx b/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotChat.tsx
index 943bf9ebb..6a267ec2e 100644
--- a/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotChat.tsx
+++ b/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotChat.tsx
@@ -9,6 +9,7 @@ import {
type AcceptAttempt,
applyWroteNothing,
type GateFailure,
+ gateFailureAllowsAction,
proposalTokenOf,
definitiveAcceptRejection,
} from "./acceptFence";
@@ -10295,19 +10296,19 @@ export function WorkflowCopilotChat({
gateFailure?.kind === "saved" ||
gateFailure?.kind === "recover" ||
gateFailure?.kind === "changed";
- // Mid-turn Accept would be clobbered by the in-flight turn's terminal restore, so the gate's
- // footer waits for idle. Another writer's claim holds the workflow, and an Accept now would only
- // be refused.
- const gateActionsShown =
- gateHasSubject && !isLoading && !isLoadingHistory && !unattributedClaim;
- // Accept, Reject and Test write over the proposal, so they wait out an Accept whose outcome is
- // unresolved, and a proposal that could not be re-read.
+ // Mid-turn Accept would be clobbered by the in-flight turn's terminal restore, so the gate waits
+ // for idle. Another writer's claim holds the workflow, and an Accept now would only be refused.
+ const gateIdleAndUnclaimed =
+ !isLoading && !isLoadingHistory && !unattributedClaim;
+ const gateActionsShown = gateHasSubject && gateIdleAndUnclaimed;
+ // A different question from the one above, asked from its own subject: Accept, Reject and Test
+ // write over a staged proposal, so they need one in hand, they wait out an Accept whose outcome
+ // is unresolved, and they stay dark in the gates that may not write at all.
const gateActionable =
- gateActionsShown &&
+ Boolean(proposedWorkflow) &&
+ gateIdleAndUnclaimed &&
!isAccepting &&
- gateFailureKind !== "reload" &&
- gateFailureKind !== "recover" &&
- gateFailureKind !== "saved";
+ gateFailureAllowsAction(gateFailureKind);
// The chip jumps to the gate, so it waits for the gate's footer rather than pointing at a card
// with nothing to click.
const pendingChipVisible = Boolean(
diff --git a/skyvern-frontend/src/routes/workflows/copilot/acceptFence.ts b/skyvern-frontend/src/routes/workflows/copilot/acceptFence.ts
index 0cf0998d7..ce13bb168 100644
--- a/skyvern-frontend/src/routes/workflows/copilot/acceptFence.ts
+++ b/skyvern-frontend/src/routes/workflows/copilot/acceptFence.ts
@@ -62,6 +62,19 @@ export type GateFailure =
} & AcceptAttempt)
| { kind: "reload"; attempt: AcceptAttempt | null };
+// The gates that render a card but may never carry live actions: what Accept, Reject and Test
+// would write over is already saved (`saved`), may be saved (`recover`), or could not be re-read
+// (`reload`), so a write from one of them is an overwrite rather than a decision.
+const ACTIONLESS_GATE_KINDS: ReadonlySet<GateFailure["kind"]> = new Set([
+ "reload",
+ "recover",
+ "saved",
+]);
+
+export const gateFailureAllowsAction = (
+ kind: GateFailure["kind"] | null,
+): boolean => kind === null || !ACTIONLESS_GATE_KINDS.has(kind);
+
// The one rule for "the server may still be writing this Accept", and the deadline the fence
// ends at. A reported remainder is the server's own; an absent field (not an explicit null) is
// an instance that predates it, which can only name the claim — and that claim can run for the
diff --git a/skyvern-frontend/src/routes/workflows/copilot/cards/ReviewGateCard.test.tsx b/skyvern-frontend/src/routes/workflows/copilot/cards/ReviewGateCard.test.tsx
index d4249cc18..374262599 100644
--- a/skyvern-frontend/src/routes/workflows/copilot/cards/ReviewGateCard.test.tsx
+++ b/skyvern-frontend/src/routes/workflows/copilot/cards/ReviewGateCard.test.tsx
@@ -433,7 +433,10 @@ describe("ReviewGateCard — Test end-to-end recourse", () => {
turn={turn({ proposalDisposition: "review_untested", blocks: [] })}
pending
verdict="untested"
- actionsEnabled
+ // A failed gate reaches the card with its footer shown and its actions already withheld,
+ // which is the only thing that locks the row.
+ actionsShown
+ actionsEnabled={failure === null}
hasProposal
onAccept={noop}
onAlwaysAccept={noop}
diff --git a/skyvern-frontend/src/routes/workflows/copilot/cards/ReviewGateCard.tsx b/skyvern-frontend/src/routes/workflows/copilot/cards/ReviewGateCard.tsx
index 993b125cd..aa8675ffc 100644
--- a/skyvern-frontend/src/routes/workflows/copilot/cards/ReviewGateCard.tsx
+++ b/skyvern-frontend/src/routes/workflows/copilot/cards/ReviewGateCard.tsx
@@ -616,14 +616,7 @@ export function ReviewGateCard({
turn !== undefined &&
everyTestBlockExecuted(turn) &&
!testFailed));
- // The caller already withholds actionsEnabled in these states; this keeps the row locked if it
- // ever does not.
- const actionsLocked =
- !actionsEnabled ||
- accepting ||
- failure === "reload" ||
- failure === "recover" ||
- failure === "saved";
+ const actionsLocked = !actionsEnabled || accepting;
// A lock that lands mid-confirmation would strand it behind the disabled fieldset.
if (confirmingTest && actionsLocked) {
restoreFocusRef.current = true;