UPDATE gateway_runner_policies
SET failover_policy = jsonb_set(
      jsonb_set(
        failover_policy,
        '{maxDurationSeconds}',
        COALESCE(failover_policy -> 'maxDurationSeconds', '600'::jsonb),
        true
      ),
      '{maxPlatforms}',
      CASE
        WHEN COALESCE(failover_policy ->> 'maxPlatforms', '') IN ('', '3') THEN '99'::jsonb
        ELSE failover_policy -> 'maxPlatforms'
      END,
      true
    ),
    updated_at = now()
WHERE policy_key = 'default-runner-v1';
