Skip to content

Comments

Update chainlit data layer with metadata merging#2688

Merged
hayescode merged 2 commits intoChainlit:mainfrom
jfperusse:fix/merge-thread-metadata
Nov 24, 2025
Merged

Update chainlit data layer with metadata merging#2688
hayescode merged 2 commits intoChainlit:mainfrom
jfperusse:fix/merge-thread-metadata

Conversation

@jfperusse
Copy link
Contributor

@jfperusse jfperusse commented Nov 24, 2025

This fixes the bug where threads would not be shared anymore as soon as we would leave the context of the shared thread (e.g. refresh, or going to a different conversation) because the session metadata would overwrite the entire thread metadata.

Incoming metadata is now merged with the existing one, and if any incoming key has a None value, we remove that key from the merged metadata.


Summary by cubic

Merge incoming thread metadata instead of overwriting, so shared threads stay shared after refresh or when switching conversations. Incoming keys set to None are treated as deletes.

  • Bug Fixes
    • Preserve existing metadata by merging updates; handle JSON string or dict formats.
    • Remove keys when incoming value is None to allow unsetting metadata.

Written for commit 6adf15c. Summary will update automatically on new commits.

@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. backend Pertains to the Python backend. bug Something isn't working data layer Pertains to data layers. labels Nov 24, 2025
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

@hayescode hayescode added this pull request to the merge queue Nov 24, 2025
Merged via the queue into Chainlit:main with commit b2af84c Nov 24, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend Pertains to the Python backend. bug Something isn't working data layer Pertains to data layers. size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants