Skip to content

Contact cloud only when config enables it; discovery ConnectTimeout stalls list_memory_projects #1810

Closed

Description

@phernandez

Found during live testing of main at 0276799 (2026-10-22).

Problem

list_memory_projects took about 12.5s in local mode. It lists local projects first, then calls GET /workspaces/ on https://cloud.basicmemory.com because has_cloud_credentials(config) is true (an OAuth token exists and BASIC_MEMORY_API_KEY is set). That connect did not finish within the 10s connect timeout from _build_timeout(), so the tool fell back to the local list:

18:42:14.726 Creating HTTP client for cloud control plane at: https://cloud.basicmemory.com
18:42:27.250 WARNING Cloud workspace project index discovery failed while listing projects;
  showing local-only project list: Request timed out (ConnectTimeout): the server did not
  respond to GET '' in time. Long-running operations (such as deleting a large project)
  may still be completing server-side ...

The failure was transient. The same discovery took 0.52s four minutes later.

Proposed behavior

Contact cloud only when the config enables cloud, not because credentials happen to exist. A stored OAuth token or an API key in the environment should not make local-only tool calls depend on cloud reachability. Cloud counts as enabled when, for example, a project has mode: cloud, cloud mode is on, or a workspace is configured. Pick one definition and use it everywhere has_cloud_credentials currently gates discovery: list_memory_projects, project resolution, and the unknown-project error path.

Also fix

  • The timeout message prints GET ''. _format_request_error in src/basic_memory/mcp/tools/utils.py uses url.split("/")[-1], which is empty for /workspaces/.
  • The same message suggests checking on a large project delete, which has nothing to do with a project list.
  • When cloud is enabled, optional discovery should use a short connect timeout so an unreachable cloud does not stall listing for 10s or more.

Activity

  1. added
    bug
    on Oct 23, 2026
  2. claude commented on Oct 23, 2026

    @claude
    Contributor

    Claude finished @phernandez's task in 18s —— View job


    Triage

    • Type: Bug (labeled bug, cloud)
    • Component: MCP tools (list_memory_projects, project resolution), with cloud discovery behavior as the trigger
    • Priority: Medium. A transient cloud timeout makes a local-only call take 10s or more. Nothing is lost or broken, but any user with a stored OAuth token or BASIC_MEMORY_API_KEY is exposed to it.
    • Complexity: Medium. Three changes are involved:
      1. Replace has_cloud_credentials(config) as the discovery gate with a single "cloud enabled by config" predicate. Apply it in list_memory_projects, project resolution and the unknown-project error path.
      2. Fix _format_request_error in mcp/tools/utils.py. url.split("/")[-1] is empty for /workspaces/, so the message prints GET ''. The large-project-delete hint should also not appear on unrelated requests.
      3. Give optional discovery a short connect timeout when cloud is enabled.

    Duplicates: I found none. #834, #836 and #954 are closed and cover related routing problems. They are not about this credential gating or the discovery timeout.

    Notes on the proposal:

    • The definition of "cloud enabled" (any project with mode: cloud, global cloud mode, or a configured workspace) needs to be one shared helper. It should have tests for each of the three triggers and for the credentials-only case, where no cloud call should be made.
    • Check that users who rely on API-key-only cloud access without mode: cloud still get workspace discovery, if that flow is supported.
    • Both timeout paths (enabled and unreachable, and the message formatting) need regression tests to hold the 100% coverage requirement.

    Triage only, so I made no code changes.

  3. added
    cloud
    on Oct 23, 2026
  4. added a commit that references this issue on Nov 13, 2026
    3e8a519
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcloud

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions