refactor(agents): drop unused session runtime override helper

This commit is contained in:
Vincent Koc
2026-06-17 09:18:35 +08:00
parent a7ebcfded3
commit 4df8237a01

View File

@@ -3,11 +3,9 @@
*
* Resolves persisted runtime overrides without leaking provider-specific CLI runtime bindings across model routes.
*/
import { normalizeLowercaseStringOrEmpty } from "@openclaw/normalization-core/string-coerce";
import type { SessionEntry } from "../config/sessions.js";
import { isDefaultAgentRuntimeId } from "./agent-runtime-id.js";
import { normalizeOptionalAgentRuntimeId } from "./agent-runtime-id.js";
import { resolveCliRuntimeModelBackendBinding } from "./cli-backends.js";
/** Persisted runtime fields used to recover session runtime compatibility. */
type SessionRuntimeCompatEntry = Pick<
@@ -25,24 +23,3 @@ export function resolvePersistedSessionRuntimeId(
}
return normalizeOptionalAgentRuntimeId(entry?.agentHarnessId);
}
/** Resolves whether a session runtime override applies to the selected provider. */
export function resolveSessionRuntimeOverrideForProvider(params: {
provider: string;
entry?: Pick<SessionEntry, "agentRuntimeOverride">;
}): string | undefined {
const provider = normalizeLowercaseStringOrEmpty(params.provider);
const runtime = normalizeOptionalAgentRuntimeId(params.entry?.agentRuntimeOverride);
if (!runtime || isDefaultAgentRuntimeId(runtime)) {
return undefined;
}
if (runtime === "openclaw") {
return "openclaw";
}
if (provider === "openai" && runtime === "codex") {
return "codex";
}
// CLI runtime bindings are provider-specific; an override from another
// provider must not leak into this session's model route.
return resolveCliRuntimeModelBackendBinding({ provider, runtime })?.runtime;
}