purushah opened a new pull request, #1094:
URL: https://github.com/apache/flink-agents/pull/1094

   Linked issue: N/A (bug found during recovery testing)
   
   ### Purpose of change
   
   `ActionStateUtil.generateUUIDForAction` derives the durable-state key from 
`Action.hashCode()`. `Action`'s hash folds in `JavaFunction`'s `Class[]` 
parameterTypes, and `Class.hashCode()` is the per-JVM identity hash — so every 
durable-state key silently changes when the JVM restarts. After any failure 
recovery, lookups can never hit: every action re-executes instead of replaying, 
which breaks the exactly-once contract of the action-state store (and re-bills 
every LLM call in agent workloads).
   
   This PR derives the UUID from `action.getName()`, which is unique within a 
plan and stable across processes.
   
   ### How it was found
   
   Kill/restore recovery experiments with a deliberately non-deterministic 
agent and the Kafka action-state store: **0/134** re-processed actions replayed 
from the store before this fix; **90/90** replayed with 0% divergence after. 
The existing test suite doesn't catch it because all tests run inside a single 
JVM, where identity hashes are stable.
   
   ### Compatibility note
   
   The key format changes, so state written by prior versions won't be found on 
restore. Those keys were already unreadable across restarts (that's the bug), 
so no working deployment regresses; single-process re-reads within one JVM 
lifetime are unaffected in practice because recovery is the only reader.
   
   ### Tests
   
   - `mvn test -pl runtime -am -Dtest='*ActionState*'` — 127 tests, 0 failures 
(includes `ActionStateUtilTest`, `KafkaActionStateStoreTest`, Fluss store 
integration tests), on current main (rebased over #1024).
   - Cross-JVM behavior validated by the kill/restore experiment above.
   
   ### API
   
   No public API changes.
   
   ### Documentation
   
   - [ ] `doc-needed`
   - [x] `doc-not-needed`
   - [ ] `doc-included`
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   - [x] Yes
   - [ ] No
   
   Generated-by: Claude Code (Claude Fable 5)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to