Skip to content

fix(mcp): prevent phantom memory URL edits - #1073

Merged
phernandez merged 1 commit into
mainfrom
codex/1066-safe-memory-url-edit-routing
Jul 16, 2026
Merged

fix(mcp): prevent phantom memory URL edits#1073
phernandez merged 1 commit into
mainfrom
codex/1066-safe-memory-url-edit-routing

Conversation

@phernandez

@phernandez phernandez commented Jul 16, 2026

Copy link
Copy Markdown
Member

Why

edit_note could reinterpret an unresolved memory URL route as a path in the active project. For append and prepend, that fallback could create a phantom note. A cross-project resolver match could also flow into a patch scoped to the wrong project and expose an internal entity ID in the resulting error.

What changed

  • retain project ownership metadata from entity resolution
  • stop cross-project matches before mutation and return an actionable project_id retry
  • reject unresolved memory URL routes after the normal active-project compatibility lookup misses
  • preserve valid existing memory URL path edits
  • return structured JSON errors for both safe-stop cases
  • add regressions proving no phantom file is created and no cross-project patch is attempted

Verification

  • just fast-check
  • just fast-test
  • uv run pytest -q --no-cov tests/mcp/clients/test_clients.py tests/mcp/test_tool_edit_note.py tests/mcp/test_project_context.py (166 passed)
  • just doctor

Risk

The routing behavior changes only after a memory URL project prefix fails to resolve and the identifier also misses in the selected project. Existing indexed memory URL paths continue through the prior compatibility fallback.

Closes #1066

Signed-off-by: phernandez <paul@basicmachines.co>
@phernandez
phernandez merged commit 00e977d into main Jul 16, 2026
24 checks passed
@phernandez
phernandez deleted the codex/1066-safe-memory-url-edit-routing branch July 16, 2026 06:16
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.

[BUG] edit_note with memory:// URL silently creates phantom notes instead of routing to the target project

1 participant