Automate browser based workflows with AI
Python aiapiautomationbrowserbrowser-automationcomputergptllmplaywrightpowerautomatepuppeteerpythonrpaseleniumvisionworkflow
Give a tokenless Copilot Accept an outcome the client can read back (SKY-17870) (#8906)
Aaron Perez717519a8fc95
diff --git a/pyproject.toml b/pyproject.tomlindex dd0ce3ca0..3855c9df3 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -1,6 +1,6 @@[project]name = "skyvern"-version = "1.0.56"+version = "1.0.55"description = ""authors = [{ name = "Skyvern AI", email = "[email protected]" }]requires-python = ">=3.11,<3.15"diff --git a/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotChat.reviewGate.test.tsx b/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotChat.reviewGate.test.tsxindex a7bcd4f3f..2e636db2a 100644--- a/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotChat.reviewGate.test.tsx+++ b/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotChat.reviewGate.test.tsx@@ -1966,107 +1966,136 @@ describe("WorkflowCopilotChat — g2 review gate", () => {"500 unchanged","cleared unchanged","pending newer commit",- ])("settles uncertain Accept from proposal evidence: %s", async (outcome) => {- const baseline = {- ...saveData.workflow,- version: 1,- modified_at: "2026-09-01T00:00:00Z",- };- saveData.workflow = baseline;- const canonical = {- ...baseline,- ...proposedWorkflowPayload({ workflow_id: "wf_accepted" }),- version: 2,- modified_at: "2026-09-02T00:00:00Z",- };- historyResponse.data.proposed_workflow = canonical;- if (!outcome.startsWith("legacy")) {- historyResponse.data.proposed_workflow_metadata = {- owner_turn_id: "turn-recovered",- revision: 1,- canonical_fingerprint: "baseline",- disposition: "review_untested",- workflow_run_id: null,+ ])(+ "settles uncertain Accept only from a recorded outcome: %s",+ async (outcome) => {+ const baseline = {+ ...saveData.workflow,+ version: 1,+ modified_at: "2026-09-01T00:00:00Z",};- historyResponse.data.chat_history = pausedHistory().chat_history;- }- const apply = vi.fn();- await renderChat({ onWorkflowUpdate: apply });- const accept = await screen.findByRole(- "button",- { name: "Accept" },- { timeout: 10_000 },- );- const owner = createYamlCommitOwner("wpid_1");- registerEditorOwner(owner);- cancelPost.mockRejectedValueOnce(- Object.assign(new Error("accept failed"), {- response: { status: 500 },- }),- );- if (["500 unchanged", "pending newer commit"].includes(outcome)) {- historyResponse.data.proposed_workflow_metadata = {- ...historyResponse.data.proposed_workflow_metadata!,- disposition: "accepting",- claimed_at: new Date(Date.now() - 301_000).toISOString(),+ saveData.workflow = baseline;+ const canonical = {+ ...baseline,+ ...proposedWorkflowPayload({ workflow_id: "wf_accepted" }),+ version: 2,+ modified_at: "2026-09-02T00:00:00Z",};- }- const committed =- outcome.endsWith("commit") || outcome === "cleared unchanged";- const saved = outcome === "cleared unchanged" ? baseline : canonical;- historyGet.mockImplementation((path: string) =>- Promise.resolve(- path === "/workflows/wpid_1"- ? { data: committed ? saved : baseline }- : historyResponse,- ),- );- historyGet.mockClear();- vi.useFakeTimers();- await act(async () => fireEvent.click(accept));- expect(apply).not.toHaveBeenCalled();- expect(historyGet).not.toHaveBeenCalled();- expect(beginSaveTransaction(owner)).toBe(false);- if (committed && outcome !== "pending newer commit")- historyResponse.data.proposed_workflow = null;- await act(async () => vi.advanceTimersByTimeAsync(2_000));- if (- ["legacy unchanged", "500 unchanged", "pending newer commit"].includes(- outcome,- )- ) {- expect(apply).not.toHaveBeenCalled();- expect(beginSaveTransaction(owner)).toBe(false);- await act(async () => vi.advanceTimersByTimeAsync(1_500_000));- expect(screen.getByRole("button", { name: "Reload" })).toBeTruthy();- expect(beginSaveTransaction(owner)).toBe(false);- return;- }- expect(historyGet.mock.calls.map(([path]) => path)).toEqual([- "/workflow/copilot/chat-history",- "/workflows/wpid_1",- ]);- expect(historyGet.mock.calls[0]?.[1]?.params).toEqual({- workflow_copilot_chat_id: "chat-1",- });- if (committed)- expect(apply).toHaveBeenCalledWith(- saved,- expect.objectContaining({ persisted: true }),+ historyResponse.data.proposed_workflow = canonical;+ if (!outcome.startsWith("legacy")) {+ historyResponse.data.proposed_workflow_metadata = {+ owner_turn_id: "turn-recovered",+ revision: 1,+ canonical_fingerprint: "baseline",+ disposition: "review_untested",+ workflow_run_id: null,+ };+ historyResponse.data.chat_history = pausedHistory().chat_history;+ }+ const accepted = outcome === "interrupted commit";+ if (accepted) historyResponse.data.chat_history = [];+ const apply = vi.fn();+ await renderChat({ onWorkflowUpdate: apply });+ const accept = await screen.findByRole(+ "button",+ { name: "Accept" },+ { timeout: 10_000 },);- else {- expect(apply).not.toHaveBeenCalled();- expect(toast).toHaveBeenCalledWith(- expect.objectContaining({- title: "Accept failed",- variant: "destructive",+ const owner = createYamlCommitOwner("wpid_1");+ registerEditorOwner(owner);+ cancelPost.mockRejectedValueOnce(+ Object.assign(new Error("accept failed"), {+ response: { status: 500 },}),);- expect(screen.getByRole("button", { name: "Accept" })).toBeTruthy();- }- expect(useWorkflowYamlEditorStore.getState().copilotAcceptance).toBeNull();- expect(beginSaveTransaction(owner)).toBe(true);- });+ if (["500 unchanged", "pending newer commit"].includes(outcome)) {+ historyResponse.data.proposed_workflow_metadata = {+ ...historyResponse.data.proposed_workflow_metadata!,+ disposition: "accepting",+ claimed_at: new Date(Date.now() - 301_000).toISOString(),+ };+ }+ const committed =+ outcome.endsWith("commit") || outcome === "cleared unchanged";+ const saved = outcome === "cleared unchanged" ? baseline : canonical;+ if (accepted) historyResponse.data.accepted_turn_ids = ["turn-recovered"];+ historyGet.mockImplementation((path: string) =>+ Promise.resolve(+ path === "/workflows/wpid_1"+ ? { data: committed ? saved : baseline }+ : historyResponse,+ ),+ );+ historyGet.mockClear();+ vi.useFakeTimers();+ await act(async () => fireEvent.click(accept));+ expect(apply).not.toHaveBeenCalled();+ expect(historyGet).not.toHaveBeenCalled();+ expect(beginSaveTransaction(owner)).toBe(false);+ if (committed && outcome !== "pending newer commit")+ historyResponse.data.proposed_workflow = null;+ await act(async () => vi.advanceTimersByTimeAsync(2_000));+ if (!accepted) {+ expect(+ screen.queryByText("Accepted and saved to the workflow"),+ ).toBeNull();+ if (outcome === "cleared unchanged") {+ expect(historyGet.mock.calls.map(([path]) => path)).toEqual([+ "/workflow/copilot/chat-history",+ "/workflows/wpid_1",+ ]);+ expect(apply).toHaveBeenCalledWith(+ saved,+ expect.objectContaining({ persisted: true }),+ );+ expect(beginSaveTransaction(owner)).toBe(true);+ }+ if (+ [+ "legacy unchanged",+ "500 unchanged",+ "pending newer commit",+ ].includes(outcome)+ ) {+ expect(historyGet.mock.calls.map(([path]) => path)).toEqual([+ "/workflow/copilot/chat-history",+ ]);+ expect(apply).not.toHaveBeenCalled();+ expect(beginSaveTransaction(owner)).toBe(false);+ await act(async () => vi.advanceTimersByTimeAsync(1_500_000));+ expect(screen.getByRole("button", { name: "Reload" })).toBeTruthy();+ expect(beginSaveTransaction(owner)).toBe(false);+ }+ return;+ }+ expect(historyGet.mock.calls.map(([path]) => path)).toEqual([+ "/workflow/copilot/chat-history",+ "/workflows/wpid_1",+ ]);+ expect(historyGet.mock.calls[0]?.[1]?.params).toEqual({+ workflow_copilot_chat_id: "chat-1",+ });+ if (committed)+ expect(apply).toHaveBeenCalledWith(+ saved,+ expect.objectContaining({ persisted: true }),+ );+ else {+ expect(apply).not.toHaveBeenCalled();+ expect(toast).toHaveBeenCalledWith(+ expect.objectContaining({+ title: "Accept failed",+ variant: "destructive",+ }),+ );+ expect(screen.getByRole("button", { name: "Accept" })).toBeTruthy();+ }+ expect(+ useWorkflowYamlEditorStore.getState().copilotAcceptance,+ ).toBeNull();+ expect(beginSaveTransaction(owner)).toBe(true);+ },+ );it.each(["canonical", "proposal"])("retains uncertain Accept only while the %s read fails, then Retry settles",@@ -13556,7 +13585,7 @@ describe("WorkflowCopilotChat — g2 review gate", () => {"cleared unchanged","pending newer commit",])(- "A42 settles uncertain Accept from proposal evidence: %s",+ "A42 settles uncertain Accept only from a recorded outcome: %s",async (outcome) => {changesState.hasChanges = true;const baseline = {@@ -13599,6 +13628,8 @@ describe("WorkflowCopilotChat — g2 review gate", () => {const committed =outcome.endsWith("commit") || outcome === "cleared unchanged";const saved = outcome === "cleared unchanged" ? baseline : canonical;+ const accepted = outcome === "interrupted commit";+ if (accepted) historyResponse.data.accepted_turn_ids = ["turn-recovered"];historyGet.mockImplementation((path: string) =>Promise.resolve(path === "/workflows/wpid_1"@@ -13615,13 +13646,18 @@ describe("WorkflowCopilotChat — g2 review gate", () => {if (committed && outcome !== "pending newer commit")historyResponse.data.proposed_workflow = null;await act(async () => vi.advanceTimersByTimeAsync(2_000));- if (!committed || outcome === "pending newer commit") {- expect(historyGet.mock.calls.map(([path]) => path)).toEqual([- "/workflow/copilot/chat-history",- ]);- expect(apply).not.toHaveBeenCalled();- expect(beginSaveTransaction(owner)).toBe(false);- expect(screen.getByRole("button", { name: "Retry" })).toBeTruthy();+ if (!accepted) {+ expect(+ screen.queryByText("Accepted and saved to the workflow"),+ ).toBeNull();+ if (!committed || outcome === "pending newer commit") {+ expect(historyGet.mock.calls.map(([path]) => path)).toEqual([+ "/workflow/copilot/chat-history",+ ]);+ expect(apply).not.toHaveBeenCalled();+ expect(beginSaveTransaction(owner)).toBe(false);+ expect(screen.getByRole("button", { name: "Retry" })).toBeTruthy();+ }return;}expect(historyGet.mock.calls.map(([path]) => path)).toEqual([@@ -13791,6 +13827,7 @@ describe("A46 Accept recovery", () => {expect(beginSaveTransaction(owner)).toBe(false);historyResponse.data.proposed_workflow = null;historyResponse.data.proposed_workflow_metadata = null;+ historyResponse.data.accepted_turn_ids = ["turn-pending"];const canonical = { ...saveData.workflow, version: 2 };historyGet.mockImplementation((path: string) =>Promise.resolve(@@ -13857,6 +13894,214 @@ describe("A46 Accept recovery", () => {).not.toBeNull();});+ it.each([true, false])(+ "recovers a tokenless Accept receipt only when history names its turn: %s",+ async (accepted) => {+ historyResponse.data.proposed_workflow = proposedWorkflowPayload();+ historyResponse.data.proposed_workflow_metadata = null;+ historyResponse.data.chat_history = [+ {+ sender: "ai",+ content: "Draft ready.",+ created_at: new Date().toISOString(),+ turn_outcome: {+ copilot_turn_id: "turn-tokenless",+ terminal_reason: null,+ },+ narrative_payload: proposalNarrativePayload({+ turnId: "turn-tokenless",+ }),+ },+ ];+ const canonical = {+ ...saveData.workflow,+ ...proposedWorkflowPayload({ workflow_id: "wf_accepted", version: 2 }),+ };+ const recoveredHistory = {+ data: {+ ...structuredClone(historyResponse.data),+ proposed_workflow: null,+ accepted_turn_ids: accepted ? ["turn-tokenless"] : [],+ },+ };+ const apply = vi.fn();+ await renderChat({ onWorkflowUpdate: apply });+ const accept = await screen.findByRole("button", { name: "Accept" });+ historyGet.mockImplementation((path: string) =>+ Promise.resolve(+ path === "/workflows/wpid_1" ? { data: canonical } : recoveredHistory,+ ),+ );+ cancelPost.mockRejectedValueOnce(new Error("Accept response lost"));+ await act(async () => {+ fireEvent.click(accept);+ });++ await waitFor(() => expect(apply).toHaveBeenCalledOnce());+ if (accepted) {+ expect(+ await screen.findByText("Accepted and saved to the workflow"),+ ).toBeTruthy();+ } else {+ expect(+ screen.queryByText("Accepted and saved to the workflow"),+ ).toBeNull();+ }+ expect(+ cancelPost.mock.calls.find(+ ([path]) => path === "/workflow/copilot/apply-proposed-workflow",+ )?.[1],+ ).toMatchObject({ owner_turn_id: "turn-tokenless" });+ },+ );++ it("recovers a tokenless Accept receipt after reload from its accepted turn", async () => {+ historyResponse.data.proposed_workflow = proposedWorkflowPayload();+ historyResponse.data.proposed_workflow_metadata = {+ owner_turn_id: "turn-tokenless",+ revision: 1,+ canonical_fingerprint: "baseline",+ disposition: "accepting",+ workflow_run_id: null,+ };+ historyResponse.data.proposed_claim_expires_in_seconds = 120;+ historyResponse.data.chat_history = [+ {+ sender: "ai",+ content: "Draft ready.",+ created_at: new Date().toISOString(),+ turn_outcome: {+ copilot_turn_id: "turn-tokenless",+ terminal_reason: null,+ },+ narrative_payload: proposalNarrativePayload({+ turnId: "turn-tokenless",+ }),+ },+ ];+ storeOwnAccept();+ const claimedHistory = structuredClone(historyResponse);+ claimedHistory.data.proposed_workflow = null;+ claimedHistory.data.proposed_workflow_metadata = null;+ claimedHistory.data.accepted_turn_ids = [];+ const acceptedHistory = {+ data: {+ ...claimedHistory.data,+ proposed_claim_expires_in_seconds: null,+ accepted_turn_ids: ["turn-tokenless"],+ },+ };+ let acceptingHistoryReads = 0;+ historyGet.mockClear();+ historyGet.mockImplementation(+ (+ path: string,+ config?: { params?: { workflow_copilot_chat_id?: string } },+ ) =>+ Promise.resolve(+ path === "/workflows/wpid_1"+ ? { data: saveData.workflow }+ : config?.params?.workflow_copilot_chat_id === "chat-1"+ ? ++acceptingHistoryReads === 1+ ? claimedHistory+ : acceptedHistory+ : claimedHistory,+ ),+ );+ vi.useFakeTimers();+ await renderChat();+ await act(async () => vi.advanceTimersByTimeAsync(2_000));++ expect(screen.getByText("Accepted and saved to the workflow")).toBeTruthy();+ });++ it("recovers a completed Accept receipt already present in the first history read", async () => {+ const acceptedHistory = {+ data: {+ ...structuredClone(historyResponse.data),+ proposed_workflow: null,+ proposed_workflow_metadata: null,+ proposed_claim_expires_in_seconds: null,+ accepted_turn_ids: ["turn-tokenless"],+ chat_history: [+ {+ sender: "ai",+ content: "Draft ready.",+ created_at: new Date().toISOString(),+ turn_outcome: {+ copilot_turn_id: "turn-tokenless",+ terminal_reason: null,+ },+ narrative_payload: proposalNarrativePayload({+ turnId: "turn-tokenless",+ }),+ },+ ],+ },+ };+ const canonical = {+ ...saveData.workflow,+ ...proposedWorkflowPayload({ workflow_id: "wf_accepted", version: 2 }),+ };+ storePendingAccept("wpid_1", {+ chatId: "chat-1",+ acceptAttempt: {+ owner_turn_id: "turn-tokenless",+ revision: 1,+ disposition: "review_untested",+ },+ alwaysAccept: false,+ });+ historyGet.mockImplementation((path: string) =>+ Promise.resolve(+ path === "/workflows/wpid_1" ? { data: canonical } : acceptedHistory,+ ),+ );+ const apply = vi.fn();+ vi.useFakeTimers();+ await renderChat({ onWorkflowUpdate: apply });+ await act(async () => vi.advanceTimersByTimeAsync(2_000));++ expect(apply).toHaveBeenCalledOnce();+ expect(screen.getByText("Accepted and saved to the workflow")).toBeTruthy();+ });++ it("does not recover an old receipt while a newer tokenless proposal is present", async () => {+ historyResponse.data.proposed_workflow = proposedWorkflowPayload();+ historyResponse.data.proposed_workflow_metadata = null;+ historyResponse.data.accepted_turn_ids = ["turn-previous"];+ historyResponse.data.chat_history = [+ {+ sender: "ai",+ content: "Draft ready.",+ created_at: new Date().toISOString(),+ turn_outcome: {+ copilot_turn_id: "turn-current",+ terminal_reason: null,+ },+ narrative_payload: proposalNarrativePayload({ turnId: "turn-current" }),+ },+ ];+ storePendingAccept("wpid_1", {+ chatId: "chat-1",+ acceptAttempt: {+ owner_turn_id: "turn-previous",+ revision: 1,+ disposition: "review_untested",+ },+ alwaysAccept: false,+ });+ vi.useFakeTimers();+ await renderChat();+ await act(async () => vi.advanceTimersByTimeAsync(2_000));++ expect(useWorkflowYamlEditorStore.getState().copilotAcceptance).toBeNull();+ expect(screen.getByRole("button", { name: "Accept" })).toBeTruthy();+ const owner = createYamlCommitOwner("wpid_1");+ registerEditorOwner(owner);+ expect(beginSaveTransaction(owner)).toBe(true);+ });+it.each([null, 0, -1])("A46 restores an accepting row with liveness %s",async (remaining) => {@@ -14303,6 +14548,15 @@ async function checkSerializedAcceptRecovery(first: "aborted" | "failed" | "live",) {historyResponse.data.proposed_workflow = proposedWorkflowPayload();+ historyResponse.data.chat_history = [+ {+ sender: "ai",+ content: "Draft ready.",+ created_at: new Date().toISOString(),+ turn_outcome: { copilot_turn_id: "turn-1", terminal_reason: null },+ narrative_payload: proposalNarrativePayload({ turnId: "turn-1" }),+ },+ ];const apply = vi.fn();await renderChat({ onWorkflowUpdate: apply });vi.useFakeTimers();@@ -14382,6 +14636,7 @@ async function checkSerializedAcceptRecovery(reads[1]!.resolve({data: {...historyResponse.data,+ accepted_turn_ids: ["turn-1"],proposed_workflow: null,proposed_claim_expires_in_seconds: null,},diff --git a/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotChat.tsx b/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotChat.tsxindex 6a267ec2e..a9e9f9e67 100644--- a/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotChat.tsx+++ b/skyvern-frontend/src/routes/workflows/copilot/WorkflowCopilotChat.tsx@@ -1559,6 +1559,7 @@ type CanonicalRecovery = {keepProposalTurnId?: string;// The turn whose proposal this Accept took, kept for a proposal with no token to say it.acceptedTurnId?: string | null;+ acceptedOutcomeConfirmed?: boolean;acceptAttempt?: Pick<CopilotProposalMetadata,"owner_turn_id" | "revision" | "disposition"@@ -4683,21 +4684,28 @@ export function WorkflowCopilotChat({if (!workflowPermanentId || !row.workflow_copilot_chat_id) return;const remaining = row.proposed_claim_expires_in_seconds;const metadata = row.proposed_workflow_metadata;- // The marker counts only for the proposal it was written for, so one that outlived its own- // Accept cannot claim a later proposal; a tokenless Accept's marker never matches.+ // A tokenless marker is recoverable only when history positively records its turn as accepted.const stored = readStoredAccept(workflowPermanentId);+ const sameChatStored =+ stored?.chatId === row.workflow_copilot_chat_id ? stored : null;+ const storedTurnId = sameChatStored?.acceptAttempt?.owner_turn_id;+ const storedTurnAccepted =+ storedTurnId != null && row.accepted_turn_ids?.includes(storedTurnId);+ const storedReceiptMatchesProposal =+ storedTurnAccepted &&+ (!row.proposed_workflow || metadata?.owner_turn_id === storedTurnId);const ownStored =- stored !== null &&+ sameChatStored !== null &&metadata != null &&- stored.chatId === row.workflow_copilot_chat_id &&- stored.acceptAttempt?.owner_turn_id === metadata.owner_turn_id &&- stored.acceptAttempt?.revision === metadata.revision- ? stored+ sameChatStored.acceptAttempt?.owner_turn_id === metadata.owner_turn_id &&+ sameChatStored.acceptAttempt?.revision === metadata.revision+ ? sameChatStored: null;if (!(typeof remaining === "number" && remaining > 0) &&metadata?.disposition !== "accepting" &&- !ownStored+ !ownStored &&+ !storedReceiptMatchesProposal)return;const parked =@@ -4716,6 +4724,10 @@ export function WorkflowCopilotChat({chatId: row.workflow_copilot_chat_id,acceptChatId: row.workflow_copilot_chat_id,acceptAttempt: ownStored?.acceptAttempt ?? metadata ?? null,+ acceptedTurnId:+ existing?.acceptedTurnId ??+ sameChatStored?.acceptAttempt?.owner_turn_id ??+ null,// History reports a live claim from any chat on the workflow, and a proposal can stay// accepting after its own claim died, so only this tab's stored Accept makes the claim its own.unattributedClaim: !ownStored,@@ -5158,10 +5170,7 @@ export function WorkflowCopilotChat({[credentialGetter],);- // Clears the staged proposal unless it is provably another (another token, or another owner turn- // when the Accept had no token); missing identity clears, since keeping a replaced proposal is a- // false receipt. Without a token an accepting proposal never counts, as a tokenless one gets a- // fresh owner when its Accept claims it.+ // Keep a staged proposal only when its token or legacy owner turn proves it is different.const settleAcceptedProposal = useCallback((ownerTurnId: string | null,@@ -5174,17 +5183,20 @@ export function WorkflowCopilotChat({setAcceptedTurnIds(accepted);}const staged = stagedProposalMetadata.current;- if (- staged !== null &&- (acceptedToken !== null- ? proposalTokenOf(staged) !== acceptedToken- : acceptedTurnId !== null &&- staged.disposition !== "accepting" &&- staged.owner_turn_id !== acceptedTurnId)- ) {+ const differentProposal =+ staged === null+ ? acceptedTurnId !== null &&+ pendingProposalTurnIdRef.current !== null &&+ pendingProposalTurnIdRef.current !== acceptedTurnId+ : acceptedToken !== null+ ? proposalTokenOf(staged) !== acceptedToken+ : acceptedTurnId !== null &&+ staged.disposition !== "accepting" &&+ staged.owner_turn_id !== acceptedTurnId;+ if (differentProposal) {// Staging skips retagging while an Accept is pending, so the kept proposal still carries// the accepted one's tag, and with it that proposal's title and graph edits.- if (workflowPermanentId)+ if (workflowPermanentId && staged !== null)useWorkflowTitleStore.getState().trackCopilotMetadata(@@ -5361,7 +5373,8 @@ export function WorkflowCopilotChat({);if (!applied) return false;const observedSave =- pending.savedFromApply === true &&+ (pending.savedFromApply === true ||+ pending.acceptedOutcomeConfirmed === true) &&!pending.gateAttempt?.wroteNothing;if (settleAcceptedProposal(@@ -5449,6 +5462,16 @@ export function WorkflowCopilotChat({)throw new Error("Accept recovery read cancelled");proposal = history.data.proposed_workflow;+ pending.acceptedOutcomeConfirmed ||= Boolean(+ !pending.gateAttempt?.wroteNothing &&+ pending.acceptedTurnId &&+ history.data.accepted_turn_ids?.includes(+ pending.acceptedTurnId,+ ),+ );+ if (pending.acceptedOutcomeConfirmed && stillOnRecoveryChat()) {+ applyChatRowProposal(history.data, autoAcceptWritesAtRead);+ }const metadata = history.data.proposed_workflow_metadata;const attempt = pending.acceptAttempt;const remaining = history.data.proposed_claim_expires_in_seconds;@@ -5673,6 +5696,17 @@ export function WorkflowCopilotChat({variant: "destructive",});}+ if (+ pending.acceptedOutcomeConfirmed &&+ pending.acceptedTurnId &&+ stillOnRecoveryChat() &&+ settleAcceptedProposal(+ pending.acceptedTurnId,+ pending.gateAttempt?.token ?? null,+ pending.acceptedTurnId,+ )+ )+ setAcceptReceiptAnchor(gateReceiptAnchorRef.current);clearRecoveryProposal();if (pending.acceptChatId && stillOnRecoveryChat())setGateFailure(@@ -5783,7 +5817,13 @@ export function WorkflowCopilotChat({revision: pendingProposalMetadata.revision,disposition: pendingProposalMetadata.disposition,}- : null;+ : pendingProposalTurnId+ ? {+ owner_turn_id: pendingProposalTurnId,+ revision: 1,+ disposition: "review_untested" as const,+ }+ : null;const preservedSettings =structuredClone(saveData?.settings) ??(proposalPreservedSettings.current?.workflow === workflowdiff --git a/skyvern/forge/sdk/routes/workflow_copilot.py b/skyvern/forge/sdk/routes/workflow_copilot.pyindex 0253d933f..1f9a6a931 100644--- a/skyvern/forge/sdk/routes/workflow_copilot.py+++ b/skyvern/forge/sdk/routes/workflow_copilot.py@@ -4958,7 +4958,7 @@ async def workflow_copilot_apply_proposed_workflow(organization_id=organization.organization_id,workflow_copilot_chat_id=chat.workflow_copilot_chat_id,expected_proposal=proposal,- owner_turn_id=uuid.uuid4().hex,+ owner_turn_id=apply_request.owner_turn_id or uuid.uuid4().hex,)else:claimed = await app.DATABASE.workflow_params.claim_workflow_copilot_candidate(@@ -5058,8 +5058,8 @@ async def workflow_copilot_apply_proposed_workflow(expected_disposition="accepting",expected_claimed_at=claim.claimed_at,auto_accept=apply_request.auto_accept,- # A minted token names no turn a client can match, so only a published one is a receipt.- record_acceptance=metadata is not None,+ # A server-minted legacy claim is not a receipt unless the client can match it to a turn.+ record_acceptance=metadata is not None or bool(apply_request.owner_turn_id),)breakexcept Exception as e:diff --git a/skyvern/forge/sdk/schemas/workflow_copilot.py b/skyvern/forge/sdk/schemas/workflow_copilot.pyindex b06c3be23..1b843c5eb 100644--- a/skyvern/forge/sdk/schemas/workflow_copilot.py+++ b/skyvern/forge/sdk/schemas/workflow_copilot.py@@ -626,7 +626,9 @@ class WorkflowCopilotApplyProposedWorkflowRequest(BaseModel):False,description="If true, flip the chat to auto-accept mode so future turns persist directly without review",)- owner_turn_id: str | None = Field(None, description="Owner token returned with a typed proposal")+ owner_turn_id: str | None = Field(+ None, description="Owner turn for the proposal; used to match typed proposals and record tokenless Accepts"+ )revision: int | None = Field(None, ge=1, description="Revision token returned with a typed proposal")diff --git a/uv.lock b/uv.lockindex eeb5ff5da..12efdf9e4 100644--- a/uv.lock+++ b/uv.lock@@ -6897,7 +6897,7 @@ wheels = [[[package]]name = "skyvern"-version = "1.0.56"+version = "1.0.55"source = { editable = "." }dependencies = [{ name = "cachetools" },