fix: log agent runner best-effort failures

This commit is contained in:
huanghuoguoguo
2026-05-17 10:49:27 +08:00
committed by huanghuoguoguo
parent 0cdecbbf36
commit d419ee4139
3 changed files with 15 additions and 11 deletions

View File

@@ -81,8 +81,8 @@ class AgentResultNormalizer:
if isinstance(content, str) and len(content) > 10000:
# Keep reasonable length
data['chunk'] = {'role': 'assistant', 'content': content[:10000] + '...[truncated]'}
except Exception:
pass
except Exception as e:
self.ap.logger.warning(f'Failed to validate runner {descriptor.id} result size: {e}')
# Handle each result type
data = result_dict.get('data', {})
@@ -181,4 +181,4 @@ class AgentResultNormalizer:
msg = provider_message.Message.model_validate(message_data)
return msg
except Exception as e:
raise RunnerProtocolError(descriptor.id, f'Invalid message schema: {e}')
raise RunnerProtocolError(descriptor.id, f'Invalid message schema: {e}')