Skip to content

fix(langgraph): persist a failure record when recovery finds no checkpoint - #2

Open
SabreKeyZ wants to merge 1 commit into
mainfrom
cursor/crash-before-first-checkpoint-370a
Open

fix(langgraph): persist a failure record when recovery finds no checkpoint#2
SabreKeyZ wants to merge 1 commit into
mainfrom
cursor/crash-before-first-checkpoint-370a

Conversation

@SabreKeyZ

@SabreKeyZ SabreKeyZ commented Aug 31, 2026

Copy link
Copy Markdown
Owner

Fixes langchain-ai#8764

A fire-and-forget run that dies before its first durable put() left recovery with EmptyInputError and no checkpoint. Recovery now writes a loop checkpoint plus an ERROR pending write for that empty-resume path, and durability="sync" waits for the input checkpoint before the first user node.

This PR is on SabreKeyZ/langgraph because the agent token cannot open a PR against langchain-ai/langgraph (Resource not accessible by integration). Compare URL for the intended upstream PR:

https://github.com/langchain-ai/langgraph/compare/main...SabreKeyZ:langgraph:cursor/crash-before-first-checkpoint-370a?expand=1

Assignment requested on the issue: langchain-ai#8764 (comment)

Release note

Recovery of a thread with no durable checkpoint now persists a failure record (ERROR pending write) instead of raising EmptyInputError with an empty store. With durability="sync", the input checkpoint is flushed before the first user node runs.

How did you verify your code works?

In libs/langgraph:

  • make format — 151 files unchanged
  • make lint — ruff, import order, and ty check passed
  • New regressions: test_crash_before_first_checkpoint_records_failure_on_recovery (sync + async) — passed
  • Related: test_checkpoint_recovery, test_checkpoint_errors, test_pending_writes_resume, test_empty_invoke, test_checkpoint_recovery_async, test_drain_with_exit_durability_persists_resume_checkpoint — 33 passed
  • Manual probe of the same crash/recovery path under durability of sync, async, and exit — each persisted an ERROR write
Open in Web Open in Cursor 

…point

A run that dies before its first durable put leaves the thread empty.
Recovery via invoke(None) then raised EmptyInputError with no resumable
state and no durable evidence the accepted run was lost.

On that empty-resume path, persist a loop checkpoint plus an ERROR write.
With durability=sync, also wait for the input checkpoint before the first
user node so an accepted record exists before node execution.

Fixes langchain-ai#8764

Co-authored-by: 梁朝伟 <SabreKeyZ@users.noreply.github.com>
@SabreKeyZ
SabreKeyZ marked this pull request as ready for review August 31, 2026 03:06
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.

Crash before first durable checkpoint can silently drop an accepted run with no durable failure record

2 participants