Skip to content

fix(cartesia-sdk): treat empty profile as no memories, not a retrieval error#1164

Open
Cintu07 wants to merge 1 commit into
supermemoryai:mainfrom
Cintu07:fix/cartesia-none-profile
Open

fix(cartesia-sdk): treat empty profile as no memories, not a retrieval error#1164
Cintu07 wants to merge 1 commit into
supermemoryai:mainfrom
Cintu07:fix/cartesia-none-profile

Conversation

@Cintu07

@Cintu07 Cintu07 commented Jun 26, 2026

Copy link
Copy Markdown

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:

  • return empty static/dynamic when profile is None instead of dereferencing it
  • search results handling and logging unchanged
  • add a regression test for the None-profile response, modeled on pipecat's
    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')

…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.
@vorflux

vorflux Bot commented Jun 26, 2026

Copy link
Copy Markdown
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

@graphite-app graphite-app Bot requested a review from Dhravya June 26, 2026 17:14
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.

1 participant