fix: remove stale OmniRoute combos on validation failure
Homelab Main / validate (push) Waiting to run Details
Homelab Main / running-update (push) Blocked by required conditions Details
Homelab Main / debian-ops (push) Blocked by required conditions Details

This commit is contained in:
juvenal.diaz 2026-10-08 14:25:51 -06:00
parent 74206d787e
commit 43e7215d20
1 changed files with 21 additions and 0 deletions

View File

@ -594,6 +594,25 @@ PY
echo "OmniRoute combo ${combo_name}: configured with ${model_count} runtime-validated model(s)"
}
remove_combo_if_exists() {
local cookie_jar="$1"
local auth_header="$2"
local combo_name="$3"
local body_file="$4"
local existing_id
local delete_status
if existing_id="$(combo_id_for "${cookie_jar}" "${auth_header}" "${combo_name}" "${body_file}" 2>/dev/null)" && [[ -n "${existing_id}" ]]; then
delete_status="$(api_delete "${cookie_jar}" "${auth_header}" "/api/combos/${existing_id}" "${body_file}")"
if [[ "${delete_status}" != "200" && "${delete_status}" != "204" && "${delete_status}" != "404" ]]; then
echo "Failed to remove stale OmniRoute combo ${combo_name}; DELETE HTTP ${delete_status}." >&2
sed -n '1,3p' "${body_file}" >&2 || true
return 1
fi
echo "OmniRoute combo ${combo_name}: removed stale combo"
fi
}
write_model_routes_file() {
local routes_json="$1"
local fast_json="$2"
@ -697,6 +716,8 @@ print(
sys.exit(0 if fast or smart else 1)
PY
then
remove_combo_if_exists "${cookie_jar}" "${auth_header}" "agent-fast-free" "${body_file}"
remove_combo_if_exists "${cookie_jar}" "${auth_header}" "agent-smart-free" "${body_file}"
write_invalid_model_routes_file "${validated_routes_json}" "${MODEL_ROUTES_FILE}"
echo "No OmniRoute models passed runtime validation; refusing to keep or create stale AI routes." >&2
echo "Check provider quota/cooldown or seed a known-good provider key, then rerun ./jeannie deploy-ai-stack." >&2