fix: fall back to target provider's default model on provider switch
When switching providers (e.g., Codex -> Claude) without explicitly specifying a model, the thread's existing model slug (a Codex slug like 'gpt-5-codex') was passed to the new provider's adapter. The Claude SDK does not understand Codex model names, causing failures. Now, when a provider is explicitly requested and differs from the current provider, the code falls back to DEFAULT_MODEL_BY_PROVIDER for the target provider instead of carrying over the thread's existing model. Co-authored-by: Julius Marminge <[email protected]>
This commit is contained in:
1 parent
b403ca3183
commit
5b9f3fb2e9
2 files changed
+7
-2
No files matched your search
@@ -416,7 +416,7 @@ describe("ProviderCommandReactor", () => {
|
||||
expect(harness.startSession.mock.calls[0]?.[1]).toMatchObject({
|
||||
provider: "claudeAgent",
|
||||
cwd: "/tmp/provider-project",
|
||||
model: "gpt-5-codex",
|
||||
model: "claude-sonnet-4-6",
|
||||
runtimeMode: "approval-required",
|
||||
});
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import {
|
||||
type ChatAttachment,
|
||||
CommandId,
|
||||
DEFAULT_MODEL_BY_PROVIDER,
|
||||
EventId,
|
||||
type OrchestrationEvent,
|
||||
type ProviderModelOptions,
|
||||
@@ -211,7 +212,11 @@ const make = Effect.gen(function* () {
|
||||
? thread.session.providerName
|
||||
: undefined;
|
||||
const preferredProvider: ProviderKind | undefined = options?.provider ?? currentProvider;
|
||||
const desiredModel = options?.model ?? thread.model;
|
||||
const providerIsChanging =
|
||||
options?.provider !== undefined && options.provider !== currentProvider;
|
||||
const desiredModel =
|
||||
options?.model ??
|
||||
(providerIsChanging ? DEFAULT_MODEL_BY_PROVIDER[options.provider!] : thread.model);
|
||||
const effectiveCwd = resolveThreadWorkspaceCwd({
|
||||
thread,
|
||||
projects: readModel.projects,
|
||||
|
||||
Reference in new issue
Block a user