fix(cartesia-sdk): treat empty profile as no memories, not a retrieval error#1164
Open
Cintu07 wants to merge 1 commit into
Open
fix(cartesia-sdk): treat empty profile as no memories, not a retrieval error#1164Cintu07 wants to merge 1 commit into
Cintu07 wants to merge 1 commit into
Conversation
…l error A user with no stored memories gets profile=None from the API. _retrieve_memories read response.profile.static/.dynamic without a None check, so it raised AttributeError for those users, surfaced as MemoryRetrievalError. Every new or empty-profile user then triggered a false "Memory retrieval failed" log and got no memory injection. Return empty memories instead, matching the pipecat SDK fix in supermemoryai#1027/supermemoryai#1033. Adds a regression test.
Contributor
|
Vorflux skipped this auto review because this account has reached its Auto Review daily review limit (10/10). You can change this in Auto Review Settings: https://us1.vorflux.com/supermemory/settings?section=pull-requests |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
A user with no stored memories gets profile=None from the API. _retrieve_memories
reads response.profile.static/.dynamic without a None check, so it raises
AttributeError for those users. The surrounding try/except turns that into
MemoryRetrievalError, which the caller logs as "Memory retrieval failed" and then
skips memory injection.
So every new or empty-profile user triggers a false error log each turn, and the
empty case is treated as a failure instead of "no memories yet". It also makes
real retrieval failures (timeouts, API errors) indistinguishable from the normal
empty case in logs.
The pipecat SDK already handles this after #1027/#1033 by treating a None profile
as empty memories. The cartesia SDK has the same unguarded access and was missed.
Changes:
test_empty_profile.py
Tested:
PYTHONPATH=src python -m unittest tests.test_empty_profile
(passes; fails on the original code with 'NoneType' object has no attribute 'static')