mirror of
https://github.com/getpaseo/paseo.git
synced 2026-12-03 05:36:08 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4c17e0961b |
@@ -3668,6 +3668,13 @@ describe("Codex app-server provider", () => {
|
||||
requires_openai_auth: false,
|
||||
wire_api: "responses",
|
||||
},
|
||||
"codex-iisb": {
|
||||
name: "Custom Codex",
|
||||
base_url: "https://custom-relay.example.com/v1",
|
||||
env_key: "OPENAI_API_KEY",
|
||||
requires_openai_auth: false,
|
||||
wire_api: "responses",
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
@@ -3684,6 +3691,9 @@ describe("Codex app-server provider", () => {
|
||||
"paseo:codex-custom": expect.objectContaining({
|
||||
base_url: "https://custom-relay.example.com/v1",
|
||||
}),
|
||||
"codex-custom": expect.objectContaining({
|
||||
base_url: "https://custom-relay.example.com/v1",
|
||||
}),
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
@@ -3775,6 +3775,10 @@ function buildCodexCustomProviderConfig(
|
||||
model_provider: providerKey,
|
||||
model_providers: {
|
||||
[providerKey]: providerConfig,
|
||||
// Codex resolves existing threads using the provider key saved on the thread.
|
||||
...(!CODEX_BUILTIN_MODEL_PROVIDER_IDS.has(customProvider.id)
|
||||
? { [customProvider.id]: providerConfig }
|
||||
: {}),
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -4600,11 +4604,6 @@ export class CodexAppServerAgentSession implements AgentSession {
|
||||
cwd: this.config.cwd ?? null,
|
||||
excludeTurns: true,
|
||||
};
|
||||
if (this.deps.customCodexConfig) {
|
||||
// Resume otherwise prefers the provider stored on the thread, including
|
||||
// the unnamespaced key emitted by earlier Paseo versions.
|
||||
params.modelProvider = this.deps.customCodexConfig.model_provider;
|
||||
}
|
||||
const developerInstructions = this.threadDeveloperInstructions();
|
||||
if (developerInstructions) {
|
||||
params.developerInstructions = developerInstructions;
|
||||
@@ -4617,6 +4616,25 @@ export class CodexAppServerAgentSession implements AgentSession {
|
||||
const loaded = toObjectRecord(await this.client.request("thread/loaded/list", {}));
|
||||
const ids = Array.isArray(loaded?.data) ? loaded.data : [];
|
||||
if (!ids.includes(this.currentThreadId)) {
|
||||
const customConfig = this.deps.customCodexConfig;
|
||||
if (customConfig && codexConfig) {
|
||||
const metadata = toObjectRecord(
|
||||
await this.client.request("thread/read", {
|
||||
threadId: this.currentThreadId,
|
||||
includeTurns: false,
|
||||
}),
|
||||
);
|
||||
const savedProvider = toObjectRecord(metadata?.thread)?.modelProvider;
|
||||
// Use the thread's provider when it belongs to this custom provider.
|
||||
// Keep the explicit selection for other threads so Codex can reject a mismatch.
|
||||
const provider =
|
||||
typeof savedProvider === "string" &&
|
||||
Object.hasOwn(customConfig.model_providers, savedProvider)
|
||||
? savedProvider
|
||||
: customConfig.model_provider;
|
||||
params.modelProvider = provider;
|
||||
codexConfig.model_provider = provider;
|
||||
}
|
||||
const response = await this.client.request("thread/resume", params);
|
||||
this.rememberResolvedSandboxPolicy(response);
|
||||
this.rememberRestoredCollaborationMode(response);
|
||||
@@ -8555,13 +8573,9 @@ export class CodexAppServerAgentClient implements AgentClient {
|
||||
// unless told otherwise, lists only the provider its own config selects.
|
||||
// Include legacy custom ids, but keep Codex built-in sessions separate.
|
||||
const customProviderConfig = this.customProviderConfig();
|
||||
let modelProviders: string[] | undefined;
|
||||
if (customProviderConfig && this.deps.customProvider) {
|
||||
modelProviders = [customProviderConfig.model_provider];
|
||||
if (!CODEX_BUILTIN_MODEL_PROVIDER_IDS.has(this.deps.customProvider.id)) {
|
||||
modelProviders.push(this.deps.customProvider.id);
|
||||
}
|
||||
}
|
||||
const modelProviders = customProviderConfig
|
||||
? Object.keys(customProviderConfig.model_providers)
|
||||
: undefined;
|
||||
const allThreads = await readCodexThreadWindow(client, this.logger, {
|
||||
limit: listLimit,
|
||||
cwd: options?.cwd,
|
||||
|
||||
Reference in New Issue
Block a user