-- gpt-image-2 platforms do not declare an upstream concurrency limit. The
-- migration-only base default added in 0081 therefore turned an unspecified
-- limit into an artificial per-platform-model cap of five.
--
-- Remove only the exact policy written by 0081. Explicit platform, runtime, or
-- platform-model policies continue to take precedence and remain untouched.
UPDATE base_model_catalog
SET default_rate_limit_policy = '{}'::jsonb,
    metadata = (COALESCE(metadata, '{}'::jsonb) - 'rateLimitSource' - 'rateLimitUpdatedAt')
      || jsonb_build_object(
        'rateLimitRemovedAt', '2026-07-24',
        'rateLimitRemovalReason', 'upstream-limit-unconfigured'
      ),
    updated_at = now()
WHERE invocation_name = 'gpt-image-2'
  AND metadata->>'rateLimitSource' = 'image-gateway-migration'
  AND default_rate_limit_policy =
    '{"rules":[{"metric":"concurrent","limit":5,"leaseTtlSeconds":300}]}'::jsonb;
