Restoring to checkpoint doesn't resume from node of checkpoint

hi @sasharosca

imho what you’re seeing is expected if you call update_state without properly pinning the update to a specific checkpoint. By default, updates apply to the thread’s latest checkpoint. To resume from a particular checkpoint’s location, you must either:

  • pass the exact checkpoint (or config) you want to update from, or
  • fork/copy that checkpoint first and then update, or
  • invoke/stream the graph starting from that checkpoint rather than calling update_state

Can you try one of these?

# 1) Fetch the exact checkpoint (or state) you want to edit from
state = client.threads.get_state(thread_id=tid, checkpoint_id=target_ckpt_id)
ckpt = state["checkpoint"]  # pass this, not just the id

# 2) Option A: fork/copy then update
client.threads.update_state(
    thread_id=tid,
    values={"foo": "bar"},
    as_node="__copy__",   # copy the old checkpoint, then
    checkpoint=ckpt,      # apply on the copied branch
)

# 2) Option B: clear next tasks first, then update explicitly
client.threads.update_state(thread_id=tid, values=None, as_node="__end__", checkpoint=ckpt)
client.threads.update_state(thread_id=tid, values={"foo": "bar"}, as_node="your_node")

# 3) To run from that point instead of updating state, invoke with config pinned to the checkpoint
app.invoke(inputs, {"configurable": {"thread_id": tid, "checkpoint_id": target_ckpt_id}})