Spaces:
Sleeping
Sleeping
Fix: Critic LLM failure now triggers graceful exit
Browse filesWhen Critic's LLM evaluation fails (e.g., 429 rate limit), it was
returning score=5.0 without setting an error flag, causing
should_continue() to return "retry" and creating an infinite loop.
Now sets analyzer_revision_skipped=True on LLM error to trigger
graceful exit with current draft instead of retrying.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- src/nodes/critic.py +6 -0
src/nodes/critic.py
CHANGED
|
@@ -327,6 +327,12 @@ def critic_node(state, workflow_id=None, progress_store=None):
|
|
| 327 |
elapsed = time.time() - start_time
|
| 328 |
provider = result.get('provider', 'unknown')
|
| 329 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 330 |
# Log failed providers
|
| 331 |
providers_failed = result.get('providers_failed', [])
|
| 332 |
for pf in providers_failed:
|
|
|
|
| 327 |
elapsed = time.time() - start_time
|
| 328 |
provider = result.get('provider', 'unknown')
|
| 329 |
|
| 330 |
+
# Propagate LLM error to state to trigger graceful exit (prevents infinite retry loop)
|
| 331 |
+
if result.get("error"):
|
| 332 |
+
_add_activity_log(workflow_id, progress_store, "critic",
|
| 333 |
+
"LLM evaluation failed - exiting gracefully with current draft")
|
| 334 |
+
state["analyzer_revision_skipped"] = True # Triggers graceful exit in should_continue()
|
| 335 |
+
|
| 336 |
# Log failed providers
|
| 337 |
providers_failed = result.get('providers_failed', [])
|
| 338 |
for pf in providers_failed:
|