Files
langgraph/libs
Claude b1826c112c Make retry policy durable by persisting attempt count and timestamp
Retries were previously entirely in-memory: the attempt counter and
backoff sleep happened inside run_with_retry/arun_with_retry without
any checkpoint writes. If the process crashed mid-retry, the state was
lost and the task would restart from attempt 0 on resume, effectively
ignoring max_attempts across restarts.

This change adds a RETRY special write channel. On each retryable
failure, before sleeping, the retry loop persists (attempt_count,
next_retry_timestamp) to the checkpoint via put_writes. On resume,
the scratchpad restores these values so the retry loop continues
from the correct attempt and honors the remaining backoff time.

Key changes:
- New RETRY constant in _constants.py and checkpoint serde/types
- RETRY added to WRITES_IDX_MAP for checkpoint storage
- PregelScratchpad gains retry_attempt/retry_ts fields
- _scratchpad() in _algo.py extracts RETRY from pending_writes
- _match_writes skips RETRY (like ERROR/INTERRUPT/RESUME)
- output_writes returns early for RETRY (no stream output)
- run_with_retry/arun_with_retry accept put_writes callback,
  restore attempt state from scratchpad, persist before sleep
- Runner passes put_writes to retry functions

https://claude.ai/code/session_01768mrKrVCCtXdJgRNFdWrb
2026-02-07 07:55:53 +00:00
..
2026-02-03 10:52:33 -08:00
2026-02-06 00:38:23 +00:00