feat(openai-sdk-python): 7-tool parity - #1430
Conversation
Add document_list, document_add, document_delete, get_profile, and memory_forget alongside search_memories and add_memory. Includes forget_memory HTTP helper and expanded tests. Co-authored-by: Cursor <cursoragent@cursor.com>
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
supermemory-mcp | 1160c46 | Aug 18 2026, 03:22 PM |
|
Claude finished @Dhravya's task in 1m 22s —— View job Review Complete
Summary: Reviewed the 7-tool expansion for the OpenAI Python SDK. The code structure is clean with good config validation, but I confirmed 3 bugs identified by previous reviewers that will cause runtime failures:
Score: 7/10 — Fix the above before merge; see my review comment for details. |
There was a problem hiding this comment.
Overview: Expands the OpenAI Python SDK from 2 tools to 7 (search, add, get_profile, document_list/add/delete, memory_forget) with a new HTTP helper for the forget endpoint.
Issues found:
forget_memory.py:46— The async function uses synchronousrequestsin the fallback path, which blocks the event loop. Fix by wrapping inasyncio.to_thread().
Score: 8/10
The code is well-structured with proper error handling, good validation (e.g., rejecting both project_id and container_tags), and comprehensive test coverage. The one issue above should be fixed before merge to avoid blocking async applications when aiohttp isn't installed.
| except ImportError: | ||
| import requests | ||
|
|
||
| response = requests.delete( |
There was a problem hiding this comment.
Bug: Synchronous I/O blocks the event loop
This async function falls back to synchronous requests when aiohttp isn't installed. Since requests.delete() is blocking, it will freeze the entire event loop until the HTTP request completes — potentially causing timeouts or deadlocks in async applications.
Since Python 3.9 is now the minimum version, use asyncio.to_thread() to run the blocking call in a thread pool:
except ImportError:
import asyncio
import requests
def _sync_delete() -> requests.Response:
return requests.delete(
f"{base_url}/v4/memories",
headers={
"Content-Type": "application/json",
"Authorization": f"Bearer {api_key}",
},
json=payload,
timeout=30,
)
response = await asyncio.to_thread(_sync_delete)
if not response.ok:
raise RuntimeError(
f"Supermemory forget memory failed: {response.status_code} "
f"{response.reason}. {response.text}"
)There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default 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 1160c46. Configure here.
| return ProfileResult( | ||
| success=True, | ||
| profile=profile if isinstance(profile, dict) else None, | ||
| search_results=search_results, |
There was a problem hiding this comment.
Profile dropped on success
High Severity
get_profile marks success but sets profile to null whenever the SDK returns a Pydantic profile object, because only dict instances are kept. Real client.profile() responses use models, so the tool often returns an empty profile despite a successful API call.
Reviewed by Cursor Bugbot for commit 1160c46. Configure here.
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
supermemory-app | 1160c46 | Commit Preview URL Branch Preview URL |
Aug 18 2026, 03:25 PM |
0a3ff69 to
1160c46
Compare
00462ad to
03849ce
Compare
There was a problem hiding this comment.
Overview: Expands the OpenAI Python SDK from 2 tools to 7 (search, add, get_profile, document_list/add/delete, memory_forget) with new result types and a custom HTTP helper for the forget endpoint.
Issues found:
The previous reviews correctly identified 3 bugs that need fixing:
-
forget_memory.py:46— Blocking I/O in async function: The synchronousrequests.delete()fallback will freeze the event loop. Since Python 3.9 is the minimum version, wrap withasyncio.to_thread(). -
tools.py:501— Profile data lost:get_profilefilters out Pydantic models withisinstance(profile, dict), but the SDK returns Pydantic objects. Use.model_dump()instead of the type check. -
tools.py:531-537— Pydantic objects not serialized:document_liststores rawdocumentsandpaginationobjects without calling.model_dump(), which will causejson.dumps()to raiseTypeErrorwhenexecute_tool_callserializes the result.
For consistency, note that search_memories, add_memory, and document_add correctly use .model_dump() — applying the same pattern to get_profile and document_list will fix issues 2 and 3.
Score: 7/10
The code structure is clean, config validation is good (rejecting both project_id and container_tags), and test coverage was expanded. The three issues above will cause runtime failures in production async applications and should be fixed before merge.



Summary
SupermemoryToolsfrom 2 tools to 7 (matches@supermemory/tools)memory_forgetvia shared HTTP helperStacked on #1429
Test plan
uv run pytest tests/test_tools.py::TestMemoryOperationsUnitMade with Cursor