Skip to content

Fix: append trailing user turn when assistant message would be last - #277

Draft
balajigandhi wants to merge 1 commit into
ericc-ch:masterfrom
balajigandhi:fix/assistant-message-prefill
Draft

balajigandhi wants to merge 1 commit into
ericc-ch:masterfrom
balajigandhi:fix/assistant-message-prefill

Conversation

@balajigandhi

Copy link
Copy Markdown

GitHub Copilot's backend rejects Anthropic Messages API requests that end on an assistant turn for newer Claude models (400 invalid_request_body, 'This model does not support assistant message prefill'). This appends a placeholder user message ('Continue.') whenever
translateAnthropicMessagesToOpenAI would otherwise produce a trailing assistant message, so Claude Code can use these models through copilot-api without hitting this error.

An empty-string placeholder was tried first but is silently dropped by the upstream backend, leaving the conversation ending on assistant again; a non-empty placeholder is required.

GitHub Copilot's backend rejects Anthropic Messages API requests that end
on an assistant turn for newer Claude models (400 invalid_request_body,
'This model does not support assistant message prefill'). This appends a
placeholder user message ('Continue.') whenever
translateAnthropicMessagesToOpenAI would otherwise produce a trailing
assistant message, so Claude Code can use these models through copilot-api
without hitting this error.

An empty-string placeholder was tried first but is silently dropped by
the upstream backend, leaving the conversation ending on assistant again;
a non-empty placeholder is required.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Oct 5, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant