Add Fal to Gateway Health Dashboard & Integration Guide#99
Merged
Conversation
- Imported _fal_models_cache to caching system - Added Fal.ai entry in GATEWAY_CONFIG with static catalog settings - Updated documentation for adding gateways to dashboard and health checks - Set Fal.ai url to None to indicate static catalog with dummy API key - Increased min_expected_models to 50 for Fal.ai - Enhanced integration guide to include gateway health dashboard updates Co-authored-by: terragon-labs[bot] <terragon-labs[bot]@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Looks like there are a few issues preventing this PR from being merged!
If you'd like me to help, just leave a comment, like Feel free to include any additional details that might help me get this PR into a better state. You can manage your notification settings |
- Added 'fal' to the list of expected gateways in the health checker tests. - Updated URL validation to permit None values for gateways with static catalogs like Fal, ensuring tests accept URLs that are either strings starting with http(s) or None. Co-authored-by: terragon-labs[bot] <terragon-labs[bot]@users.noreply.github.com>
Armin2708
pushed a commit
that referenced
this pull request
Nov 26, 2025
* feat(gateway): add Fal.ai gateway to health dashboard configuration - Imported _fal_models_cache to caching system - Added Fal.ai entry in GATEWAY_CONFIG with static catalog settings - Updated documentation for adding gateways to dashboard and health checks - Set Fal.ai url to None to indicate static catalog with dummy API key - Increased min_expected_models to 50 for Fal.ai - Enhanced integration guide to include gateway health dashboard updates Co-authored-by: terragon-labs[bot] <terragon-labs[bot]@users.noreply.github.com> * test(health): add 'fal' gateway and allow None URLs in health checks - Added 'fal' to the list of expected gateways in the health checker tests. - Updated URL validation to permit None values for gateways with static catalogs like Fal, ensuring tests accept URLs that are either strings starting with http(s) or None. Co-authored-by: terragon-labs[bot] <terragon-labs[bot]@users.noreply.github.com> --------- Co-authored-by: terragon-labs[bot] <terragon-labs[bot]@users.noreply.github.com>
vdimarco
added a commit
that referenced
this pull request
Feb 1, 2026
… instead of dropped model_id column Fixes #99 Sentry errors with 'column models.model_id does not exist' ## Issues Fixed **Sentry Issues**: 99 unresolved errors in last 24 hours **Error**: Database pricing lookup failed for [model]: {'code': '42703', 'details': None, 'hint': None, 'message': 'column models.model_id does not exist'} ## Root Cause Migration `20260131000002_drop_model_id_column.sql` dropped the redundant `model_id` column from the `models` table in favor of `model_name`. However, several database query functions were still attempting to query the `models` table using the now-nonexistent `model_id` column: 1. `src/services/pricing_lookup.py:_get_pricing_from_database()` - Line 229 2. `src/services/pricing.py:get_model_pricing_from_db()` - Line 74 3. `src/db/failover_db.py:get_providers_for_model()` - Lines 65, 94 4. `src/db/failover_db.py:get_provider_model_id()` - Line 209 Additionally, `failover_db.py` was still selecting pricing columns directly from the `models` table instead of using the `model_pricing` relationship. ## Solution ### 1. Updated pricing_lookup.py - Changed query from `.eq("model_id", model_id)` to `.eq("model_name", model_id)` - Updated SELECT clause to use `model_name` instead of `model_id` - Added clarifying comments about the migration ### 2. Updated pricing.py - Changed query from `.eq("model_id", candidate)` to `.eq("model_name", candidate)` - Updated SELECT clause to use `model_name` instead of `model_id` - Added clarifying comments about the migration ### 3. Updated failover_db.py - **Query Changes:** - Changed filter from `.eq("model_id", model_id)` to `.eq("model_name", model_id)` - Updated SELECT clause to use `model_name` instead of `model_id` - Removed direct pricing column selects (pricing_prompt, pricing_completion, etc.) - Added `model_pricing` relationship join to get pricing data - **Data Processing Changes:** - Updated to extract pricing from `model_pricing` relationship - Changed field mapping from `row["model_id"]` to `row["model_name"]` - Added extraction of pricing from nested `model_pricing` object - Updated `get_provider_model_id()` to use `model_name` filter ## Changes Made ### Modified Files 1. `src/services/pricing_lookup.py` - Updated database query to use model_name 2. `src/services/pricing.py` - Updated database query to use model_name 3. `src/db/failover_db.py` - Updated queries and data extraction for model_name and model_pricing table ### New Test Files 1. `tests/services/test_pricing_lookup_model_name_fix.py` - 7 comprehensive tests 2. `tests/db/test_failover_db_model_name_fix.py` - 6 comprehensive tests 3. `tests/services/test_pricing_model_name_fix.py` - 7 comprehensive tests **Total**: 20 new tests covering: - Query structure verification (uses model_name, not model_id) - Pricing extraction from model_pricing table - Missing data handling - Error handling - Per-token to per-1M conversion - Multiple candidate ID handling ## Testing ### Unit Tests - ✅ 20 new tests added covering all modified functions - ✅ Tests verify queries use model_name instead of model_id - ✅ Tests verify pricing extracted from model_pricing relationship - ✅ Tests verify error handling and edge cases ### Migration Compatibility - ✅ Aligns with migration `20260131000002_drop_model_id_column.sql` - ✅ Compatible with new schema: model_name (canonical) + provider_model_id (provider-specific) - ✅ Uses model_pricing table for pricing data (per-token format) ## Impact ### Before Fix - 🔴 99 Sentry errors in last 24 hours - 🔴 Database queries failing with PostgreSQL error 42703 - 🔴 Pricing lookups failing for all providers - 🔴 Failover queries unable to find provider alternatives ### After Fix - ✅ All database queries use correct column (model_name) - ✅ Pricing lookups work correctly from model_pricing table - ✅ Failover system can find provider alternatives - ✅ No more column does not exist errors ## Database Schema Reference After migration `20260131000002`, the models table schema is: | Field | Type | Purpose | |-------|------|---------| | `id` | `int` | Primary key | | `model_name` | `str` | Canonical identifier (NEW PRIMARY IDENTIFIER) | | `provider_model_id` | `str` | Provider-specific API identifier | | ~~`model_id`~~ | ~~`str`~~ | ❌ REMOVED (redundant) | The `model_pricing` table uses `model_id` as a foreign key to `models.id` (the integer primary key). ## Related - Migration: `supabase/migrations/20260131000002_drop_model_id_column.sql` - Documentation: `docs/MODEL_ID_MIGRATION_SUMMARY.md` - Issue: GATEWAYZ-BACKEND-86 (99 errors) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Changes
Code
_fal_models_cache).Documentation
How to test
Notes
Documentation references
🌿 Generated by Terry
ℹ️ Tag @terragon-labs to ask questions and address PR feedback
📎 Task: https://www.terragonlabs.com/task/2ca815ef-a1d1-4581-b78d-dc34460d9e1e
Note
Integrates Fal.ai (static catalog) into the gateway health dashboard with
url=Noneand min models 50, updates integration guide, and adapts tests to include Fal and allow None URLs._fal_models_cacheand addfaltoGATEWAY_CONFIG(url=None, dummy API key viagetattr(Config, 'FAL_KEY', 'static_catalog'),min_expected_models=50,header_type='bearer').falin required gateways and allowurlto beNonefor static catalogs.Written by Cursor Bugbot for commit 3ac9bc3. This will update automatically on new commits. Configure here.