fix(mcp): add project detection from memory:// URLs in edit_note and delete_note#668
fix(mcp): add project detection from memory:// URLs in edit_note and delete_note#668phernandez wants to merge 1 commit intomainfrom
Conversation
…delete_note edit_note and delete_note were missing detect_project_from_url_prefix() which other tools (read_note, build_context, search_notes, read_content) already use. This caused incorrect cloud routing when using memory:// URLs without an explicit project parameter in multi-project setups. Fixes #664 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: phernandez <paul@basicmachines.co>
|
Claude finished @phernandez's task in 1m 42s —— View job PR Review
SummaryThis is a clean, minimal fix that closes a real routing gap. Code Quality & Standards ✅The implementation is correct and follows the established pattern exactly: # delete_note.py:227-230 / edit_note.py:264-267
if project is None:
detected = detect_project_from_url_prefix(identifier, ConfigManager().config)
if detected:
project = detectedPlacement (before Testing & Documentation
|
| Item | Status |
|---|---|
| Follows Basic Memory coding conventions | ✅ |
| Python 3.12+ type annotations and async patterns | ✅ |
| FastAPI/Typer conventions followed | ✅ |
| 100-character line length maintained | ✅ |
| No commented-out code | ✅ |
| Unit tests for new code paths | |
| 100% test coverage maintained | |
| No hardcoded secrets or credentials | ✅ |
| Input validation for MCP tools | ✅ |
| Proper error handling and logging | ✅ |
| No emoji/unicode in console output | ✅ |
Verdict: Logically correct and architecturally sound. The only ask before merge is adding tests for the two new detection branches to maintain the 100% coverage requirement. The move_note gap is a good candidate for a follow-up issue.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7c12ff39e1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if project is None: | ||
| detected = detect_project_from_url_prefix(identifier, ConfigManager().config) |
There was a problem hiding this comment.
Limit auto project routing to memory:// identifiers
This new routing block runs for every identifier, but detect_project_from_url_prefix() also matches plain path/permalink inputs (not just memory://...), so non-URL deletes now get silently re-routed when their first segment equals another project name. In a multi-project setup, a call like delete_note("research/archive") with project=None can now delete from project research instead of the default project where that path was intended, which is a destructive misroute; please gate this override to actual memory:// identifiers before setting project (and apply the same fix to the identical block in edit_note).
Useful? React with 👍 / 👎.
Summary
edit_noteanddelete_notewere missingdetect_project_from_url_prefix()that other tools (read_note,build_context,search_notes,read_content) already usememory://URLs without an explicitprojectparameter in multi-project setupsget_project_client()in both toolsFixes #664
Test plan
just fast-checkpasses (lint, typecheck, impacted tests)pytest tests/mcp/test_tool_edit_note.py tests/mcp/test_tool_delete_note.py -vpassesmemory://project-name/noteURLs in edit_note and delete_note🤖 Generated with Claude Code