Skip to content

[Bug]: Return updated operations on empty checkpoint #184

@yaythomas

Description

@yaythomas

Expected Behavior

When creating a Checkpoint with an empty updates array, such that

 CheckpointDurableExecutionRequest(DurableExecutionArn=<<my-arn>>, CheckpointToken=<<my-token>>, Updates=[])

The response should contain NewExecutionState, where

If NO new events occurred:

  1. CheckpointToken: New token with incremented sequence
  2. NewExecutionState.Operations: Empty array []
  3. NewExecutionState.NextMarker: null

If new events occurred (timer fired, etc.):

  1. CheckpointToken: New token with incremented sequence
  2. NewExecutionState.Operations: Array with those operations
  3. NewExecutionState.NextMarker: null

The response CAN return an empty NewExecutionState.Operations array when there are no updates AND no new backend events.

The response should ALWAYS includes NewExecutionState - it never omits it.

Actual Behavior

The local-runner has a short-circuit only to pass back the updated checkpoint token and set new_execution_state=None if updates are empty. This is wrong.

        if updates:
            checkpoint_output = self._checkpoint_processor.process_checkpoint(
                checkpoint_token=checkpoint_token,
                updates=updates,
                client_token=client_token,
            )

            new_execution_state = None
            if checkpoint_output.new_execution_state:
                new_execution_state = CheckpointUpdatedExecutionState(
                    operations=checkpoint_output.new_execution_state.operations,
                    next_marker=checkpoint_output.new_execution_state.next_marker,
                )

            return CheckpointDurableExecutionResponse(
                checkpoint_token=checkpoint_output.checkpoint_token,
                new_execution_state=new_execution_state,
            )

        # Save execution state after generating new token
        new_checkpoint_token = execution.get_new_checkpoint_token()
        self._store.update(execution)

        return CheckpointDurableExecutionResponse(
            checkpoint_token=new_checkpoint_token,
            new_execution_state=None,
        )

Steps to Reproduce

Create empty checkpoint call

SDK Version

1

Python Version

3.13

Is this a regression?

No

Last Working Version

No response

Additional Context

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Status

In progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions