diff --git a/src/pyob/autoreviewer.py b/src/pyob/autoreviewer.py index 734831e..0be6595 100644 --- a/src/pyob/autoreviewer.py +++ b/src/pyob/autoreviewer.py @@ -213,9 +213,17 @@ def get_valid_edit( if not available_keys: if is_cloud: + # Check if we've been stuck for a while logger.warning( - "☁️ Cloud environment: Gemini keys exhausted/limited. Sleeping 60s for refill..." + "☁️ Cloud environment: Keys exhausted. Checking if cooldowns can be cleared..." ) + + # FORCE RESET: If we are in the cloud and all keys are dead, + # we must clear the cooldowns to attempt a retry, + # otherwise the pipeline is effectively dead. + for key in self.key_cooldowns: + self.key_cooldowns[key] = 0.0 + time.sleep(60) attempts += 1 continue diff --git a/src/pyob/models.py b/src/pyob/models.py index e25c071..a69f7d3 100644 --- a/src/pyob/models.py +++ b/src/pyob/models.py @@ -287,7 +287,7 @@ def get_valid_llm_response_engine( if not response_text or response_text.startswith("ERROR_CODE_"): if key and response_text and "429" in response_text: - key_cooldowns[key] = time.time() + 1200 + key_cooldowns[key] = time.time() + 60 logger.warning(f"⚠️ Key {key[-4:]} rate-limited. Rotating...") if is_cloud: logger.warning(