Skip to content

Commit 27dca05

Browse files
committed
fix(pdf-server): isError only for single-command failures, not failedAt===0
failedAt===0 in a multi-step batch still has a positional contract to honor — content.length=1 vs commandList.length=3 is a signal the model loses if the SDK flattens the array to a string. The ERROR text encodes "step 1/3" but the simpler rule ("batches never set isError") is easier to document and reason about.
1 parent 26d3ea0 commit 27dca05

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

examples/pdf-server/server.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2539,8 +2539,12 @@ Example — add a signature image and a stamp, then screenshot to verify:
25392539

25402540
return {
25412541
content: allContent,
2542-
// Only safe to set when there's nothing before content[0] to lose.
2543-
...(failedAt === 0 ? { isError: true } : {}),
2542+
// isError flattens to a string in some SDKs, losing the array
2543+
// shape. Only set it when there was never going to be an array
2544+
// — single command, no positional contract to break.
2545+
...(failedAt >= 0 && commandList.length === 1
2546+
? { isError: true }
2547+
: {}),
25442548
};
25452549
},
25462550
);

0 commit comments

Comments
 (0)