fix: surface remaining paired evidence loss (#203)

This commit is contained in:
Eyejoker
2026-05-31 16:57:49 +09:00
committed by GitHub
parent 239c7ff1e6
commit c0703836e1
14 changed files with 327 additions and 31 deletions

View File

@@ -25,6 +25,14 @@ function attachmentLabel(attachment: OutboundAttachment): string {
return attachment.name?.trim() || attachment.path.split('/').at(-1) || 'file';
}
function nonImageAttachmentReason(attachment: OutboundAttachment): string {
const mime = attachment.mime?.trim();
if (mime) {
return `${mime} is not loaded as structured model input`;
}
return 'non-image attachment is not loaded as structured model input';
}
function formatTurnOutputAttachmentContext(
attachments: OutboundAttachment[] | undefined,
): string {
@@ -33,7 +41,9 @@ function formatTurnOutputAttachmentContext(
const label = attachmentLabel(attachment);
return isImageAttachment(attachment)
? `[Image: ${label}${attachment.path}]`
: `[Attachment: ${label}${attachment.path}]`;
: `[Attachment unavailable: ${label}${attachment.path}${nonImageAttachmentReason(
attachment,
)}]`;
});
return `\n\nAttached evidence from this turn:\n${lines.join('\n')}`;
}