fix(cli): keep /model and /reasoning conversation-scoped (#1178)
This commit is contained in:
@@ -41,6 +41,54 @@ describe("model preset refresh wiring", () => {
|
||||
);
|
||||
});
|
||||
|
||||
test("modify.ts exposes conversation-scoped model updater", () => {
|
||||
const path = fileURLToPath(
|
||||
new URL("../../agent/modify.ts", import.meta.url),
|
||||
);
|
||||
const source = readFileSync(path, "utf-8");
|
||||
|
||||
const start = source.indexOf(
|
||||
"export async function updateConversationLLMConfig(",
|
||||
);
|
||||
const end = source.indexOf(
|
||||
"export interface SystemPromptUpdateResult",
|
||||
start,
|
||||
);
|
||||
expect(start).toBeGreaterThanOrEqual(0);
|
||||
expect(end).toBeGreaterThan(start);
|
||||
const updateSegment = source.slice(start, end);
|
||||
|
||||
expect(updateSegment).toContain(
|
||||
"buildModelSettings(modelHandle, updateArgs)",
|
||||
);
|
||||
expect(updateSegment).toContain(
|
||||
"Parameters<typeof client.conversations.update>[1]",
|
||||
);
|
||||
expect(updateSegment).toContain(
|
||||
"client.conversations.update(conversationId, payload)",
|
||||
);
|
||||
expect(updateSegment).toContain("model: modelHandle");
|
||||
expect(updateSegment).not.toContain("client.agents.update(");
|
||||
});
|
||||
|
||||
test("/model handler updates conversation model (not agent model)", () => {
|
||||
const path = fileURLToPath(new URL("../../cli/App.tsx", import.meta.url));
|
||||
const source = readFileSync(path, "utf-8");
|
||||
|
||||
const start = source.indexOf("const handleModelSelect = useCallback(");
|
||||
const end = source.indexOf(
|
||||
"const handleSystemPromptSelect = useCallback(",
|
||||
start,
|
||||
);
|
||||
expect(start).toBeGreaterThanOrEqual(0);
|
||||
expect(end).toBeGreaterThan(start);
|
||||
const segment = source.slice(start, end);
|
||||
|
||||
expect(segment).toContain("updateConversationLLMConfig(");
|
||||
expect(segment).toContain("conversationIdRef.current");
|
||||
expect(segment).not.toContain("updateAgentLLMConfig(");
|
||||
});
|
||||
|
||||
test("interactive resume flow refreshes model preset without explicit --model", () => {
|
||||
const path = fileURLToPath(new URL("../../index.ts", import.meta.url));
|
||||
const source = readFileSync(path, "utf-8");
|
||||
|
||||
@@ -46,6 +46,28 @@ describe("reasoning tier cycle wiring", () => {
|
||||
expect(callbackBlocks.length).toBeGreaterThanOrEqual(2);
|
||||
});
|
||||
|
||||
test("flush uses conversation-scoped reasoning updates", () => {
|
||||
const appPath = fileURLToPath(
|
||||
new URL("../../cli/App.tsx", import.meta.url),
|
||||
);
|
||||
const source = readFileSync(appPath, "utf-8");
|
||||
|
||||
const start = source.indexOf(
|
||||
"const flushPendingReasoningEffort = useCallback(",
|
||||
);
|
||||
const end = source.indexOf(
|
||||
"const handleCycleReasoningEffort = useCallback(",
|
||||
start,
|
||||
);
|
||||
expect(start).toBeGreaterThanOrEqual(0);
|
||||
expect(end).toBeGreaterThan(start);
|
||||
|
||||
const segment = source.slice(start, end);
|
||||
expect(segment).toContain("updateConversationLLMConfig(");
|
||||
expect(segment).toContain("conversationIdRef.current");
|
||||
expect(segment).not.toContain("updateAgentLLMConfig(");
|
||||
});
|
||||
|
||||
test("tab-based reasoning cycling is opt-in only", () => {
|
||||
const appPath = fileURLToPath(
|
||||
new URL("../../cli/App.tsx", import.meta.url),
|
||||
|
||||
Reference in New Issue
Block a user