AntFleet

Disagreement · 8ff8c1af-anthropic-1

OpenAIProvider streamMessage sends `system` role in messages even when systemPrompt is undefined

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

Opus finding

OpenAIProvider streamMessage sends `system` role in messages even when systemPrompt is undefined

mediumapi-contracthigh
  • src/providers/openai.ts:115-122
  • src/providers/openai.ts:189-195
StreamOptions/SendOptions declare systemPrompt as required string, but unlike AnthropicProvider there is no fallback to CAPYBARA_SYSTEM_PROMPT and no validation. If a caller passes empty string or undefined (TS will not catch all runtime callers using `as any` or dynamic data), the request will include `{role:'system', content: undefined}` which most OpenAI-compatible endpoints reject with 400. The asymmetry with AnthropicProvider (which falls back to CAPYBARA_SYSTEM_PROMPT) violates the BaseProvider contract behavior expected by orchestrator code.

Recommendation

Validate systemPrompt or omit the system message entirely when empty/undefined; mirror Anthropic's CAPYBARA_SYSTEM_PROMPT fallback for symmetric provider behavior.

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.