mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-20 11:54:46 +00:00
Summary: - Limit canonical OpenAI Codex app-server attribution rewrites to local transcript and trajectory records. - Keep runtime/tool routing on the selected OpenAI model metadata, including OpenAI API-key backup profiles. - Fix the current gateway-readiness lint blocker that was red on main. Verification: - codex-review branch helper clean with focused Codex app-server tests. - pnpm lint --threads=8 - pnpm test src/commands/gateway-readiness.test.ts - GitHub CI run 25960997256 green. Co-authored-by: Eva (agent) <eva+agent-78055@100yen.org>
40 lines
1.2 KiB
TypeScript
40 lines
1.2 KiB
TypeScript
import type { EmbeddedRunAttemptParams } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
|
|
const OPENAI_PROVIDER_ID = "openai";
|
|
const OPENAI_RESPONSES_API = "openai-responses";
|
|
const OPENAI_CODEX_PROVIDER_ID = "openai-codex";
|
|
const OPENAI_CODEX_RESPONSES_API = "openai-codex-responses";
|
|
|
|
export type CodexLocalRuntimeAttribution = {
|
|
provider: string;
|
|
api?: string;
|
|
};
|
|
|
|
function normalizeRuntimeId(value: string | undefined): string {
|
|
return value?.trim().toLowerCase() ?? "";
|
|
}
|
|
|
|
export function resolveCodexLocalRuntimeAttribution(
|
|
params: EmbeddedRunAttemptParams,
|
|
): CodexLocalRuntimeAttribution {
|
|
const authProfileProvider = normalizeRuntimeId(
|
|
params.runtimePlan?.auth?.authProfileProviderForAuth,
|
|
);
|
|
if (
|
|
normalizeRuntimeId(params.runtimePlan?.observability.harnessId) === "codex" &&
|
|
authProfileProvider !== OPENAI_PROVIDER_ID &&
|
|
normalizeRuntimeId(params.model.provider) === OPENAI_PROVIDER_ID &&
|
|
normalizeRuntimeId(params.model.api) === OPENAI_RESPONSES_API
|
|
) {
|
|
return {
|
|
provider: OPENAI_CODEX_PROVIDER_ID,
|
|
api: OPENAI_CODEX_RESPONSES_API,
|
|
};
|
|
}
|
|
|
|
return {
|
|
provider: params.provider,
|
|
api: params.model.api,
|
|
};
|
|
}
|