AI: harness-aware model validation, official codex contract, launch fail-fast
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QKxGW1raAWaqeU8WdHsMsp
This commit is contained in:
@@ -37,7 +37,8 @@ env)
|
||||
cn_ai_render_codex_config "$provider" "$model" "$key"
|
||||
exec "$command"
|
||||
fi
|
||||
eval "$(cn_ai_render_env "$harness" "$provider" "$model" "$key")"
|
||||
env_exports=$(cn_ai_render_env "$harness" "$provider" "$model" "$key")
|
||||
eval "$env_exports"
|
||||
exec "$command"
|
||||
;;
|
||||
native)
|
||||
|
||||
@@ -32,13 +32,29 @@ if [[ $level == "unsupported" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
resolved=$(cn_ai_model_by_alias "$provider" "$model" 2>/dev/null || true)
|
||||
if [[ -n $resolved ]]; then
|
||||
model="$resolved"
|
||||
elif ! cn_ai_models "$provider" | grep -qxF "$model"; then
|
||||
echo "Unknown model for $provider: $model" >&2
|
||||
echo "Available: $(cn_ai_models "$provider" | tr '\n' ' ')" >&2
|
||||
exit 1
|
||||
allowlist=$(cn_ai_combo_models "$harness" "$provider")
|
||||
if [[ -n $allowlist ]]; then
|
||||
# Combo-restricted model set (e.g. codex uses its own catalog slugs)
|
||||
if ! grep -qxF "$model" <<<"$allowlist"; then
|
||||
echo "Model $model not supported for $harness x $provider" >&2
|
||||
echo "Supported: $(tr '\n' ' ' <<<"$allowlist")" >&2
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
resolved=$(cn_ai_model_by_alias "$provider" "$model" 2>/dev/null || true)
|
||||
if [[ -n $resolved ]]; then
|
||||
model="$resolved"
|
||||
elif ! cn_ai_models "$provider" | grep -qxF "$model"; then
|
||||
echo "Unknown model for $provider: $model" >&2
|
||||
echo "Available: $(cn_ai_models "$provider" | tr '\n' ' ')" >&2
|
||||
exit 1
|
||||
fi
|
||||
model_proto=$(cn_ai_model_protocol "$provider" "$model")
|
||||
harness_proto=$(cn_ai_harness_field "$harness" protocol)
|
||||
if [[ -n $model_proto && $model_proto != "$harness_proto" ]]; then
|
||||
echo "Model $model speaks $model_proto, but $harness needs $harness_proto" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
mkdir -p "$CN_AI_PROFILE_DIR"
|
||||
|
||||
Reference in New Issue
Block a user