AntFleet

Disagreement · 8ff8c1af-anthropic-12

types.ts comment claims 'thinking chunks MUST arrive before text chunks' but Anthropic provider does not enforce this invariant

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

Opus finding

types.ts comment claims 'thinking chunks MUST arrive before text chunks' but Anthropic provider does not enforce this invariant

lowdocs-gapmedium
  • src/providers/types.ts:15-21
  • src/providers/anthropic.ts:99-113
The invariant comment in types.ts is asserted as MUST, but the Anthropic implementation forwards deltas in whatever order they arrive from the SDK with no buffering or ordering enforcement. The OpenAI implementation likewise just forwards reasoning_content and content as they appear. If a downstream consumer relies on the stated invariant (UI rendering, for example), interleaved deltas will violate it silently. Either the invariant needs to be enforced (buffer text until thinking ends) or the comment is deceptive and should be softened.

Recommendation

Either buffer text deltas until first text_delta marks transition, or rewrite comment to 'Thinking and text deltas may interleave; consumers should accumulate.'

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.