Skip to content

fix(redis): reject incomplete chat histories on read - #76

Open
logicwu0 wants to merge 1 commit into
agentic-ai-java:mainfrom
logicwu0:fix/52-redis-corrupt-history
Open

logicwu0 wants to merge 1 commit into
agentic-ai-java:mainfrom
logicwu0:fix/52-redis-corrupt-history

Conversation

@logicwu0

Copy link
Copy Markdown
Contributor

Describe what this PR does / why we need it

When a stored record cannot be decoded, all three Redis clients currently drop it and return the remaining messages as a complete conversation. This can lose context, including messages between a tool call and its response.

Does this pull request fix one issue?

Fixes #52

Describe how you did it

Jedis, Lettuce and Redisson now decode the list in order and fail the read at the first unreadable record. The exception identifies its zero-based position without including the record or the parser exception. Reads do not modify the stored list. The README documents the change for applications that previously relied on partial reads.

Describe how to verify it

Run the Redis memory module against an isolated standalone Redis using its existing -Dredis.test.port=<port> option. With Java 21 and Redis 7.0.15, all nine focused integration cases failed on the unchanged implementation and passed with the fix. They cover a corrupt middle record, tool call/response order, all-unreadable records, legacy and empty histories, unchanged stored records, and safe diagnostics. The module run had 86 passes, no failures or errors, and 57 Docker-dependent tests skipped.

Special notes for reviews

No migration or write-path changes. The existing decoder still accepts legacy formats and retains its existing behavior for unknown types. This changes how a failed decode is handled, not which message schemas are supported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Redis 聊天记忆读取损坏记录时不应静默返回删减后的正常历史

1 participant