diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d1d0b6b..54cab1d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,19 @@ +# v0.4.66 (2026-05-29) + +## Features +- Add Qoder provider: device-flow OAuth, COSY signing, WAF-bypass body encoding, live model catalog, dashboard quota tracker, 11 models (#1372) +- Add new models: Claude Opus 4.8 (Claude Code), GPT 5.4 Mini (Codex) + +## Fixes +- DeepSeek thinking mode: echo `reasoning_content` back on follow-up/tool-call turns so OpenCode-free and custom providers no longer 400 with "reasoning_content must be passed back" (#1543) +- Reasoning injector: match deepseek/kimi model ids case-insensitively (covers custom providers using capitalized model names) +- OpenCode suggested-models: include free models without the `-free` suffix, e.g. `big-pickle` (#1535) + +## Improvements +- Codex: trim sunset models, keep gpt-5.5 / gpt-5.4 / gpt-5.3-codex family, add gpt-5.4-mini +- volcengine-ark: refresh model list (add DeepSeek-V4-Flash/Pro, drop EOL entries) +- Lower stream stall timeout 35s → 30s for faster hang detection + # v0.4.63 (2026-05-26) ## Fixes diff --git a/cli/package.json b/cli/package.json index 0b2f61ec..786be3c1 100644 --- a/cli/package.json +++ b/cli/package.json @@ -1,6 +1,6 @@ { "name": "9router", - "version": "0.4.63", + "version": "0.4.66", "description": "9Router CLI - Start and manage 9Router server", "bin": { "9router": "./cli.js" diff --git a/open-sse/config/runtimeConfig.js b/open-sse/config/runtimeConfig.js index 7e5da9a5..1bdce2b1 100644 --- a/open-sse/config/runtimeConfig.js +++ b/open-sse/config/runtimeConfig.js @@ -32,7 +32,7 @@ export const MEMORY_CONFIG = { }; // Stream stall timeout: abort if no chunk received within this duration -export const STREAM_STALL_TIMEOUT_MS = 35 * 1000; +export const STREAM_STALL_TIMEOUT_MS = 30 * 1000; // Fetch connect timeout: abort if upstream doesn't return response headers within this duration export const FETCH_CONNECT_TIMEOUT_MS = 20 * 1000; diff --git a/open-sse/executors/opencode.js b/open-sse/executors/opencode.js index 173869e9..2908c1e6 100644 --- a/open-sse/executors/opencode.js +++ b/open-sse/executors/opencode.js @@ -1,14 +1,19 @@ import { BaseExecutor } from "./base.js"; import { PROVIDERS } from "../config/providers.js"; +import { injectReasoningContent } from "../utils/reasoningContentInjector.js"; // Models that use /zen/v1/messages (claude format) -const MESSAGES_MODELS = new Set(["big-pickle"]); +const MESSAGES_MODELS = new Set(); export class OpenCodeExecutor extends BaseExecutor { constructor() { super("opencode", PROVIDERS.opencode); } + transformRequest(model, body) { + return injectReasoningContent({ provider: this.provider, model, body }); + } + buildUrl(model) { const base = "https://opencode.ai"; return MESSAGES_MODELS.has(model) diff --git a/open-sse/utils/reasoningContentInjector.js b/open-sse/utils/reasoningContentInjector.js index 0ace3ea0..5d9f238f 100644 --- a/open-sse/utils/reasoningContentInjector.js +++ b/open-sse/utils/reasoningContentInjector.js @@ -11,8 +11,8 @@ const PROVIDER_RULES = { // Model-level rules: matched by predicate against model id const MODEL_RULES = [ - { match: m => m?.startsWith?.("kimi-"), scope: "toolCalls" }, - { match: m => m?.startsWith?.("deepseek-"), scope: "all" } + { match: m => /^kimi-/i.test(m || ""), scope: "toolCalls" }, + { match: m => /deepseek/i.test(m || ""), scope: "all" } ]; const DEEPSEEK_V4_PRO = "deepseek-v4-pro"; diff --git a/tests/unit/reasoningContentInjector.test.js b/tests/unit/reasoningContentInjector.test.js new file mode 100644 index 00000000..56399ac5 --- /dev/null +++ b/tests/unit/reasoningContentInjector.test.js @@ -0,0 +1,97 @@ +/** + * Unit tests for reasoningContentInjector (issue #1543). + * + * DeepSeek V4 thinking mode rejects follow-up requests whose assistant + * messages omit `reasoning_content` ("The `reasoning_content` in the thinking + * mode must be passed back to the API."). OpenAI-format clients strip it, so + * the injector echoes a placeholder back. These tests lock that behavior and + * guard that the OpenCode executor (which routes deepseek-v4-flash-free) + * actually runs the injector. + */ + +import { describe, it, expect } from "vitest"; +import { injectReasoningContent } from "../../open-sse/utils/reasoningContentInjector.js"; +import { OpenCodeExecutor } from "../../open-sse/executors/opencode.js"; + +const assistantWithToolCall = { + role: "assistant", + content: "", + tool_calls: [{ id: "call_x", type: "function", function: { name: "get_weather", arguments: "{}" } }], +}; + +function bodyWith(messages) { + return { model: "deepseek-v4-flash", messages, reasoning_effort: "medium" }; +} + +describe("injectReasoningContent — DeepSeek thinking round-trip", () => { + it("injects reasoning_content on a deepseek- assistant message that lacks it", () => { + const out = injectReasoningContent({ + provider: "opencode", + model: "deepseek-v4-flash-free", + body: bodyWith([{ role: "user", content: "hi" }, assistantWithToolCall]), + }); + const assistant = out.messages.find((m) => m.role === "assistant"); + expect(typeof assistant.reasoning_content).toBe("string"); + expect(assistant.reasoning_content.length).toBeGreaterThan(0); + }); + + it("preserves an existing reasoning_content instead of overwriting it", () => { + const original = "model's real chain of thought"; + const out = injectReasoningContent({ + provider: "opencode", + model: "deepseek-v4-flash-free", + body: bodyWith([{ ...assistantWithToolCall, reasoning_content: original }]), + }); + expect(out.messages[0].reasoning_content).toBe(original); + }); + + it("applies provider-level rule for provider 'deepseek' (scope all)", () => { + const out = injectReasoningContent({ + provider: "deepseek", + model: "deepseek-chat", + body: bodyWith([{ role: "assistant", content: "answer" }]), + }); + expect(out.messages[0].reasoning_content).toBeDefined(); + }); + + it("matches deepseek model id case-insensitively for custom providers (#1543)", () => { + const out = injectReasoningContent({ + provider: "openai-compatible-custom", + model: "DeepSeek-V4-Flash", + body: bodyWith([assistantWithToolCall]), + }); + expect(out.messages[0].reasoning_content).toBeDefined(); + }); + + it("does not touch non-deepseek providers/models", () => { + const out = injectReasoningContent({ + provider: "openai", + model: "gpt-5.5", + body: bodyWith([{ role: "assistant", content: "answer" }]), + }); + expect(out.messages[0].reasoning_content).toBeUndefined(); + }); + + it("maps deepseek-v4-pro-none alias to disabled thinking and strips reasoning_effort", () => { + const out = injectReasoningContent({ + provider: "deepseek", + model: "deepseek-v4-pro-none", + body: bodyWith([{ role: "user", content: "hi" }]), + }); + expect(out.model).toBe("deepseek-v4-pro"); + expect(out.extra_body.thinking.type).toBe("disabled"); + expect(out.reasoning_effort).toBeUndefined(); + }); +}); + +describe("OpenCodeExecutor — issue #1543 regression", () => { + it("runs the injector so deepseek-v4-flash-free round-trips reasoning_content", () => { + const executor = new OpenCodeExecutor(); + const out = executor.transformRequest( + "deepseek-v4-flash-free", + bodyWith([{ role: "user", content: "hi" }, assistantWithToolCall]), + ); + const assistant = out.messages.find((m) => m.role === "assistant"); + expect(assistant.reasoning_content).toBeDefined(); + }); +});