fix(openai-sdk-python): migrate to v4 Supermemory APIs - #1429
Conversation
…y APIs Replace deprecated search.execute and memories.add with search.memories (hybrid) and client.add. Fix middleware container_tag param and dedupe string/pydantic profile memory items. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Claude finished @Dhravya's task in 2m 33s —— View job Reviewing PR #1429: migrate openai-sdk-python to v4 Supermemory APIs
SummaryReviewed the migration from v3 to v4 Supermemory APIs. Confirmed 2 issues that need to be addressed before merge:
Additionally noted that the unit tests validate the current (incorrect) implementation and will need updating. Score: 7/10 — Good migration overall, but the issues above need fixing before merge. |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
supermemory-mcp | d348090 | Aug 08 2026, 03:00 AM |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
supermemory-app | d348090 | Commit Preview URL Branch Preview URL |
Aug 08 2026, 03:01 AM |
There was a problem hiding this comment.
Overview: Migrates the openai-sdk-python package from deprecated v3 Supermemory APIs to v4, updating search and add operations.
Issues found:
include_full_docsparameter insearch_memories()is accepted but silently ignored after the migration — callers relying on this will get unexpected behavior.
The rest of the changes look solid:
- Correct migration from
search.executetosearch.memorieswith hybrid mode - Proper fix of
container_tags→container_tagin middleware (passing single value vs list) - Good defensive handling with
getattr(response, "id", None)for potentially missing attributes - Utils deduplication correctly extended to handle Pydantic models alongside dicts and strings
- Unit tests cover the new API contract
Score: 9/10
Minor issue that should be addressed before merge to avoid silent behavior change for existing callers.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 03849ce. Configure here.
…e.documents
Breaking: SupermemoryToolsConfig now takes container_tag (str) instead of
container_tags (list). search_memories maps include_full_docs to
include={"documents": ...} on client.search.memories.
Co-authored-by: Dhravya Shah <dhravya@supermemory.com>
58d3aea to
03849ce
Compare
How to use the Graphite Merge QueueAdd the label Main to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
There was a problem hiding this comment.
Overview: Migrates the openai-sdk-python package from deprecated v3 Supermemory APIs to v4, updating search and add operations.
Issues found:
-
container_tagsvscontainer_taginconsistency (High): The middleware was correctly fixed to usecontainer_tag(singular) at line 227, buttools.pystill passescontainer_tags(plural) at lines 188 and 223. If the v4 API only acceptscontainer_tag, these calls will fail or silently ignore the tenant scope. -
include_full_docssilently ignored (Medium): Thesearch_memoriesfunction still acceptsinclude_full_docsin its signature (line 172) and tool schema (lines 68-75), but the v4client.search.memoriescall no longer forwards it. Callers relying on this behavior will get unexpected results. -
Unit tests assert incorrect behavior: The tests in
test_tools.py(lines 202-205, 227) assert thatcontainer_tagsis passed, which validates the current (incorrect) implementation rather than the correct v4 API contract. These tests will need updating when the code is fixed.
What looks good:
- Correct migration from
search.executetosearch.memorieswith hybrid mode - Proper defensive handling with
getattr(response, "id", None)for potentially missing attributes - Utils deduplication correctly extended to handle Pydantic models alongside dicts and strings
- Good null-safety with
response.results or []
Score: 7/10
The two issues above need to be addressed before merge — the container_tags bug could cause silent failures in production, and the include_full_docs change is a breaking behavior change for existing callers.
…ssifiers Align uv.lock package version, Trove classifiers, and mypy python_version with requires-python >=3.9 for the breaking v2 release. Co-authored-by: Dhravya Shah <dhravya@supermemory.com>
…thon>=3.9 Co-authored-by: Dhravya Shah <dhravya@supermemory.com>
Breaking changes (v2.0) — please fold into PR descriptionPackage bumped 1.0.4 → 2.0.0 (semver major for public config API break).
# Before (v1)
config = {"container_tags": ["user-123"]}
# After (v2)
config = {"container_tag": "user-123"}Also in this release:
|


Summary
search.executewithsearch.memories(hybrid mode) insearch_memoriesmemories.addwithclient.addin tools and middlewarecontainer_tagparam (was incorrectlycontainer_tags)supermemory>=3.50andrequires-python>=3.9Test plan
uv run pytest tests/test_tools.py::TestMemoryOperationsUnitMade with Cursor