You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by as...@apache.org on 2026/08/23 20:31:43 UTC

(maka) branch main updated: fix(runtime): route OpenCode Go Muse Spark through Responses (#3549)

This is an automated email from the ASF dual-hosted git repository.

Astro-Han pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/maka.git


The following commit(s) were added to refs/heads/main by this push:
     new c79e9eb40 fix(runtime): route OpenCode Go Muse Spark through Responses (#3549)
c79e9eb40 is described below

commit c79e9eb40ee4a0fcd204fb075427d635989eaaca
Author: Zane <os...@sina.cn>
AuthorDate: Mon Aug 24 04:31:38 2026 +0800

    fix(runtime): route OpenCode Go Muse Spark through Responses (#3549)
    
    The gateway serves muse-spark-1.2-contributor correctly through the Responses API, while its Chat Completions stream lacks a reliable terminal finish reason. Pin this provider/model pair to Responses instead of weakening the shared truncation guard, and cover both the scoped protocol choice and final request endpoint.
    
    Fixes #3548
    
    Generated-by: OpenAI Codex
---
 packages/core/src/__tests__/model-metadata.test.ts |  9 ++++++++
 packages/core/src/model-metadata.ts                |  1 +
 .../src/__tests__/responses-wire-contract.test.ts  | 26 ++++++++++++++++++++++
 3 files changed, 36 insertions(+)

diff --git a/packages/core/src/__tests__/model-metadata.test.ts b/packages/core/src/__tests__/model-metadata.test.ts
index c30c1e263..9eb6090bf 100644
--- a/packages/core/src/__tests__/model-metadata.test.ts
+++ b/packages/core/src/__tests__/model-metadata.test.ts
@@ -95,4 +95,13 @@ describe('openAiAdapterApiProtocol', () => {
     assert.equal(openAiAdapterApiProtocol('deepseek-v4-pro', 'deepseek'), 'openai-responses');
     assert.equal(openAiAdapterApiProtocol('deepseek-chat', 'deepseek'), 'openai-chat');
   });
+
+  it('routes only OpenCode Go Muse Spark through its supported Responses wire', () => {
+    assert.equal(
+      openAiAdapterApiProtocol('muse-spark-1.2-contributor', 'opencode-go'),
+      'openai-responses',
+    );
+    assert.equal(openAiAdapterApiProtocol('muse-spark-1.2-contributor', 'opencode'), 'openai-chat');
+    assert.equal(openAiAdapterApiProtocol('minimax-m3', 'opencode-go'), 'openai-chat');
+  });
 });
diff --git a/packages/core/src/model-metadata.ts b/packages/core/src/model-metadata.ts
index eab94234d..5d65b8fc4 100644
--- a/packages/core/src/model-metadata.ts
+++ b/packages/core/src/model-metadata.ts
@@ -137,6 +137,7 @@ export function openAiAdapterApiProtocol(
 ): 'openai-responses' | 'openai-chat' {
   const id = modelId.trim();
   return (providerType === 'deepseek' && deepSeekModelSupportsResponses(id)) ||
+    (providerType === 'opencode-go' && id === 'muse-spark-1.2-contributor') ||
     /^gpt-5/i.test(id) ||
     ((providerType === 'xai' || providerType === 'xai-oauth') && id === 'grok-4.5')
     ? 'openai-responses'
diff --git a/packages/runtime/src/__tests__/responses-wire-contract.test.ts b/packages/runtime/src/__tests__/responses-wire-contract.test.ts
index 2e6ec08c9..99b1bc93c 100644
--- a/packages/runtime/src/__tests__/responses-wire-contract.test.ts
+++ b/packages/runtime/src/__tests__/responses-wire-contract.test.ts
@@ -68,6 +68,32 @@ describe('responses wire contract', () => {
     );
   });
 
+  test('routes OpenCode Go Muse Spark through the Responses endpoint', async () => {
+    const urls: string[] = [];
+    const fetch = (async (url: string | URL | Request) => {
+      urls.push(String(url));
+      return Response.json({
+        id: 'r',
+        object: 'response',
+        status: 'completed',
+        output: [],
+        usage: { input_tokens: 1, output_tokens: 1 },
+      });
+    }) as typeof globalThis.fetch;
+    const model = getAIModel({
+      connection: conn('opencode-go'),
+      apiKey: '[redacted]',
+      modelId: 'muse-spark-1.2-contributor',
+      fetch,
+    });
+
+    await model.doGenerate({
+      prompt: [{ role: 'user', content: [{ type: 'text', text: 'ping' }] }],
+    });
+
+    assert.deepEqual(urls, ['https://opencode.ai/zen/go/v1/responses']);
+  });
+
   test('normalizes the upstream Open Responses endpoint exactly once', () => {
     assert.equal(
       openResponsesUrl('https://api.deepseek.com/v1'),


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org