Skip to content

fix: stop retrying on invalid LLM responses - #16

Merged
joaopereirajp merged 1 commit into
mainfrom
fix/non-retryable-response
Jul 11, 2026
Merged

fix: stop retrying on invalid LLM responses#16
joaopereirajp merged 1 commit into
mainfrom
fix/non-retryable-response

Conversation

@joaopereirajp

Copy link
Copy Markdown
Contributor

A action travou 13+ minutos porque o modelo retornou 15411 chars de whitespace como resposta. O código retryava 3× no primary + 3× no fallback (mesmo modelo) = 6 tentativas de ~2min cada.

Fix:

  • Trim responseText antes do JSON.parse
  • Classificar erros como retryable (HTTP 500, timeout, connection reset) vs non-retryable (JSON inválido, resposta vazia)
  • Quebrar o loop imediatamente em erros non-retryable
  • 2 testes novos cobrindo ambos os caminhos

266/266 tests pass, typecheck, lint, build clean.

@joaopereirajp
joaopereirajp force-pushed the fix/non-retryable-response branch from dc2046d to 28f5db9 Compare July 11, 2026 16:48
Non-retryable errors (invalid JSON, empty/whitespace response) now break
the retry loop immediately instead of wasting 3 attempts × 2min each.

Only truly transient errors (HTTP 500, timeout, connection reset) are
retried. This prevents the action from hanging for 13+ minutes when a
model returns garbage output.

- Trim responseText before JSON.parse
- Classify errors as retryable vs non-retryable
- Break loop on non-retryable errors
- Add 2 test cases for both paths
@joaopereirajp
joaopereirajp merged commit 55fab18 into main Jul 11, 2026
5 checks passed
@joaopereirajp
joaopereirajp deleted the fix/non-retryable-response branch July 11, 2026 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants