fix: route local project ids before cloud lookup#835
Conversation
|
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3b23f4cea5
ℹ️ 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".
| active_project = await get_active_project( | ||
| client, | ||
| canonical_project_id, | ||
| None, | ||
| ) |
There was a problem hiding this comment.
Respect env-constrained project when probing local project_id
The new local project_id probe bypasses the previously resolved project constraint and re-validates the raw UUID via get_active_project(..., canonical_project_id, None). Because resolve_project_parameter() is supposed to honor BASIC_MEMORY_MCP_PROJECT with highest priority, this branch can route to a different local project whenever that env var is set and a caller still passes project_id, causing tools to operate on the wrong project. This is a correctness/data-isolation regression introduced by the new early-return path.
Useful? React with 👍 / 👎.
Summary
project_idUUIDs through local ASGI before falling back to cloud workspace discovery in mixed local+cloud configs.project_idrouting when cloud credentials are configured.Fixes #834
Test plan
uv run pytest tests/mcp/test_project_context.py::test_get_project_client_with_project_id_routes_locally_with_cloud_credentials -q(failed before the fix)uv run pytest tests/mcp/test_project_context.py -quv run ruff check src/basic_memory/mcp/project_context.py tests/mcp/test_project_context.pyuv run ruff format --check src/basic_memory/mcp/project_context.py tests/mcp/test_project_context.pyuv run ty check src/basic_memory/mcp/project_context.py tests/mcp/test_project_context.pygit diff --check