Skip to content

Commit 5e99c28

Browse files
fix: explicitly pass model provider on session resume (#139)
1 parent c352108 commit 5e99c28

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/CodexAcpClient.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ export class CodexAcpClient {
210210
cwd: request.cwd,
211211
developerInstructions: null,
212212
model: null,
213-
modelProvider: this.getModelProvider(),
213+
modelProvider: this.getResumeModelProvider(),
214214
personality: null,
215215
threadId: request.sessionId,
216216
});
@@ -232,7 +232,7 @@ export class CodexAcpClient {
232232
cwd: request.cwd,
233233
developerInstructions: null,
234234
model: null,
235-
modelProvider: this.getModelProvider(),
235+
modelProvider: this.getResumeModelProvider(),
236236
personality: null,
237237
threadId: request.sessionId,
238238
});
@@ -304,6 +304,12 @@ export class CodexAcpClient {
304304
return this.gatewayConfig?.modelProvider ?? this.modelProvider;
305305
}
306306

307+
private getResumeModelProvider(): string {
308+
// Passing `null` forces codex to use the persisted provider for resumed session instead of default one
309+
// Explicit fallback to "openai" fixes error `Model provider not found` at least for ChatGPT authentication
310+
return this.getModelProvider() ?? "openai";
311+
}
312+
307313
private async refreshSkills(cwd: string, meta?: Record<string, unknown> | null): Promise<void> {
308314
if (!cwd) {
309315
return;

0 commit comments

Comments
 (0)