Skip to content

fix(mcp): report cloud projects as source=cloud in factory mode#752

Merged
jope-bm merged 2 commits into
mainfrom
fix-cloud-project-source-label
Apr 18, 2026
Merged

fix(mcp): report cloud projects as source=cloud in factory mode#752
jope-bm merged 2 commits into
mainfrom
fix-cloud-project-source-label

Conversation

@jope-bm
Copy link
Copy Markdown
Contributor

@jope-bm jope-bm commented Apr 17, 2026

Summary

  • Fix list_memory_projects reporting source: "local" for all projects when called via cloud MCP server
  • In factory mode, projects are now correctly passed as cloud_list (not local_list) to _merge_projects()
  • Workspace metadata (workspace_name, workspace_type, workspace_tenant_id) is resolved via the existing workspace provider

Test plan

  • Updated test_list_memory_projects_factory_mode to assert source: "cloud"
  • Added test_list_memory_projects_factory_mode_json_includes_workspace — verifies JSON output has workspace fields
  • Added test_list_memory_projects_factory_mode_workspace_lookup_failure — graceful degradation when workspace provider fails
  • Added test_list_memory_projects_factory_mode_explicit_workspace — explicit workspace param selects correct workspace
  • All 21 tests pass

🤖 Generated with Claude Code

In factory mode (cloud MCP server), list_memory_projects passed
cloud-fetched projects as local_list to _merge_projects(), causing
all projects to report source="local" with no cloud metadata.

Fix passes projects as cloud_list and resolves workspace metadata
via the workspace provider, so cloud MCP clients see correct source
labels and workspace info.

Fixes basicmachines-co/basic-memory-cloud#479

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Joe P <joe@basicmemory.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 16304569bc

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +218 to +220
if workspace:
matched = next((ws for ws in workspaces if ws.tenant_id == workspace), None)
if matched is None:
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Honor workspace when fetching factory-mode project list

When workspace is provided in factory mode, this branch only uses it to pick metadata (matched) but the project fetch above still runs through get_client() without a workspace override, so the returned projects can come from the connection/default workspace while being labeled with a different workspace’s metadata. This mismatch is observable for users who can access multiple workspaces and can lead clients to act on the wrong project set; pass the same workspace into the factory client request (or avoid applying workspace metadata unless the fetch was scoped).

Useful? React with 👍 / 👎.

Pass the workspace param through to get_client() in factory mode so
the fetched projects match the workspace metadata. Also fix pyright
type errors in tests (missing isinstance assertion, missing
organization_id param).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Joe P <joe@basicmemory.com>
@jope-bm jope-bm merged commit 56d6f1b into main Apr 18, 2026
40 of 42 checks passed
@jope-bm jope-bm deleted the fix-cloud-project-source-label branch April 18, 2026 17:10
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.

1 participant