fix(merge): resolve dev conflicts for openclaw branch
This commit is contained in:
@@ -9,7 +9,6 @@ import { createAutoSlashCommandHook } from "../hooks/auto-slash-command"
|
||||
import { createStartWorkHook } from "../hooks/start-work"
|
||||
import { readBoulderState } from "../features/boulder-state"
|
||||
import { _resetForTesting, setMainSession, subagentSessions, registerAgentName, updateSessionAgent, getSessionAgent } from "../features/claude-code-session-state"
|
||||
import { getAgentListDisplayName } from "../shared/agent-display-names"
|
||||
import { clearSessionModel, getSessionModel, setSessionModel } from "../shared/session-model-state"
|
||||
|
||||
type ChatMessagePart = { type: string; text?: string; [key: string]: unknown }
|
||||
@@ -87,7 +86,7 @@ describe("createChatMessageHandler - /start-work integration", () => {
|
||||
await handler(input, output)
|
||||
|
||||
// then
|
||||
expect(output.message["agent"]).toBe("Sisyphus - Ultraworker")
|
||||
expect(output.message["agent"]).toBe("sisyphus")
|
||||
expect(output.parts[0].text).toContain("<auto-slash-command>")
|
||||
expect(output.parts[0].text).toContain("Auto-Selected Plan")
|
||||
expect(output.parts[0].text).toContain("boulder.json has been created")
|
||||
@@ -116,7 +115,7 @@ describe("createChatMessageHandler - /start-work integration", () => {
|
||||
await handler(input, output)
|
||||
|
||||
// then
|
||||
expect(output.message["agent"]).toBe("Sisyphus - Ultraworker")
|
||||
expect(output.message["agent"]).toBe("sisyphus")
|
||||
expect(output.parts[0].text).toContain("<auto-slash-command>")
|
||||
expect(output.parts[0].text).toContain("Auto-Selected Plan")
|
||||
expect(output.parts[0].text).toContain("my-feature-plan")
|
||||
@@ -403,7 +402,10 @@ describe("createChatMessageHandler - TUI variant passthrough", () => {
|
||||
expect(getSessionModel("test-session")).toEqual({ providerID: "openai", modelID: "gpt-5.4" })
|
||||
})
|
||||
|
||||
test("treats prefixed list-display agent names as explicit model overrides", async () => {
|
||||
test("treats legacy ZWSP-prefixed agent names as explicit model overrides (GH-3259)", async () => {
|
||||
// Users upgrading from v3.14.0-v3.16.0 may still have ZWSP-prefixed agent
|
||||
// keys persisted in their session state. The handler must strip the
|
||||
// prefix and resolve to the canonical display name.
|
||||
//#given
|
||||
setMainSession("test-session")
|
||||
setSessionModel("test-session", { providerID: "openai", modelID: "gpt-5.4" })
|
||||
@@ -416,7 +418,7 @@ describe("createChatMessageHandler - TUI variant passthrough", () => {
|
||||
},
|
||||
})
|
||||
const handler = createChatMessageHandler(args)
|
||||
const input = createMockInput(getAgentListDisplayName("prometheus"))
|
||||
const input = createMockInput("\u200B\u200B\u200BPrometheus - Plan Builder")
|
||||
const output = createMockOutput()
|
||||
|
||||
//#when
|
||||
|
||||
@@ -123,10 +123,10 @@ describe("createChatParamsHandler", () => {
|
||||
setSessionPromptParams("ses_chat_params_temperature", {
|
||||
temperature: 0.4,
|
||||
topP: 0.7,
|
||||
maxOutputTokens: 4096,
|
||||
options: {
|
||||
reasoningEffort: "high",
|
||||
thinking: { type: "disabled" },
|
||||
maxTokens: 4096,
|
||||
},
|
||||
})
|
||||
|
||||
@@ -157,31 +157,29 @@ describe("createChatParamsHandler", () => {
|
||||
temperature: 0.4,
|
||||
topP: 0.7,
|
||||
topK: 1,
|
||||
maxOutputTokens: 4096,
|
||||
options: {
|
||||
existing: true,
|
||||
reasoningEffort: "high",
|
||||
thinking: { type: "disabled" },
|
||||
maxTokens: 4096,
|
||||
},
|
||||
})
|
||||
expect(getSessionPromptParams("ses_chat_params_temperature")).toEqual({
|
||||
temperature: 0.4,
|
||||
topP: 0.7,
|
||||
maxOutputTokens: 4096,
|
||||
options: {
|
||||
reasoningEffort: "high",
|
||||
thinking: { type: "disabled" },
|
||||
maxTokens: 4096,
|
||||
},
|
||||
})
|
||||
})
|
||||
|
||||
test("drops gpt-5.4 temperature and clamps maxTokens from bundled model capabilities", async () => {
|
||||
test("drops gpt-5.4 temperature and clamps maxOutputTokens from bundled model capabilities", async () => {
|
||||
//#given
|
||||
setSessionPromptParams("ses_chat_params_temperature", {
|
||||
temperature: 0.7,
|
||||
options: {
|
||||
maxTokens: 200_000,
|
||||
},
|
||||
maxOutputTokens: 200_000,
|
||||
})
|
||||
|
||||
const handler = createChatParamsHandler({
|
||||
@@ -210,9 +208,8 @@ describe("createChatParamsHandler", () => {
|
||||
expect(output).toEqual({
|
||||
topP: 1,
|
||||
topK: 1,
|
||||
options: {
|
||||
maxTokens: 128_000,
|
||||
},
|
||||
maxOutputTokens: 128_000,
|
||||
options: {},
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ export type ChatParamsOutput = {
|
||||
temperature?: number
|
||||
topP?: number
|
||||
topK?: number
|
||||
maxOutputTokens?: number
|
||||
options: Record<string, unknown>
|
||||
}
|
||||
|
||||
@@ -99,6 +100,9 @@ export function createChatParamsHandler(args: {
|
||||
if (storedPromptParams.topP !== undefined) {
|
||||
output.topP = storedPromptParams.topP
|
||||
}
|
||||
if (storedPromptParams.maxOutputTokens !== undefined) {
|
||||
(output as Record<string, unknown>).maxOutputTokens = storedPromptParams.maxOutputTokens
|
||||
}
|
||||
if (storedPromptParams.options) {
|
||||
output.options = {
|
||||
...output.options,
|
||||
@@ -124,7 +128,7 @@ export function createChatParamsHandler(args: {
|
||||
: undefined,
|
||||
temperature: typeof output.temperature === "number" ? output.temperature : undefined,
|
||||
topP: typeof output.topP === "number" ? output.topP : undefined,
|
||||
maxTokens: typeof output.options.maxTokens === "number" ? output.options.maxTokens : undefined,
|
||||
maxTokens: typeof output.maxOutputTokens === "number" ? output.maxOutputTokens : undefined,
|
||||
thinking: isRecord(output.options.thinking) ? output.options.thinking : undefined,
|
||||
},
|
||||
capabilities,
|
||||
@@ -163,9 +167,9 @@ export function createChatParamsHandler(args: {
|
||||
|
||||
if ("maxTokens" in compatibility) {
|
||||
if (compatibility.maxTokens !== undefined) {
|
||||
output.options.maxTokens = compatibility.maxTokens
|
||||
output.maxOutputTokens = compatibility.maxTokens
|
||||
} else {
|
||||
delete output.options.maxTokens
|
||||
delete output.maxOutputTokens
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user