AntFleet

Disagreement · 8ff8c1af-anthropic-9

AnthropicProvider sanitizeMessages rejects empty strings but also rejects whitespace-only valid messages; resolveModel uses untyped 'effort in MODELS'

solo Opus
repo 56f59a0d·PR #2·reviewed 4 days ago

Opus finding

AnthropicProvider sanitizeMessages rejects empty strings but also rejects whitespace-only valid messages; resolveModel uses untyped 'effort in MODELS'

lowapi-contractmedium
  • src/providers/anthropic.ts:51-65
  • src/providers/anthropic.ts:68-71
(1) `effort in MODELS` permits any object-prototype key like 'toString' or 'constructor' which would return a non-model string. Use Object.prototype.hasOwnProperty.call(MODELS, effort) or a switch. (2) Trimming user messages mutates input invisibly; an assistant message of literally ' ' is rejected but a code-fenced message with leading whitespace gets stripped of its formatting. Minor but inconsistent with non-Anthropic provider which does no sanitization.

Recommendation

Use hasOwnProperty/safe lookup; do not trim content silently — validate without mutating.

Other reviewer

The other reviewer flagged nothing in this file/line range.

Why this didn't post

This finding didn't meet AntFleet's unanimous agreement threshold. Both frontier models review every PR independently; only findings they both flag with the same severity and category are posted to the PR. This one fell through.

read the methodology →

From the same review

These findings passed the unanimous gate on the same PR review. The disagreement above was filtered out; the findings below were posted.