LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows
Python ai-agentsdata-engineeringdocument-aigenerative-aiidpjson-extractionllmmcp-serverocrpdf-extractionprompt-engineeringstructured-output
UN-4069 [FIX] Fix socket timeout, page crash, and upload limits for large Prompt Studio outputs (#2336)
harini-venkataramanad0d79e629dc
diff --git a/frontend/src/components/agency/agency/Agency.jsx b/frontend/src/components/agency/agency/Agency.jsxindex bb008b1bc..d24a421d5 100644--- a/frontend/src/components/agency/agency/Agency.jsx+++ b/frontend/src/components/agency/agency/Agency.jsx@@ -94,6 +94,7 @@ function Agency() {const { setPostHogCustomEvent } = usePostHogEvents();+ // biome-ignore lint/correctness/useExhaustiveDependencies: mount-only initialisation — these callbacks are stable refs and re-running on every render would duplicate network requestsuseEffect(() => {const abortController = new AbortController();const signal = abortController.signal;@@ -147,7 +148,7 @@ function Agency() {}setPrevLoadingType(loadingType);- }, [workflowStore]);+ }, [loadingType, prevLoadingType]);useEffect(() => {if (!isUpdateSteps) {@@ -569,21 +570,21 @@ function Agency() {setSourceMsg("");setDestinationMsg("");const newSteps = [...steps].map((step) => {- step["progress"] = "";- step["status"] = "";+ step.progress = "";+ step.status = "";return step;});setSteps(newSteps);}if (msgComp === "SOURCE") {- const srcMsg = message?.state + ": " + message?.message;+ const srcMsg = `${message?.state}: ${message?.message}`;setSourceMsg(srcMsg);return;}if (msgComp === "DESTINATION") {- const destMsg = message?.state + ": " + message?.message;+ const destMsg = `${message?.state}: ${message?.message}`;setDestinationMsg(destMsg);return;}@@ -600,8 +601,8 @@ function Agency() {return stepObj;}- stepObj["progress"] = message?.state;- stepObj["status"] = message?.message;+ stepObj.progress = message?.state;+ stepObj.status = message?.message;return stepObj;});setSteps(newSteps);@@ -756,7 +757,7 @@ function Agency() {) => {initializeWfComp();if (isStepExecution) {- body["execution_action"] = wfExecutionTypes[0];+ body.execution_action = wfExecutionTypes[0];}const loadingStatus = {@@ -780,9 +781,9 @@ function Agency() {duration: 0,});}- body["execution_id"] = execIdValue;+ body.execution_id = execIdValue;if (isStepExecution) {- body["execution_action"] = wfExecutionTypes[executionAction];+ body.execution_action = wfExecutionTypes[executionAction];}const wfExecRes = await handleWfExecutionApi(body);const data = wfExecRes?.data;@@ -803,8 +804,8 @@ function Agency() {});} finally {handleClearStates();- loadingStatus["isLoading"] = false;- loadingStatus["loadingType"] = "";+ loadingStatus.isLoading = false;+ loadingStatus.loadingType = "";updateWorkflow(loadingStatus);}};@@ -818,16 +819,16 @@ function Agency() {fileList.forEach((file) => {formData.append("files", file);});- formData.append("workflow_id", body["workflow_id"]);- formData.append("execution_id", body["execution_id"]);- if (body["execution_action"]) {- formData.append("execution_action", body["execution_action"]);+ formData.append("workflow_id", body.workflow_id);+ formData.append("execution_id", body.execution_id);+ if (body.execution_action) {+ formData.append("execution_action", body.execution_action);}return formData;};const shouldIncludeFile = (body) => {- return body["execution_id"] && body["execution_id"].length > 0;+ return body.execution_id && body.execution_id.length > 0;};const handleWfExecutionApi = async (body) => {@@ -891,8 +892,8 @@ function Agency() {if (isInitial) {await handleInitialExecution(body, isStepExecution, executionAction);} else {- body["execution_id"] = executionId;- body["execution_action"] = wfExecutionTypes[executionAction];+ body.execution_id = executionId;+ body.execution_action = wfExecutionTypes[executionAction];handleWfExecutionApi(body).then(() => {diff --git a/frontend/src/components/custom-tools/prompt-card/DisplayPromptResult.jsx b/frontend/src/components/custom-tools/prompt-card/DisplayPromptResult.jsxindex 6faa83494..30d8bc5c4 100644--- a/frontend/src/components/custom-tools/prompt-card/DisplayPromptResult.jsx+++ b/frontend/src/components/custom-tools/prompt-card/DisplayPromptResult.jsx@@ -1,6 +1,6 @@import { Info } from "lucide-react";import PropTypes from "prop-types";-import { useEffect, useState } from "react";+import { Fragment, useMemo, useState } from "react";import { Space } from "@/components/ui/shims/antd-layout";import { Spin } from "@/components/ui/shims/antd-leaves";import { Typography } from "@/components/ui/shims/antd-typography";@@ -8,56 +8,61 @@ import { Typography } from "@/components/ui/shims/antd-typography";import {displayPromptResult,generateApiRunStatusId,- generateUUID,PROMPT_RUN_API_STATUSES,} from "../../../helpers/GetStaticData";import "./PromptCard.css";import { useCustomToolStore } from "../../../store/custom-tool-store";import { SpinnerLoader } from "../../widgets/spinner-loader/SpinnerLoader";-const BATCH_SIZE = 100;--/**- * Renders a large JSON array in batches to avoid a single-frame DOM spike.- * The first BATCH_SIZE items render immediately; remaining items are added- * automatically via requestAnimationFrame so the browser never blocks.- * All items are rendered — nothing is hidden or requires user interaction.- *- * Highlight data indexing is preserved because the slice always starts- * from index 0 and the original array index is used throughout.- */-function BatchedArray({ data, renderItem, totalCount }) {- const [renderedCount, setRenderedCount] = useState(- Math.min(BATCH_SIZE, totalCount),+const RENDER_CAP = 50;++function CappedArray({ data, renderItem, totalCount }) {+ const [visibleCount, setVisibleCount] = useState(+ Math.min(RENDER_CAP, totalCount),);- useEffect(() => {- if (renderedCount >= totalCount) {- return;- }- const id = requestAnimationFrame(() => {- setRenderedCount((prev) => Math.min(prev + BATCH_SIZE, totalCount));- });- return () => cancelAnimationFrame(id);- }, [renderedCount, totalCount]);+ const remaining = totalCount - visibleCount;++ const showMoreLink = remaining > 0 && (+ <Typography.Link+ className="font-size-12"+ onClick={() =>+ setVisibleCount((prev) => Math.min(prev + RENDER_CAP, totalCount))+ }+ >+ ...show more ({remaining} remaining)+ </Typography.Link>+ );return (<>{"["}<div style={{ paddingLeft: "20px" }}>- {data?.slice(0, renderedCount).map((item, index) => (+ {remaining > 0 && (+ <div+ className="font-size-12"+ style={{+ color: "var(--text-tertiary, #888)",+ padding: "2px 0 4px",+ }}+ >+ Showing {visibleCount} of {totalCount} items — {showMoreLink}+ </div>+ )}+ {data.slice(0, visibleCount).map((item, index) => (<div key={index}>{renderItem(item, index)}{index < totalCount - 1 ? "," : ""}</div>))}+ {showMoreLink}</div>{"]"}</>);}-BatchedArray.propTypes = {+CappedArray.propTypes = {data: PropTypes.array.isRequired,renderItem: PropTypes.func.isRequired,totalCount: PropTypes.number.isRequired,@@ -79,8 +84,6 @@ function DisplayPromptResult({},progressMsg,}) {- const [isLoading, setIsLoading] = useState(false);- const [parsedOutput, setParsedOutput] = useState(null);const [selectedKey, setSelectedKey] = useState(null);const {singlePassExtractMode,@@ -89,34 +92,23 @@ function DisplayPromptResult({selectedHighlight,} = useCustomToolStore();- useEffect(() => {- if (singlePassExtractMode && isSinglePassExtractLoading) {- setIsLoading(true);- return;- }+ // Derived — no state updates, so no render-loop risk.+ const statusKey = generateApiRunStatusId(docId, profileId);+ const isLoading =+ (singlePassExtractMode && isSinglePassExtractLoading) ||+ promptRunStatus?.[statusKey] === PROMPT_RUN_API_STATUSES.RUNNING;- const key = generateApiRunStatusId(docId, profileId);- if (promptRunStatus?.[key] === PROMPT_RUN_API_STATUSES.RUNNING) {- setIsLoading(true);- return;+ const parsedOutput = useMemo(() => {+ if (isLoading || output === undefined || output === null) {+ return null;}-- setIsLoading(false);- const isFormattingRequired = isTable ? false : true;- setParsedOutput(- displayPromptResult(- output,- isFormattingRequired,- details?.enable_highlight,- ),+ const isFormattingRequired = !isTable;+ return displayPromptResult(+ output,+ isFormattingRequired,+ details?.enable_highlight,);- }, [- promptRunStatus,- isSinglePassExtractLoading,- details?.enable_highlight,- output,- isTable,- ]);+ }, [output, isTable, details?.enable_highlight, isLoading]);if (isLoading) {return (@@ -264,142 +256,150 @@ function DisplayPromptResult({path = "",isTable = false,) => {- if (isTable) {- const stringData =- typeof data === "string" ? data : JSON.stringify(data, null, 4);- const lines = stringData.split("\n");- const truncated = lines.slice(0, 25).join("\n");- return (- <div>- {truncated}- {lines.length > 25 && (- <Typography.Link- className="font-size-12"- onClick={() => {- setOpenExpandModal(true);- }}- >- ...show more- </Typography.Link>- )}- </div>- );- }- if (typeof data === "object" && !details?.enable_highlight) {- return JSON.stringify(data, null, 4);- }+ try {+ if (isTable) {+ const stringData =+ typeof data === "string" ? data : JSON.stringify(data, null, 4);+ const lines = stringData.split("\n");+ const truncated = lines.slice(0, 25).join("\n");+ return (+ <div>+ {truncated}+ {lines.length > 25 && (+ <Typography.Link+ className="font-size-12"+ onClick={() => {+ setOpenExpandModal(true);+ }}+ >+ ...show more+ </Typography.Link>+ )}+ </div>+ );+ }+ if (typeof data === "object" && !details?.enable_highlight) {+ return JSON.stringify(data, null, 4);+ }- if (typeof data === "string") {- return `"${data}"`;- }+ if (typeof data === "string") {+ return `"${data}"`;+ }- if (typeof data === "number" || typeof data === "boolean") {- return data.toString();- }+ if (typeof data === "number" || typeof data === "boolean") {+ return data.toString();+ }- if (Array.isArray(data)) {- const renderArrayItem = (item, index) =>- renderJson(- item,- highlightData?.[index],- confidenceData?.[index],- wordConfidenceData?.[index],- indent + 1,- `${path}[${index}]`,- isTable,+ if (Array.isArray(data)) {+ const renderArrayItem = (item, index) =>+ renderJson(+ item,+ highlightData?.[index],+ confidenceData?.[index],+ wordConfidenceData?.[index],+ indent + 1,+ `${path}[${index}]`,+ isTable,+ );++ if (data.length > RENDER_CAP) {+ return (+ <CappedArray+ data={data}+ totalCount={data.length}+ renderItem={renderArrayItem}+ />+ );+ }+ return (+ <>+ {"["}+ <div style={{ paddingLeft: "20px" }}>+ {data?.map((item, index) => (+ <div key={index}>+ {renderArrayItem(item, index)}+ {index < data.length - 1 ? "," : ""}+ </div>+ ))}+ </div>+ {"]"}+ </>);+ }- if (data.length > BATCH_SIZE) {+ if (isObject(data)) {return (- <BatchedArray- data={data}- totalCount={data.length}- renderItem={renderArrayItem}- />+ <>+ {"{"}+ <div style={{ paddingLeft: "20px" }}>+ {Object.entries(data).map(([key, value], index, array) => {+ const isClickable = !isObject(value) && !Array.isArray(value); // Only primitive values should be clickable+ const newPath = path ? `${path}.${key}` : key;+ const isSelected = selectedKey === newPath;+ return (+ <div key={key}>+ <Space wrap className="json-key">+ {key}+ </Space>+ {": "}+ <Typography.Text+ className={`prompt-output-result json-value ${+ isClickable && highlightData?.[key] ? "clickable" : ""+ } ${isSelected ? "selected" : ""}`}+ onClick={() => {+ if (isClickable && highlightData?.[key]) {+ handleClick(+ highlightData,+ confidenceData,+ wordConfidenceData,+ key,+ newPath,+ );+ }+ }}+ >+ {renderJson(+ value,+ highlightData?.[key],+ confidenceData?.[key],+ wordConfidenceData?.[key],+ indent + 1,+ newPath,+ isTable,+ )}+ </Typography.Text>+ {index < array.length - 1 ? "," : ""}+ </div>+ );+ })}+ </div>+ {"}"}+ </>);}- return (- <>- {"["}- <div style={{ paddingLeft: "20px" }}>- {data?.map((item, index) => (- <div key={index}>- {renderArrayItem(item, index)}- {index < data.length - 1 ? "," : ""}- </div>- ))}- </div>- {"]"}- </>- );- }- if (isObject(data)) {+ return String(data);+ } catch {return (- <>- {"{"}- <div style={{ paddingLeft: "20px" }}>- {Object.entries(data).map(([key, value], index, array) => {- const isClickable = !isObject(value) && !Array.isArray(value); // Only primitive values should be clickable- const newPath = path ? `${path}.${key}` : key;- const isSelected = selectedKey === newPath;- return (- <div key={key}>- <Space wrap className="json-key">- {key}- </Space>- {": "}- <Typography.Text- className={`prompt-output-result json-value ${- isClickable && highlightData?.[key] ? "clickable" : ""- } ${isSelected ? "selected" : ""}`}- onClick={() => {- if (isClickable && highlightData?.[key]) {- handleClick(- highlightData,- confidenceData,- wordConfidenceData,- key,- newPath,- );- }- }}- >- {renderJson(- value,- highlightData?.[key],- confidenceData?.[key],- wordConfidenceData?.[key],- indent + 1,- newPath,- isTable,- )}- </Typography.Text>- {index < array.length - 1 ? "," : ""}- </div>- );- })}- </div>- {"}"}- </>+ <Typography.Text type="danger">Unable to render output</Typography.Text>);}-- return String(data);};return (<Typography.Paragraph className="prompt-card-display-output font-size-12">{parsedOutput && typeof parsedOutput === "object" ? (- renderJson(- parsedOutput,- highlightData,- confidenceData,- wordConfidenceData,- 0,- "",- isTable,- )+ <Fragment key={`${docId}-${profileId}`}>+ {renderJson(+ parsedOutput,+ highlightData,+ confidenceData,+ wordConfidenceData,+ 0,+ "",+ isTable,+ )}+ </Fragment>) : (<TextResultenableHighlight={details?.enable_highlight}diff --git a/frontend/src/components/custom-tools/prompt-card/DisplayPromptResult.test.jsx b/frontend/src/components/custom-tools/prompt-card/DisplayPromptResult.test.jsxindex 3fea8249b..ecd72dc15 100644--- a/frontend/src/components/custom-tools/prompt-card/DisplayPromptResult.test.jsx+++ b/frontend/src/components/custom-tools/prompt-card/DisplayPromptResult.test.jsx@@ -1,15 +1,19 @@-import { render, screen } from "@testing-library/react";+import { fireEvent, render, screen } from "@testing-library/react";import React from "react";-import { describe, expect, it, vi } from "vitest";+import { afterEach, describe, expect, it, vi } from "vitest";++// Mutable store state so individual tests can override it.+const defaultStore = {+ singlePassExtractMode: false,+ isSinglePassExtractLoading: false,+ details: {},+ selectedHighlight: null,+};+let storeOverride = null;// Mock dependencies before importing the componentvi.mock("../../../store/custom-tool-store", () => ({- useCustomToolStore: () => ({- singlePassExtractMode: false,- isSinglePassExtractLoading: false,- details: {},- selectedHighlight: null,- }),+ useCustomToolStore: () => storeOverride || defaultStore,}));vi.mock("../../../helpers/GetStaticData", () => ({@@ -66,3 +70,50 @@ describe("DisplayPromptResult null/undefined guard", () => {expect(screen.queryByText(/Yet to run/)).not.toBeInTheDocument();});});++describe("CappedArray rendering", () => {+ afterEach(() => {+ storeOverride = null;+ });++ it("renders only first 50 items for a 200-item array", () => {+ storeOverride = { ...defaultStore, details: { enable_highlight: true } };++ const largeArray = Array.from({ length: 200 }, (_, i) => `item-${i}`);+ render(<DisplayPromptResult {...baseProps} output={largeArray} />);++ // Top indicator shows count+ expect(screen.getByText(/Showing 50 of 200 items/)).toBeInTheDocument();++ // "show more" links should appear (top + bottom)+ expect(screen.getAllByText(/show more \(150 remaining\)/).length).toBe(2);++ // Item 50 text should NOT be in the document+ expect(screen.queryByText(/item-50/)).not.toBeInTheDocument();+ });++ it("reveals next batch on 'show more' click", () => {+ storeOverride = { ...defaultStore, details: { enable_highlight: true } };++ const largeArray = Array.from({ length: 120 }, (_, i) => `item-${i}`);+ render(<DisplayPromptResult {...baseProps} output={largeArray} />);++ // Initially 50 visible+ expect(screen.getByText(/Showing 50 of 120/)).toBeInTheDocument();+ expect(screen.getAllByText(/show more \(70 remaining\)/).length).toBe(2);++ // Click the first "show more" (top indicator)+ fireEvent.click(screen.getAllByText(/show more/)[0]);++ // Now 100 items visible+ expect(screen.getByText(/Showing 100 of 120/)).toBeInTheDocument();+ expect(screen.getAllByText(/show more \(20 remaining\)/).length).toBe(2);++ // Click again to show the rest+ fireEvent.click(screen.getAllByText(/show more/)[0]);++ // All 120 items visible, no "show more" link or indicator+ expect(screen.queryByText(/show more/)).not.toBeInTheDocument();+ expect(screen.queryByText(/Showing/)).not.toBeInTheDocument();+ });+});diff --git a/frontend/src/hooks/usePromptOutput.js b/frontend/src/hooks/usePromptOutput.jsindex 6f4ef40e4..ef6f644c2 100644--- a/frontend/src/hooks/usePromptOutput.js+++ b/frontend/src/hooks/usePromptOutput.js@@ -206,10 +206,12 @@ const usePromptOutput = () => {updatedPromptOutputs = { ...updatedPromptOutputs, ...currentOutput };}Object.keys(updatedPromptOutputs).forEach((innerKey) => {- const [existingPromptId, , , existingIsSinglePass] =- innerKey.split("__"); // Extract promptId from key+ const [existingPromptId, , existingProfile, existingIsSinglePass] =+ innerKey.split("__");+ const [, , keyProfile] = key.split("__");if (keyPromptId === existingPromptId &&+ keyProfile === existingProfile &&keyIsSinglePass === existingIsSinglePass) {updatedPromptOutputs[innerKey].coverage = outputs[key]?.coverage;diff --git a/frontend/src/hooks/usePromptStudioSocket.js b/frontend/src/hooks/usePromptStudioSocket.jsindex 4c72fb9d2..1d7a811dd 100644--- a/frontend/src/hooks/usePromptStudioSocket.js+++ b/frontend/src/hooks/usePromptStudioSocket.js@@ -25,7 +25,7 @@ const usePromptStudioSocket = () => {useCustomToolStore();const { setAlertDetails } = useAlertStore();const handleException = useExceptionHandler();- const { updatePromptOutputState } = usePromptOutput();+ const { updatePromptOutputState, promptOutputApi } = usePromptOutput();const { setPostHogCustomEvent } = usePostHogEvents();const clearPromptStatuses = useCallback(@@ -42,23 +42,80 @@ const usePromptStudioSocket = () => {);const handleCompleted = useCallback(- (operation, result, extra) => {- if (operation === "fetch_response") {- const data = Array.isArray(result) ? result : [];- updatePromptOutputState(data, false, extra?.elapsed || 0);- clearPromptStatuses(- extra?.prompt_ids,- extra?.document_id,- extra?.profile_manager_id,- );- setAlertDetails({- type: "success",- content: "Prompt execution completed successfully.",- });- } else if (operation === "single_pass_extraction") {- const data = Array.isArray(result) ? result : [];+ async (operation, result, extra) => {+ if (+ operation === "fetch_response" ||+ operation === "single_pass_extraction"+ ) {+ // Use inline result if present (backward compat with old backend),+ // otherwise refetch via API to avoid DATA_UPLOAD_MAX_MEMORY_SIZE.+ let data = Array.isArray(result) ? result : [];+ if (data.length === 0) {+ try {+ const res = await promptOutputApi(+ details?.tool_id,+ extra?.document_id,+ null,+ extra?.profile_manager_id,+ operation === "single_pass_extraction",+ );+ // promptOutputApi catches errors and returns them instead of+ // throwing, so check that the response looks like a success.+ if (res?.status >= 200 && res?.status < 300) {+ data = Array.isArray(res?.data) ? res.data : [];+ } else {+ // Fetch failed — preserve existing results, only clear spinners.+ clearPromptStatuses(+ extra?.prompt_ids,+ extra?.document_id,+ extra?.profile_manager_id,+ );+ if (operation === "single_pass_extraction") {+ updateCustomTool({ isSinglePassExtractLoading: false });+ }+ setAlertDetails({+ type: "error",+ content:+ "Failed to fetch prompt output — existing results preserved.",+ });+ return;+ }+ } catch {+ // Network error — preserve existing results, only clear spinners.+ clearPromptStatuses(+ extra?.prompt_ids,+ extra?.document_id,+ extra?.profile_manager_id,+ );+ if (operation === "single_pass_extraction") {+ updateCustomTool({ isSinglePassExtractLoading: false });+ }+ setAlertDetails({+ type: "error",+ content:+ "Failed to fetch prompt output — existing results preserved.",+ });+ return;+ }++ // Guard against tool switch while the API call was in flight:+ // if the user moved to a different tool, discard stale results.+ const currentToolId = useCustomToolStore.getState().details?.tool_id;+ if (+ currentToolId &&+ details?.tool_id &&+ currentToolId !== details.tool_id+ ) {+ return;+ }+ }+ // Merge into existing outputs (false) so results for other+ // documents / profiles are preserved.updatePromptOutputState(data, false, extra?.elapsed || 0);- updateCustomTool({ isSinglePassExtractLoading: false });++ if (operation === "single_pass_extraction") {+ updateCustomTool({ isSinglePassExtractLoading: false });+ }clearPromptStatuses(extra?.prompt_ids,extra?.document_id,@@ -66,7 +123,10 @@ const usePromptStudioSocket = () => {);setAlertDetails({type: "success",- content: "Single pass extraction completed successfully.",+ content:+ operation === "single_pass_extraction"+ ? "Single pass extraction completed successfully."+ : "Prompt execution completed successfully.",});} else if (operation === "index_document") {const docId = result?.document_id;@@ -81,11 +141,13 @@ const usePromptStudioSocket = () => {},[updatePromptOutputState,+ promptOutputApi,clearPromptStatuses,updateCustomTool,setAlertDetails,deleteIndexDoc,selectedDoc,+ details,],);diff --git a/frontend/src/layouts/rjsf-form-layout/CustomObjectFieldTemplate.jsx b/frontend/src/layouts/rjsf-form-layout/CustomObjectFieldTemplate.jsxindex 99777d9ff..c1835d480 100644--- a/frontend/src/layouts/rjsf-form-layout/CustomObjectFieldTemplate.jsx+++ b/frontend/src/layouts/rjsf-form-layout/CustomObjectFieldTemplate.jsx@@ -26,7 +26,7 @@ const CustomObjectFieldTemplate = (props) => {// Auto-detect if we have file expiry fields that should be rendered side-by-sideconst hasFileExpiryFields =- propertyMap["reprocessInterval"] && propertyMap["intervalUnit"];+ propertyMap.reprocessInterval && propertyMap.intervalUnit;// Filter fields based on conditionsconst shouldShowConditionalFields =@@ -61,8 +61,8 @@ const CustomObjectFieldTemplate = (props) => {fieldName === "reprocessInterval" &&shouldShowConditionalFields) {- const intervalProperty = propertyMap["reprocessInterval"];- const unitProperty = propertyMap["intervalUnit"];+ const intervalProperty = propertyMap.reprocessInterval;+ const unitProperty = propertyMap.intervalUnit;if (intervalProperty && unitProperty) {return (diff --git a/frontend/src/store/custom-tool-store.js b/frontend/src/store/custom-tool-store.jsindex 2aefc0992..dc374ddd1 100644--- a/frontend/src/store/custom-tool-store.js+++ b/frontend/src/store/custom-tool-store.js@@ -74,16 +74,16 @@ const useCustomToolStore = create((setState, getState) => ({if (type === promptType.prompt) {const newPrompt = { ...defaultPromptInstance };- newPrompt["prompt_id"] = `unsaved_${promptsAndNotes.length + 1}`;+ newPrompt.prompt_id = `unsaved_${promptsAndNotes.length + 1}`;promptsAndNotes.push(newPrompt);} else {const newNote = { ...defaultNoteInstance };- newNote["prompt_id"] = `unsaved_${promptsAndNotes.length + 1}`;+ newNote.prompt_id = `unsaved_${promptsAndNotes.length + 1}`;promptsAndNotes.push(newNote);}- newState["details"]["prompts"] = [...promptsAndNotes];+ newState.details.prompts = [...promptsAndNotes];// Mark as having unsaved changes when a new prompt/note is added- newState["hasUnsavedChanges"] = true;+ newState.hasUnsavedChanges = true;setState({ ...newState });},deleteInstance: (promptId) => {@@ -92,9 +92,9 @@ const useCustomToolStore = create((setState, getState) => ({const filteredData = promptsAndNotes.filter((item) => item?.prompt_id !== promptId,);- newState["details"]["prompts"] = filteredData;+ newState.details.prompts = filteredData;// Mark as having unsaved changes when a prompt/note is deleted- newState["hasUnsavedChanges"] = true;+ newState.hasUnsavedChanges = true;setState({ ...newState });},getDropdownItems: (propertyName) => {diff --git a/frontend/src/store/prompt-output-store.js b/frontend/src/store/prompt-output-store.jsindex a8e01b18d..5117db24f 100644--- a/frontend/src/store/prompt-output-store.js+++ b/frontend/src/store/prompt-output-store.js@@ -15,13 +15,13 @@ const usePromptOutputStore = create((setState, getState) => ({},updatePromptOutput: (outputs) => {const existingState = { ...getState() };- let promptOutputs = existingState["promptOutputs"];+ let promptOutputs = existingState.promptOutputs;promptOutputs = { ...promptOutputs, ...outputs };setState({ promptOutputs });},deletePromptOutput: (key) => {const existingState = { ...getState() };- const promptOutputs = existingState["promptOutputs"];+ const promptOutputs = existingState.promptOutputs;delete promptOutputs[key];setState({ promptOutputs });},diff --git a/workers/ide_callback/tasks.py b/workers/ide_callback/tasks.pyindex 1a298dffe..a13a6fe06 100644--- a/workers/ide_callback/tasks.py+++ b/workers/ide_callback/tasks.py@@ -435,7 +435,7 @@ def ide_prompt_complete()# Persist outputs via internal API- resp = api.update_prompt_output(+ api.update_prompt_output(run_id=run_id,prompt_ids=prompt_ids,outputs=outputs,@@ -445,8 +445,6 @@ def ide_prompt_complete(profile_manager_id=profile_manager_id,organization_id=org_id,)- response = resp.get("data", []) if resp.get("success") else []-_track_subscription_usage(org_id, run_id)# Fire HubSpot event if applicable@@ -476,7 +474,9 @@ def ide_prompt_complete("elapsed": int(time.time() - dispatch_time) if dispatch_time else 0,},status="completed",- result=response,+ # result intentionally omitted — output already persisted via+ # update_prompt_output(); frontend refetches via promptOutputApi+ # to avoid DATA_UPLOAD_MAX_MEMORY_SIZE on emit-websocket endpoint.)# Return minimal status to avoid logging sensitive extracted datareturn {"status": "completed", "operation": operation}diff --git a/workers/tests/test_ide_callback.py b/workers/tests/test_ide_callback.pyindex 02c5e10b4..ceca9aca2 100644--- a/workers/tests/test_ide_callback.py+++ b/workers/tests/test_ide_callback.py@@ -487,17 +487,17 @@ class TestIdePromptComplete:@patch(_PATCH_EMIT_WS)@patch(_PATCH_GET_CLIENT)- def test_output_api_failure_returns_empty_response(self, mock_get_client, mock_emit_ws, mock_api, base_prompt_kwargs):- """When update_prompt_output returns success=False, response is []."""+ def test_output_api_failure_omits_result_from_ws(self, mock_get_client, mock_emit_ws, mock_api, base_prompt_kwargs):+ """When update_prompt_output returns success=False, result is not in WS event."""mock_get_client.return_value = mock_apimock_api.update_prompt_output.return_value = {"success": False}result = self._call(self._make_result(), base_prompt_kwargs)assert result["status"] == "completed"- # The emitted result should be the empty list+ # result intentionally omitted from WS event — frontend refetchesws_data = mock_emit_ws.call_args[1]["data"]- assert ws_data["result"] == []+ assert "result" not in ws_data# ---------------------------------------------------------------------------