fix(chat-params): complete maxOutputTokens migration in session prompt params

This commit is contained in:
YeonGyu-Kim
2026-04-08 17:14:17 +09:00
parent 06b825dd74
commit ed16dc0608
8 changed files with 9 additions and 9 deletions
@@ -1863,10 +1863,10 @@ describe("BackgroundManager.resume model persistence", () => {
expect(getSessionPromptParams("session-advanced")).toEqual({ expect(getSessionPromptParams("session-advanced")).toEqual({
temperature: 0.25, temperature: 0.25,
topP: 0.55, topP: 0.55,
maxOutputTokens: 8192,
options: { options: {
reasoningEffort: "high", reasoningEffort: "high",
thinking: { type: "disabled" }, thinking: { type: "disabled" },
maxTokens: 8192,
}, },
}) })
}) })
@@ -400,10 +400,10 @@ describe("background-agent spawner fallback model promotion", () => {
expect(getSessionPromptParams("session-123")).toEqual({ expect(getSessionPromptParams("session-123")).toEqual({
temperature: 0.4, temperature: 0.4,
topP: 0.7, topP: 0.7,
maxOutputTokens: 4096,
options: { options: {
reasoningEffort: "high", reasoningEffort: "high",
thinking: { type: "disabled" }, thinking: { type: "disabled" },
maxTokens: 4096,
}, },
}) })
}) })
+1 -1
View File
@@ -20,12 +20,12 @@ export function applySessionPromptParams(
const promptOptions: Record<string, unknown> = { const promptOptions: Record<string, unknown> = {
...(model.reasoningEffort ? { reasoningEffort: model.reasoningEffort } : {}), ...(model.reasoningEffort ? { reasoningEffort: model.reasoningEffort } : {}),
...(model.thinking ? { thinking: model.thinking } : {}), ...(model.thinking ? { thinking: model.thinking } : {}),
...(model.maxTokens !== undefined ? { maxTokens: model.maxTokens } : {}),
} }
setSessionPromptParams(sessionID, { setSessionPromptParams(sessionID, {
...(model.temperature !== undefined ? { temperature: model.temperature } : {}), ...(model.temperature !== undefined ? { temperature: model.temperature } : {}),
...(model.top_p !== undefined ? { topP: model.top_p } : {}), ...(model.top_p !== undefined ? { topP: model.top_p } : {}),
...(model.maxTokens !== undefined ? { maxOutputTokens: model.maxTokens } : {}),
...(Object.keys(promptOptions).length > 0 ? { options: promptOptions } : {}), ...(Object.keys(promptOptions).length > 0 ? { options: promptOptions } : {}),
}) })
} }
@@ -18,9 +18,9 @@ describe("session-prompt-params-state", () => {
const params = { const params = {
temperature: 0.4, temperature: 0.4,
topP: 0.7, topP: 0.7,
maxOutputTokens: 4096,
options: { options: {
reasoningEffort: "high", reasoningEffort: "high",
maxTokens: 4096,
}, },
} }
@@ -190,10 +190,10 @@ describe("executeSync", () => {
expect(promptInput?.body.temperature).toBe(0.12) expect(promptInput?.body.temperature).toBe(0.12)
expect(promptInput?.body.topP).toBe(0.34) expect(promptInput?.body.topP).toBe(0.34)
expect(promptInput?.body.options).toEqual({ expect(promptInput?.body.options).toEqual({
maxTokens: 5678,
reasoningEffort: "medium", reasoningEffort: "medium",
thinking: { type: "disabled" }, thinking: { type: "disabled" },
}) })
expect(promptInput?.body.maxOutputTokens).toBe(5678)
}) })
test("records metadata with description and created session id", async () => { test("records metadata with description and created session id", async () => {
+1 -1
View File
@@ -43,12 +43,12 @@ function buildPromptGenerationParams(model: DelegatedModelConfig | undefined): R
const promptOptions: Record<string, unknown> = { const promptOptions: Record<string, unknown> = {
...(model.reasoningEffort ? { reasoningEffort: model.reasoningEffort } : {}), ...(model.reasoningEffort ? { reasoningEffort: model.reasoningEffort } : {}),
...(model.thinking ? { thinking: model.thinking } : {}), ...(model.thinking ? { thinking: model.thinking } : {}),
...(model.maxTokens !== undefined ? { maxTokens: model.maxTokens } : {}),
} }
return { return {
...(model.temperature !== undefined ? { temperature: model.temperature } : {}), ...(model.temperature !== undefined ? { temperature: model.temperature } : {}),
...(model.top_p !== undefined ? { topP: model.top_p } : {}), ...(model.top_p !== undefined ? { topP: model.top_p } : {}),
...(model.maxTokens !== undefined ? { maxOutputTokens: model.maxTokens } : {}),
...(Object.keys(promptOptions).length > 0 ? { options: promptOptions } : {}), ...(Object.keys(promptOptions).length > 0 ? { options: promptOptions } : {}),
} }
} }
@@ -277,15 +277,15 @@ bunDescribe("sendSyncPrompt", () => {
bunExpect(promptArgs.body.options).toEqual({ bunExpect(promptArgs.body.options).toEqual({
reasoningEffort: "high", reasoningEffort: "high",
thinking: { type: "disabled" }, thinking: { type: "disabled" },
maxTokens: 4096,
}) })
bunExpect(promptArgs.body.maxOutputTokens).toBe(4096)
bunExpect(getSessionPromptParams("test-session")).toEqual({ bunExpect(getSessionPromptParams("test-session")).toEqual({
temperature: 0.4, temperature: 0.4,
topP: 0.7, topP: 0.7,
maxOutputTokens: 4096,
options: { options: {
reasoningEffort: "high", reasoningEffort: "high",
thinking: { type: "disabled" }, thinking: { type: "disabled" },
maxTokens: 4096,
}, },
}) })
}) })
@@ -30,12 +30,12 @@ function buildPromptGenerationParams(model: DelegatedModelConfig | undefined): R
const promptOptions: Record<string, unknown> = { const promptOptions: Record<string, unknown> = {
...(model.reasoningEffort ? { reasoningEffort: model.reasoningEffort } : {}), ...(model.reasoningEffort ? { reasoningEffort: model.reasoningEffort } : {}),
...(model.thinking ? { thinking: model.thinking } : {}), ...(model.thinking ? { thinking: model.thinking } : {}),
...(model.maxTokens !== undefined ? { maxTokens: model.maxTokens } : {}),
} }
return { return {
...(model.temperature !== undefined ? { temperature: model.temperature } : {}), ...(model.temperature !== undefined ? { temperature: model.temperature } : {}),
...(model.top_p !== undefined ? { topP: model.top_p } : {}), ...(model.top_p !== undefined ? { topP: model.top_p } : {}),
...(model.maxTokens !== undefined ? { maxOutputTokens: model.maxTokens } : {}),
...(Object.keys(promptOptions).length > 0 ? { options: promptOptions } : {}), ...(Object.keys(promptOptions).length > 0 ? { options: promptOptions } : {}),
} }
} }