Skip to content

Commit 43354ee

Browse files
jogi47claude
andauthored
fix: convert system message content to string for Copilot provider (#11600)
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 7a9290d commit 43354ee

2 files changed

Lines changed: 19 additions & 6 deletions

File tree

packages/opencode/src/provider/sdk/copilot/chat/convert-to-openai-compatible-chat-messages.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,7 @@ export function convertToOpenAICompatibleChatMessages(prompt: LanguageModelV2Pro
1818
case "system": {
1919
messages.push({
2020
role: "system",
21-
content: [
22-
{
23-
type: "text",
24-
text: content,
25-
},
26-
],
21+
content: content,
2722
...metadata,
2823
})
2924
break

packages/opencode/test/provider/copilot/convert-to-copilot-messages.test.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,24 @@
11
import { convertToOpenAICompatibleChatMessages as convertToCopilotMessages } from "@/provider/sdk/copilot/chat/convert-to-openai-compatible-chat-messages"
22
import { describe, test, expect } from "bun:test"
33

4+
describe("system messages", () => {
5+
test("should convert system message content to string", () => {
6+
const result = convertToCopilotMessages([
7+
{
8+
role: "system",
9+
content: "You are a helpful assistant with AGENTS.md instructions.",
10+
},
11+
])
12+
13+
expect(result).toEqual([
14+
{
15+
role: "system",
16+
content: "You are a helpful assistant with AGENTS.md instructions.",
17+
},
18+
])
19+
})
20+
})
21+
422
describe("user messages", () => {
523
test("should convert messages with only a text part to a string content", () => {
624
const result = convertToCopilotMessages([

0 commit comments

Comments
 (0)