[hotfix] Fix the problems using Kafka as action state store #510
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Linked issue: #xxx
This PR fixes issues with the Kafka ActionStateStore that prevented actions from being correctly skipped after checkpoint recovery:
Fix ActionState deserialization failure: Removed
@JsonIgnorefromPythonEvent.getEvent()so that Python event bytes are persisted in ActionState. Without this, recovered ActionState hadnullevent bytes, causingTypeError: a bytes-like object is required, not 'NoneType'after recovery.Fix ActionStateStore not initialized during state recovery: Moved ActionStateStore initialization to also run in
initializeState(), ensuring it's available when rebuilding state from recovery markers.Fix state key mismatch after recovery: Changed Python
Event.idfrom random UUID to deterministic content-based UUID (MD5 hash). This ensures the same event produces the same ActionState key across restarts, enabling proper state lookup and divergence detection.Fix Kafka consumer partition assignment: Use
consumer.assign()instead ofsubscribe()for explicit partition control during state rebuild.Tests
Manually verified with local Kafka instance. E2E tests will be added in a follow-up PR.
API
No public API changes.
Documentation
doc-neededdoc-not-neededdoc-included