fix(perf): preserve reports for malformed failed replies

Parse failed reply/error/details/limits containers before accessing resource
references so scalar/list and malformed nested errors cannot crash grading.
Preserve the original failed response, supported facts, failed workflow and
genuine structured partial Evidence references.

Validation: 34 targeted context/grading tests and all four original factual/
workflow regrades; the final focused error-shape test also verifies a valid
partial-reference control. Unchanged SDK/comparator/model tests are not rerun.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
This commit is contained in:
N0zoM1z0
2026-10-13 19:43:51 +00:00
co-authored by factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> Kaoru0822
parent 4f025b61ae
commit 7a28dbeec6
3 changed files with 45 additions and 5 deletions
@@ -152,9 +152,12 @@ def main():
producer_results.setdefault(item['tool'], []).append(parsed)
else:
tool_errors.append({'tool': item['tool'], 'arguments': item['arguments'], 'response': parsed if parsed is not None else result})
if parsed is not None and parsed.get('error', {}).get('code') == 'resource_constraint':
reference_value = parsed['error'].get('details', {}).get('reported_limits', {}).get('evidence_reference')
observed_ids.update(evidence_ids(reference_value))
error = parsed.get('error') if isinstance(parsed, dict) else None
if isinstance(error, dict) and error.get('code') == 'resource_constraint':
details = error.get('details')
limits = details.get('reported_limits') if isinstance(details, dict) else None
if isinstance(limits, dict):
observed_ids.update(evidence_ids(limits.get('evidence_reference')))
reported_ids = evidence_ids(answer.get('evidence_ids'))
checks = {
'reported_evidence_ids_observed_in_responses': bool(reported_ids) and reported_ids <= observed_ids,