bobbai00 commented on code in PR #6009:
URL: https://github.com/apache/texera/pull/6009#discussion_r3563599883


##########
agent-service/src/agent/tools/workflow-execution-tools.ts:
##########
@@ -504,35 +449,36 @@ export async function executeOperatorAndFormat(
     const opInfo = result.operators[operatorId];
     if (!opInfo) {
       return createErrorResult(
-        formatExecutionError(undefined, undefined, [`No result found for 
operator: ${operatorId}`])
+        formatExecutionError(undefined, [makeExecutionFailure(`No result found 
for operator: ${operatorId}`, "")])
       );
     }
 
-    if (opInfo.error) {
+    const opError = getOperatorErrorText(opInfo);
+    if (opError) {
       if (options.onResult) {
         options.onResult(operatorId, opInfo);
       }
-      return createErrorResult(formatExecutionError(undefined, [{ operatorId, 
error: opInfo.error }]));
+      return createErrorResult(formatExecutionError([{ operatorId, error: 
opError }]));
     }
 
-    if (!opInfo.result || !Array.isArray(opInfo.result)) {
+    const sampleTuples = opInfo.resultSummary?.sampleTuples;
+    if (!sampleTuples || !Array.isArray(sampleTuples)) {
       return "(no result data)";
     }
 
-    const jsonArray = opInfo.result as Record<string, any>[];
-    const headers = jsonArray.length > 0 ? 
getVisibleResultHeaders(jsonArray[0]) : [];
+    const headers = sampleTuples.length > 0 ? 
getVisibleResultHeaders(sampleTuples[0].tuple) : [];
     const columns = headers.length;
 
     // Notify for every operator in the execution so upstream stats are also 
stored.
     if (options.onResult) {
       for (const [opId, info] of Object.entries(result.operators)) {
-        if (info && !info.error) {
+        if (info && !getOperatorErrorText(info)) {
           options.onResult(opId, info);
         }
       }
     }
 
-    let dataString = jsonToTableFormat(jsonArray);
+    let dataString = formatSampleRowsAsTsv(sampleTuples);
 

Review Comment:
   Fixed in 31c817fe8. Both immediate execute-tool output and cached DAG 
context now use one non-mutating visualization redaction helper before header 
derivation and TSV serialization. Raw `html-content`/`json-content` remains in 
the result callback for frontend rendering, while LLM-facing text receives 
`<skipped: visualization content>`. The regression test uses an oversized 
snapshot payload and verifies both redaction and preservation of the callback 
data.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to