Skip to content

Add retry logic and graceful recovery to research loop#116

Merged
jimmytacks merged 1 commit into
mainfrom
fix/loop-retry-on-api-error
Apr 3, 2026
Merged

Add retry logic and graceful recovery to research loop#116
jimmytacks merged 1 commit into
mainfrom
fix/loop-retry-on-api-error

Conversation

@jimmytacks
Copy link
Copy Markdown
Collaborator

@jimmytacks jimmytacks commented Apr 3, 2026

Summary

  • Retries iterations up to 3 times on transient API errors (500, overloaded) with 30s/60s/90s exponential backoff
  • Failed iterations don't count against MAX_ITERATIONS — the loop skips and continues
  • When an iteration completes with partial work but no handoff signal, the loop continues with the same persona and injects failure context into HANDOFF.md so the next iteration knows to check git status and resume

Test plan

  • Verify normal loop operation is unchanged (successful iterations with handoff signals)
  • Simulate API error by checking grep pattern matches against a session file containing "type":"api_error"
  • Confirm handoff file content is correct after a missing-handoff recovery

🤖 Generated with Claude Code

API errors (500, overloaded) now trigger up to 3 retries with exponential
backoff (30s/60s/90s). If all retries fail, the iteration is skipped
without counting against the max. When an iteration completes but has no
handoff signal (partial crash), the loop continues with the same persona
and injects context about the failure into the handoff file so the next
iteration knows to check git status and resume rather than redo work.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@jimmytacks jimmytacks merged commit 05555d1 into main Apr 3, 2026
1 check passed
@jimmytacks jimmytacks deleted the fix/loop-retry-on-api-error branch April 3, 2026 08:43
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.

1 participant