Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions src/renderer/components/thread/ThreadDraftView.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -960,6 +960,48 @@ describe("ThreadDraftView", () => {
});
});

it("submits an explicit Fast-off selection in the launch config", async () => {
const onStart = vi.fn<(input: unknown) => void>();

render(
<ThreadDraftView
project={project}
agentStatuses={[cursorStatus]}
lastDraftConfig={{
agentKind: "cursor",
model: "composer-2",
effort: "",
fast: false,
mode: "agent",
approvalPolicy: "default",
sandboxMode: "",
worktreeMode: false,
}}
onStart={onStart}
/>,
);

await waitFor(() => {
const props = composerSpy.mock.lastCall?.[0] as {
controls: Array<{ kind?: string; currentModel?: string }>;
};
expect(
props.controls.some(
(control) => control.kind === "provider-model" && control.currentModel === "composer-2",
),
).toBe(true);
});

fireEvent.click(screen.getByText("set-prompt"));
fireEvent.click(screen.getByText("submit"));

expect(onStart).toHaveBeenCalledWith(
expect.objectContaining({
config: expect.objectContaining({ fast: false }),
}),
);
});

it("keeps a globally disabled built-in out of the composer and launch config", async () => {
const onStart = vi.fn<(input: unknown) => void>();
useSharedSettings.setState({
Expand Down
6 changes: 5 additions & 1 deletion src/renderer/components/thread/ThreadDraftView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import {
resolvePreferredAgentKind,
resolveProviderDraftConfig,
resolveSavedProviderDraftConfig,
supportsUsableFastMode,
resolveThinkingValue,
} from "./threadDraftViewHelpers";
import { friendlyError } from "@/shared/messages";
Expand Down Expand Up @@ -1075,7 +1076,10 @@ export function ThreadDraftView(props: {
model,
...(effort ? { effort } : {}),
...(contextSize ? { contextSize } : {}),
...(fast ? { fast } : {}),
...(selectedAgentForConfig &&
supportsUsableFastMode(selectedAgentForConfig.capabilities, model)
? { fast }
: {}),
...(thinking ? { thinking } : {}),
...(mode ? { mode } : {}),
...(approvalPolicy ? { approvalPolicy } : {}),
Expand Down