fix: isolate visual tool failures from agent runs
This commit is contained in:
@@ -36,6 +36,12 @@ function messageContentItems(event) {
|
||||
export function classifySessionProviderErrorMessage(message) {
|
||||
const normalized = String(message ?? '').trim();
|
||||
if (!normalized) return 'SESSION_REPLY_ERROR';
|
||||
if (
|
||||
/unknown variant [`']?image_url[`']?.*expected [`']?text/i.test(normalized)
|
||||
|| /failed to deserialize.*image_url/i.test(normalized)
|
||||
) {
|
||||
return 'SESSION_VISUAL_CONTEXT_UNSUPPORTED';
|
||||
}
|
||||
if (/tool_calls|tool_call_id|insufficient tool messages/i.test(normalized)) {
|
||||
return 'SESSION_TOOL_HISTORY_POISONED';
|
||||
}
|
||||
@@ -60,6 +66,9 @@ function providerReplyError(event) {
|
||||
.trim();
|
||||
const error = new Error(normalized || 'session reply failed');
|
||||
error.code = classifySessionProviderErrorMessage(normalized);
|
||||
if (error.code === 'SESSION_VISUAL_CONTEXT_UNSUPPORTED') {
|
||||
error.retryable = false;
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user