mirror of
https://github.com/tiennm99/ccs.git
synced 2026-09-05 08:17:19 +00:00
fix(codex): restore version context for override failures
This commit is contained in:
@@ -14,6 +14,7 @@ import {
|
||||
codexBinarySupportsConfigOverrides,
|
||||
detectCodexCli,
|
||||
getCodexBinaryInfo,
|
||||
readCodexVersion,
|
||||
} from './codex-detector';
|
||||
|
||||
const CODEX_RUNTIME_PROVIDER_ID = 'ccs_runtime';
|
||||
@@ -35,6 +36,17 @@ function buildConfigOverrideSupportError(binaryInfo?: TargetBinaryInfo): Error {
|
||||
);
|
||||
}
|
||||
|
||||
function hydrateCodexBinaryVersion(binaryInfo?: TargetBinaryInfo): TargetBinaryInfo | undefined {
|
||||
if (!binaryInfo || binaryInfo.version || !binaryInfo.path) {
|
||||
return binaryInfo;
|
||||
}
|
||||
|
||||
return {
|
||||
...binaryInfo,
|
||||
version: readCodexVersion(binaryInfo.path),
|
||||
};
|
||||
}
|
||||
|
||||
function findDisallowedCodexManagedFlags(args: string[]): string[] {
|
||||
const disallowed = new Set<string>();
|
||||
|
||||
@@ -99,7 +111,7 @@ export class CodexAdapter implements TargetAdapter {
|
||||
if (profileType === 'default') {
|
||||
if (reasoningOverride) {
|
||||
if (!codexBinarySupportsConfigOverrides(options?.binaryInfo)) {
|
||||
throw buildConfigOverrideSupportError(options?.binaryInfo);
|
||||
throw buildConfigOverrideSupportError(hydrateCodexBinaryVersion(options?.binaryInfo));
|
||||
}
|
||||
return [
|
||||
...buildConfigOverrideArgs([
|
||||
@@ -112,7 +124,7 @@ export class CodexAdapter implements TargetAdapter {
|
||||
}
|
||||
|
||||
if (!codexBinarySupportsConfigOverrides(options?.binaryInfo)) {
|
||||
throw buildConfigOverrideSupportError(options?.binaryInfo);
|
||||
throw buildConfigOverrideSupportError(hydrateCodexBinaryVersion(options?.binaryInfo));
|
||||
}
|
||||
|
||||
if (!creds?.baseUrl?.trim() || !creds.apiKey?.trim()) {
|
||||
|
||||
@@ -45,7 +45,7 @@ function runCodexProbe(codexPath: string, args: string[]): string | undefined {
|
||||
}
|
||||
}
|
||||
|
||||
function readCodexVersion(codexPath: string): string | undefined {
|
||||
export function readCodexVersion(codexPath: string): string | undefined {
|
||||
return runCodexProbe(codexPath, ['--version'])?.trim();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user