Skip to content

Fix resume failing when interrupt checkpoint is buried by continuation checkpoints - #10

Open
MikaAK wants to merge 1 commit into
freshaengineering:mainfrom
MikaAK:fix/resume-interrupt-checkpoint-lookup
Open

Fix resume failing when interrupt checkpoint is buried by continuation checkpoints#10
MikaAK wants to merge 1 commit into
freshaengineering:mainfrom
MikaAK:fix/resume-interrupt-checkpoint-lookup

Conversation

@MikaAK

@MikaAK MikaAK commented Apr 11, 2026

Copy link
Copy Markdown

Summary

  • When resuming from an interrupt, the continuation may save intermediate checkpoints that become the "latest" by created_at
  • A subsequent resume call loads only the latest checkpoint via load/1, finds no pending_interrupts, and returns {:error, :no_pending_interrupt}
  • This fix adds a fallback in resume_from_checkpoint/6 that uses list/2 to search recent checkpoints for the most recent one with pending interrupts

Scenario

  1. Graph invokes → hits interrupt at node A → checkpoint saved with pending_interrupts
  2. Resume resolves A → graph continues through B → C
  3. Node B saves a checkpoint (now the latest, no interrupts)
  4. Node C hits another interrupt → checkpoint saved with pending_interrupts
  5. Before fix: Second resume loads B's checkpoint (latest), sees no interrupts → fails
  6. After fix: Second resume falls back to searching checkpoint list → finds C's interrupt → resumes correctly

Test plan

  • Added test resume finds interrupt checkpoint even when later non-interrupt checkpoints exist covering the multi-interrupt resume scenario
  • All 144 tests pass (143 existing + 1 new)
  • No changes to the Checkpointer behaviour — uses existing list/2 callback

…n checkpoints

When a graph resumes from an interrupt and the continuation saves
intermediate checkpoints, the latest checkpoint no longer has
pending_interrupts. A subsequent resume call would fail with
:no_pending_interrupt because it only checked the single latest
checkpoint.

This fix adds a fallback in resume_from_checkpoint that searches
through recent checkpoints (via the checkpointer's list/2) to find
the most recent one with pending interrupts when the latest
checkpoint has none.

Scenario this fixes:
1. Graph invokes, hits interrupt at node A (checkpoint saved with interrupt)
2. Resume resolves A, graph continues to B -> C
3. Node B saves checkpoint (now latest, no interrupts)
4. Node C hits interrupt (checkpoint saved, but B's is still "latest" by created_at)
5. Second resume fails because load/1 returns B's checkpoint

Now step 5 falls back to searching the checkpoint list for the
interrupt checkpoint from step 4.
MikaAK added a commit to MikaAK/lang_ex that referenced this pull request Apr 23, 2026
@twist900

twist900 commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator

@claude review

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