Skip to content

[runtime] Fix prune state corner cases around checkpoints#603

Open
joeyutong wants to merge 1 commit intoapache:mainfrom
joeyutong:codex/last-completed-seq-state
Open

[runtime] Fix prune state corner cases around checkpoints#603
joeyutong wants to merge 1 commit intoapache:mainfrom
joeyutong:codex/last-completed-seq-state

Conversation

@joeyutong
Copy link
Copy Markdown
Contributor

Purpose of change

ActionExecutionOperator had two prune-state corner cases around checkpoints.

  • prune bookkeeping used messageSequenceNumber, which tracks the latest started sequence, not the latest completed sequence. That means an in-flight sequence could be treated as prune-safe.

  • the operator pruned action state as soon as a run completed. If the job later recovered from an earlier completed checkpoint, replay of the same input could no longer reuse the durable action state that had already been written.

Fix

This change makes pruning checkpoint-safe again.

  • track a separate lastCompletedSequenceNumber keyed state
  • snapshot prune metadata from lastCompletedSequenceNumber instead of messageSequenceNumber
  • remove the eager prune path on run completion
  • prune action state only after notifyCheckpointComplete

Tests

The updated tests cover:

  • no pruning before checkpoint completion
  • no pruning of sequences that are still in flight
  • replay from an earlier checkpoint keeps durable state available
  • action state cleanup happens after checkpoint completion

API

No

Documentation

  • doc-needed
  • doc-not-needed
  • doc-included

@github-actions github-actions bot added doc-not-needed Your PR changes do not impact docs fixVersion/0.3.0 The feature or bug should be implemented/fixed in the 0.3.0 version. priority/major Default priority of the PR or issue. labels Apr 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc-not-needed Your PR changes do not impact docs fixVersion/0.3.0 The feature or bug should be implemented/fixed in the 0.3.0 version. priority/major Default priority of the PR or issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant