fix: check for error before early return in extractContentFromMessage
Addresses Codex review feedback - ensures error messages are surfaced even when content is missing/undefined
This commit is contained in:
@@ -44,7 +44,16 @@ export function extractContentFromMessage(message: unknown): string {
|
||||
const content = record.content;
|
||||
|
||||
if (typeof content === "string") return content.trim();
|
||||
if (!Array.isArray(content)) return "";
|
||||
|
||||
// Check for error BEFORE returning empty for non-array content
|
||||
if (!Array.isArray(content)) {
|
||||
const stopReason = typeof record.stopReason === "string" ? record.stopReason : "";
|
||||
if (stopReason === "error") {
|
||||
const errorMessage = typeof record.errorMessage === "string" ? record.errorMessage : "";
|
||||
return formatRawAssistantErrorForUi(errorMessage);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
const parts: string[] = [];
|
||||
for (const block of content) {
|
||||
|
||||
Reference in New Issue
Block a user