[PR #9418] fix(opencode): resolve Perplexity Sonar 400 error - enforce message alternation #13102

Open
opened 2026-02-16 18:17:58 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/9418

State: open
Merged: No


Problem

Perplexity Sonar models reject requests with 400 error when consecutive user messages are sent (violates alternation requirement).

Solution

Merge consecutive user messages for Perplexity providers only. Preserves all content with \n\n separator.

Testing

  • Added test: perplexity-message-alternation.test.ts
  • All 74 provider transform tests pass
  • All 6 LLM tests pass
  • Verified: Mistral and all other providers unaffected
  • Tested scenarios: tools with attachments, multi-step interactions

Fixes #9416

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/9418 **State:** open **Merged:** No --- ## Problem Perplexity Sonar models reject requests with 400 error when consecutive user messages are sent (violates alternation requirement). ## Solution Merge consecutive user messages for Perplexity providers only. Preserves all content with `\n\n` separator. ## Testing - Added test: perplexity-message-alternation.test.ts - All 74 provider transform tests pass - All 6 LLM tests pass - Verified: Mistral and all other providers unaffected - Tested scenarios: tools with attachments, multi-step interactions Fixes #9416
yindo added the pull-request label 2026-02-16 18:17:58 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#13102