Skip to content

Open-source, local-first AI agent for real work.

fix(session-assistance): 未指定专用模型时,自动标题和输入预测仍用最低思考档

bent26855fc2e1203070
diff --git a/apps/desktop/src/main/agent-runtime/runtime-host-capabilities.test.ts b/apps/desktop/src/main/agent-runtime/runtime-host-capabilities.test.ts
index d31b3cb9d..31734f5b0 100644
--- a/apps/desktop/src/main/agent-runtime/runtime-host-capabilities.test.ts
+++ b/apps/desktop/src/main/agent-runtime/runtime-host-capabilities.test.ts
@@ -36,7 +36,7 @@ describe("Desktop RuntimeHost capabilities", () => {
}
});
- it("applies updated assistance settings to an open Desktop session without altering its chat model", async () => {
+ it("applies updated assistance settings to an open Desktop session without following its chat reasoning", async () => {
const cwd = await temporaryDirectory("desktop-runtime-assistance-workspace-");
const sessionDir = await temporaryDirectory("desktop-runtime-assistance-sessions-");
const agentDir = await temporaryDirectory("desktop-runtime-assistance-agent-");
@@ -80,10 +80,10 @@ describe("Desktop RuntimeHost capabilities", () => {
runtime.invokeSessionExtension(sessionId, CODING_AGENT_NEXT_PROMPT_SUGGESTIONS, { conversation: "Proceed" }),
).resolves.toEqual(["Continue"]);
expect(calls).toEqual([
- [MODEL.id, "high"],
+ [MODEL.id, "minimal"],
[preferred.id, "medium"],
[MODEL.id, "high"],
- [MODEL.id, undefined],
+ [MODEL.id, "minimal"],
]);
});
diff --git a/apps/desktop/src/main/agent-teams/team-session-service.test.ts b/apps/desktop/src/main/agent-teams/team-session-service.test.ts
index c9804a0ce..1e593e4dc 100644
--- a/apps/desktop/src/main/agent-teams/team-session-service.test.ts
+++ b/apps/desktop/src/main/agent-teams/team-session-service.test.ts
@@ -600,15 +600,13 @@ describe("AgentTeamSessionService streaming contract", () => {
selectSessionModel: vi.fn(async (_id: string, modelKey: string) => {
titleModel = modelKey;
}),
- invokeSessionExtension: vi.fn(
- async (_id: string, _endpoint: unknown, request: { sessionReasoning?: string }) => {
- if (omitNextTitle) {
- omitNextTitle = false;
- return null;
- }
- return titleModel === "openai/gpt-test" ? `团队标题 ${request.sessionReasoning}` : null;
- },
- ),
+ invokeSessionExtension: vi.fn(async () => {
+ if (omitNextTitle) {
+ omitNextTitle = false;
+ return null;
+ }
+ return titleModel === "openai/gpt-test" ? "团队标题已生成" : null;
+ }),
subscribe: () => () => undefined,
prompt: vi.fn(async () => ({})),
getFullHistory: () => [],
@@ -628,15 +626,15 @@ describe("AgentTeamSessionService streaming contract", () => {
id: "project:workspace",
cwd: "C:/workspace",
});
- await service.updateModelSettings(created.id, { modelKey: "openai/gpt-test", reasoning: "medium" });
+ await service.updateModelSettings(created.id, { modelKey: "openai/gpt-test" });
await service.send(created.id, { requestId: "first-task", text: "制定发布计划", targetMemberIds: [] });
await vi.waitFor(async () => {
expect((await service.listSessions(team.id)).find((item) => item.id === created.id)?.title).toBe(
- "团队标题 medium",
+ "团队标题已生成",
);
});
const restored = await service.read(created.id);
- expect(restored.title).toBe("团队标题 medium");
+ expect(restored.title).toBe("团队标题已生成");
expect(runtime.selectSessionModel).toHaveBeenCalledWith(created.id, "openai/gpt-test", "if-changed");
const retrySession = await service.createRecord(team, document, {
@@ -644,7 +642,7 @@ describe("AgentTeamSessionService streaming contract", () => {
id: "project:workspace",
cwd: "C:/workspace",
});
- await service.updateModelSettings(retrySession.id, { modelKey: "openai/gpt-test", reasoning: "medium" });
+ await service.updateModelSettings(retrySession.id, { modelKey: "openai/gpt-test" });
omitNextTitle = true;
await service.send(retrySession.id, {
requestId: "retry-first-task",
@@ -656,15 +654,13 @@ describe("AgentTeamSessionService streaming contract", () => {
requestId: "retry-second-task",
text: "继续执行",
targetMemberIds: [],
- reasoning: "off",
});
await vi.waitFor(async () => {
- expect((await service.read(retrySession.id)).title).toBe("团队标题 off");
+ expect((await service.read(retrySession.id)).title).toBe("团队标题已生成");
});
expect(runtime.invokeSessionExtension).toHaveBeenLastCalledWith(retrySession.id, expect.anything(), {
userText: "检查账户权限",
assistantText: "",
- sessionReasoning: "off",
});
});
diff --git a/apps/desktop/src/main/agent-teams/team-session-service.ts b/apps/desktop/src/main/agent-teams/team-session-service.ts
index f8d813e38..62447a79f 100644
--- a/apps/desktop/src/main/agent-teams/team-session-service.ts
+++ b/apps/desktop/src/main/agent-teams/team-session-service.ts
@@ -997,12 +997,10 @@ export class AgentTeamSessionService {
this.autoTitleScheduledSessions.add(session.id);
void (async () => {
const modelKey = input.modelKey ?? session.modelSettings?.modelKey;
- let sessionReasoning = input.reasoning ?? session.modelSettings?.reasoning;
if (modelKey) {
try {
await runtime.selectSessionModel(coordination.sessionId, modelKey, "if-changed");
} catch (error) {
- sessionReasoning = undefined;
log.warn("Agent Team auto-title model selection failed", {
teamSessionId: session.id,
error: errorMessage(error),
@@ -1012,7 +1010,6 @@ export class AgentTeamSessionService {
return runtime.invokeSessionExtension(coordination.sessionId, CODING_AGENT_SESSION_TITLE_GENERATE, {
userText: text,
assistantText: "",
- sessionReasoning,
});
})()
.then(async (title) => {
diff --git a/apps/docs-site/content/docs/en/product/settings.mdx b/apps/docs-site/content/docs/en/product/settings.mdx
index 0ae8d9f9a..0b9e6f6ef 100644
--- a/apps/docs-site/content/docs/en/product/settings.mdx
+++ b/apps/docs-site/content/docs/en/product/settings.mdx
@@ -37,7 +37,7 @@ A few settings that are easy to miss:
- **Open links in** (General → Basics): whether links in conversations open in the **Vetta browser** or the **System browser**. Right-click a link or ⌘/Ctrl-click it to use the other option.
- **Notifications** (General): system banners and sounds when a task completes, fails, or needs action, each shown only in background, when away from the session, or always. Security alerts such as phone connections are not affected.
- **Input prediction** (Agent → Personalization): predicts your next message after each reply and shows it faintly in the empty input. Press Tab to fill it in.
-- **Models for automatic titles and input prediction** (Agent → Personalization): both use the conversation's model and thinking level by default. You can choose a separate model and level for each. Changes apply to the next generation; choose **Follow conversation** to clear an override. If the selected model is unavailable, Vetta tries the conversation model or another available model. Turning off input prediction keeps its model preference.
+- **Models for automatic titles and input prediction** (Agent → Personalization): both use the conversation's model at its lowest thinking level by default, to stay fast and cheap. You can choose a separate model and level for each. Changes apply to the next generation; choose **Follow conversation** to clear an override. If the selected model is unavailable, Vetta tries the conversation model or another available model. Turning off input prediction keeps its model preference.
- Archived lists projects only. Deleting removes a project from the archive list and does not delete its files on disk.
## Platform and build differences
diff --git a/apps/docs-site/content/docs/product/settings.mdx b/apps/docs-site/content/docs/product/settings.mdx
index 3e33ae0e2..bbe62bc76 100644
--- a/apps/docs-site/content/docs/product/settings.mdx
+++ b/apps/docs-site/content/docs/product/settings.mdx
@@ -37,7 +37,7 @@ MCP 不在设置里。发现、安装和管理在侧栏 **能力 → 连接器**
- **链接打开方式**(通用设置 → 基础):对话里的链接默认在 **Vetta 内置浏览器** 还是 **系统默认浏览器** 打开;右键链接或按住 ⌘/Ctrl 点击可改用另一种。
- **通知**(通用设置):任务完成、任务失败、等待处理时的系统通知与提示音,时机可选仅应用在后台、离开当前会话时或始终。手机连接等安全通知不受影响。
- **输入预测**(Agent配置 → 个性化):每轮回答后预测你的下一句,以淡色显示在空输入框里,按 Tab 填入。
-- **自动标题和输入预测的模型**(Agent配置 → 个性化):两项默认跟随对应会话的模型和思考强度,也可以各自指定模型和档位。设置保存后的下一次生成生效;选回「跟随会话」可清除覆盖。指定模型不可用时会尝试会话模型或其他可用模型。关闭输入预测不会清除它的模型偏好。
+- **自动标题和输入预测的模型**(Agent配置 → 个性化):两项默认用对应会话的模型、以最低思考强度生成,保证又快又省;也可以各自指定模型和档位。设置保存后的下一次生成生效;选回「跟随会话」可清除覆盖。指定模型不可用时会尝试会话模型或其他可用模型。关闭输入预测不会清除它的模型偏好。
- 已归档只列项目。删除只是从归档列表移除,不会删除磁盘上的文件。
## 平台和构建差异
diff --git a/packages/coding-agent/src/composition/contracts/runtime-composition-options.ts b/packages/coding-agent/src/composition/contracts/runtime-composition-options.ts
index 5213fac76..3c0c9b850 100644
--- a/packages/coding-agent/src/composition/contracts/runtime-composition-options.ts
+++ b/packages/coding-agent/src/composition/contracts/runtime-composition-options.ts
@@ -210,7 +210,7 @@ export interface CodingAgentRuntimeContextOptions {
readonly createTodoRuntime?: (sessionOptions: CodingAgentRuntimeSessionOptions) => CodingAgentTodoRuntime;
/** 运行中读取压缩设置;未提供时使用 Coding Agent 既有默认值。 */
readonly resolveCompactionSettings?: CodingAgentCompactionRuntimeOptions["resolveSettings"];
- /** 提供此读取器的宿主,未指定专用模型时让辅助任务跟随会话档位。 */
+ /** 读取自动标题、输入预测的专用模型与档位;未提供或未指定时用会话模型的最低档。 */
readonly readSessionAssistancePreference?: CodingAgentSessionAssistancePreferenceReader;
/** 为每个 Session 创建 Extension 压缩事件的窄适配器。 */
readonly createCompactionExtensionRuntime?: (
diff --git a/packages/coding-agent/src/composition/session-initialization/context-assembly.ts b/packages/coding-agent/src/composition/session-initialization/context-assembly.ts
index b8f85b18d..b5bfc9aa5 100644
--- a/packages/coding-agent/src/composition/session-initialization/context-assembly.ts
+++ b/packages/coding-agent/src/composition/session-initialization/context-assembly.ts
@@ -78,9 +78,6 @@ export function createCodingAgentSessionContextAssembly(
models: modelRuntime,
readSessionId: options.readSessionId,
readPreference: profile.readSessionAssistancePreference,
- readSessionReasoning: profile.readSessionAssistancePreference
- ? () => modelRuntime.readThinkingLevel()
- : undefined,
streamFn: profile.streamFn,
observationPublisher: options.observationPublisher,
}),
diff --git a/packages/coding-agent/src/features/session-assistance/session-assistance-contract.ts b/packages/coding-agent/src/features/session-assistance/session-assistance-contract.ts
index e4c061bcf..8343dc43c 100644
--- a/packages/coding-agent/src/features/session-assistance/session-assistance-contract.ts
+++ b/packages/coding-agent/src/features/session-assistance/session-assistance-contract.ts
@@ -16,8 +16,6 @@ export type CodingAgentSessionAssistancePreferenceReader = (
export interface CodingAgentSessionTitleRequest {
readonly userText: string;
readonly assistantText: string;
- /** 协调会话不执行 Team 的用户轮次,由 Team 提供有效的会话档位。 */
- readonly sessionReasoning?: string;
}
export const CODING_AGENT_SESSION_TITLE_GENERATE = defineSessionExtensionEndpoint<
diff --git a/packages/coding-agent/src/features/session-assistance/session-assistance-runtime.ts b/packages/coding-agent/src/features/session-assistance/session-assistance-runtime.ts
index 5414d0d6f..5fe3072a8 100644
--- a/packages/coding-agent/src/features/session-assistance/session-assistance-runtime.ts
+++ b/packages/coding-agent/src/features/session-assistance/session-assistance-runtime.ts
@@ -27,7 +27,6 @@ const modelCooldownUntil = new Map<string, number>();
export interface CodingAgentSessionAssistanceRuntimeOptions {
readonly models: RuntimeSessionModelView;
readonly readSessionId: () => string;
- readonly readSessionReasoning?: () => string;
readonly readPreference?: CodingAgentSessionAssistancePreferenceReader;
readonly streamFn?: StreamFn;
readonly observationPublisher?: RuntimeObservationPublisher;
@@ -49,7 +48,7 @@ export class CodingAgentSessionAssistanceRuntime {
this.now = options.now ?? Date.now;
}
- async generateTitle(userText: string, assistantText: string, sessionReasoning?: string): Promise<string | null> {
+ async generateTitle(userText: string, assistantText: string): Promise<string | null> {
const trimmedUser = userText.trim().slice(0, 800);
const trimmedAssistant = assistantText.trim().slice(0, 1500);
const promptText =
@@ -61,34 +60,30 @@ export class CodingAgentSessionAssistanceRuntime {
`<user_message>\n${trimmedUser}\n</user_message>\n\n` +
`<assistant_reply>\n${trimmedAssistant}\n</assistant_reply>`;
- return this.runWithFailover(
- "title.generate",
- async ({ model, apiKey, reasoning }) => {
- const stream = await (this.options.streamFn ?? streamSimple)(
- model,
- {
- systemPrompt:
- "You are a session title generator. Output exactly one short title and nothing else, in the same language as the user's message.",
- messages: [
- {
- role: "user" as const,
- content: [{ type: "text" as const, text: promptText }],
- timestamp: this.now(),
- },
- ],
- },
- { apiKey, maxTokens: 256, reasoning, sessionId: this.options.readSessionId() },
- );
- const response = await stream.result();
- if (response.stopReason === "error") {
- throw toModelFailure(normalizeAssistantMessageError(response, model));
- }
- const rawText = readText(response.content);
- const rawThinking = readThinking(response.content);
- return sanitizeAutoTitle(rawText || rawThinking) || null;
- },
- sessionReasoning,
- );
+ return this.runWithFailover("title.generate", async ({ model, apiKey, reasoning }) => {
+ const stream = await (this.options.streamFn ?? streamSimple)(
+ model,
+ {
+ systemPrompt:
+ "You are a session title generator. Output exactly one short title and nothing else, in the same language as the user's message.",
+ messages: [
+ {
+ role: "user" as const,
+ content: [{ type: "text" as const, text: promptText }],
+ timestamp: this.now(),
+ },
+ ],
+ },
+ { apiKey, maxTokens: 256, reasoning, sessionId: this.options.readSessionId() },
+ );
+ const response = await stream.result();
+ if (response.stopReason === "error") {
+ throw toModelFailure(normalizeAssistantMessageError(response, model));
+ }
+ const rawText = readText(response.content);
+ const rawThinking = readThinking(response.content);
+ return sanitizeAutoTitle(rawText || rawThinking) || null;
+ });
}
async generateNextPrompts(conversation: string): Promise<readonly string[]> {
@@ -141,18 +136,13 @@ export class CodingAgentSessionAssistanceRuntime {
private async runWithFailover<T>(
operation: CodingAgentSessionAssistanceOperation,
run: (candidate: CodingAgentSessionAssistanceCandidate) => Promise<T | null>,
- sessionReasoningOverride?: string,
): Promise<T | null> {
this.options.observationPublisher?.record(CODING_AGENT_SESSION_ASSISTANCE_OBSERVATION, {
operation,
phase: "started",
});
const preference = this.options.readPreference ? await this.options.readPreference(operation) : undefined;
- const sessionReasoning = sessionReasoningOverride ?? this.options.readSessionReasoning?.();
- const candidates = await resolveSessionAssistanceCandidates(this.options.models, this.now, {
- preference,
- sessionReasoning,
- });
+ const candidates = await resolveSessionAssistanceCandidates(this.options.models, this.now, preference);
for (const [index, candidate] of candidates.entries()) {
const startedAt = this.now();
try {
@@ -204,10 +194,7 @@ export class CodingAgentSessionAssistanceRuntime {
export async function resolveSessionAssistanceCandidates(
source: RuntimeSessionModelView,
now: () => number = Date.now,
- selection?: {
- readonly preference?: CodingAgentSessionAssistancePreference;
- readonly sessionReasoning?: string;
- },
+ preference?: CodingAgentSessionAssistancePreference,
): Promise<readonly CodingAgentSessionAssistanceCandidate[]> {
source.refreshAvailableModels();
const candidates: CodingAgentSessionAssistanceCandidate[] = [];
@@ -224,13 +211,12 @@ export async function resolveSessionAssistanceCandidates(
};
const currentModel = source.readCurrentModel();
const availableModels = source.readAvailableModels();
- const preference = selection?.preference;
if (preference) {
const preferred = availableModels.find((model) => `${model.provider}/${model.id}` === preference.modelKey);
if (preferred) await add(preferred, resolvePreferredReasoning(preferred, preference.reasoning));
}
- const sessionReasoning = selection?.sessionReasoning;
- await add(currentModel, sessionReasoning !== undefined && !currentModel?.reasoning ? "off" : sessionReasoning);
+ // 未指定专用模型时仍用最低档:标题和预测要快、要省,不随会话的思考强度升档。
+ await add(currentModel);
for (const model of availableModels) {
await add(model);
if (candidates.length >= MAX_CANDIDATES) break;
diff --git a/packages/coding-agent/src/features/session-assistance/session-assistance-session-extension.ts b/packages/coding-agent/src/features/session-assistance/session-assistance-session-extension.ts
index f85152f39..2e54af837 100644
--- a/packages/coding-agent/src/features/session-assistance/session-assistance-session-extension.ts
+++ b/packages/coding-agent/src/features/session-assistance/session-assistance-session-extension.ts
@@ -35,8 +35,8 @@ export function createCodingAgentSessionAssistanceExtension(): SessionExtensionD
{
kind: "endpoint",
token: CODING_AGENT_SESSION_TITLE_GENERATE,
- handle: ({ userText, assistantText, sessionReasoning }) =>
- requireRuntime(runtime).generateTitle(userText, assistantText, sessionReasoning),
+ handle: ({ userText, assistantText }) =>
+ requireRuntime(runtime).generateTitle(userText, assistantText),
},
{
kind: "endpoint",
diff --git a/packages/coding-agent/test/session-assistance-runtime.test.ts b/packages/coding-agent/test/session-assistance-runtime.test.ts
index e6879517c..7e32b6247 100644
--- a/packages/coding-agent/test/session-assistance-runtime.test.ts
+++ b/packages/coding-agent/test/session-assistance-runtime.test.ts
@@ -21,7 +21,7 @@ function createModel(provider: string, id: string): Model<Api> {
}
describe("CodingAgentSessionAssistanceRuntime", () => {
- it("uses the injected model-call port and current conversation identity for session assistance", async () => {
+ it("uses the injected model-call port, current conversation identity and the lowest reasoning level", async () => {
const model = createModel("session-assistance-identity", "current");
const view = createView(model, [model], async () => "test-key");
const responses: AssistantMessage[] = [
@@ -43,21 +43,18 @@ describe("CodingAgentSessionAssistanceRuntime", () => {
];
const streamFn = vi.fn<StreamFn>(() => completedStream(responses.shift()));
let sessionId = "conversation-42";
- let sessionReasoning = "high";
const runtime = new CodingAgentSessionAssistanceRuntime({
models: view,
readSessionId: () => sessionId,
- readSessionReasoning: () => sessionReasoning,
streamFn,
});
await expect(runtime.generateTitle("你好", "")).resolves.toBe("会话标题");
sessionId = "conversation-43";
- sessionReasoning = "off";
await expect(runtime.generateNextPrompts("用户:你好")).resolves.toEqual(["继续"]);
expect(streamFn).toHaveBeenCalledTimes(2);
- expect(streamFn.mock.calls[0]?.[2]).toMatchObject({ sessionId: "conversation-42", reasoning: "high" });
- expect(streamFn.mock.calls[1]?.[2]).toMatchObject({ sessionId: "conversation-43", reasoning: undefined });
+ expect(streamFn.mock.calls[0]?.[2]).toMatchObject({ sessionId: "conversation-42", reasoning: "minimal" });
+ expect(streamFn.mock.calls[1]?.[2]).toMatchObject({ sessionId: "conversation-43", reasoning: "minimal" });
});
it("applies saved preferences per task without changing the session, and falls back without carrying over reasoning", async () => {
@@ -79,7 +76,6 @@ describe("CodingAgentSessionAssistanceRuntime", () => {
const runtime = new CodingAgentSessionAssistanceRuntime({
models: view,
readSessionId: () => "conversation",
- readSessionReasoning: () => "low",
readPreference: async (task) =>
task === "title.generate" ? titlePreference : { modelKey: `${provider}/predict`, reasoning: "invalid" },
streamFn: (model, context, options) => {
@@ -103,8 +99,8 @@ describe("CodingAgentSessionAssistanceRuntime", () => {
["title", "high"],
["predict", "medium"],
["title", "high"],
- ["chat", "low"],
- ["chat", "low"],
+ ["chat", "minimal"],
+ ["chat", "minimal"],
]);
});