Skip to content

Conversation

@hombin
Copy link

@hombin hombin commented Jan 22, 2026

Motivation and Context

Fix issue-3364: #3364

Description

Intelligently detect and preserve custom store state while maintaining backward compatibility with standard ChatMessageStore.

The key insight is to distinguish between:

  1. Standard stores: Only have type and messages [expected] fields → Convert to ChatMessageStoreState object (existing behavior)
  2. Custom stores: Have additional fields (e.g., redis_url, thread_id) → Keep as dictionary to preserve all data

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

Test Update Required

One test needs updating: test_init_with_chat_message_store_state_no_messages (line 448 in tests/core/test_threads.py)

Why: This test uses Redis store data (with custom fields like thread_id, redis_url) but expects the state to be converted to a ChatMessageStoreState object with .messages attribute. With our fix, custom store states are correctly preserved as dictionaries to retain all configuration.

@github-actions github-actions bot changed the title Bugfix: issue-3364: detect and preserve custom store state Python: Bugfix: issue-3364: detect and preserve custom store state Jan 22, 2026
@hombin
Copy link
Author

hombin commented Jan 22, 2026

@microsoft-github-policy-service agree

@hombin
Copy link
Author

hombin commented Jan 26, 2026

Hi @markwallace-microsoft , when you have a moment, could you please help review and approve this PR?
Let me know if anything needs to be updated — happy to adjust. Thanks a lot!

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants