Skip to content

fix(mcp): surface cloud project delete errors and support delete_notes - #1062

Merged
phernandez merged 5 commits into
mainfrom
fix/1034-cloud-delete-surfacing
Jul 15, 2026
Merged

fix(mcp): surface cloud project delete errors and support delete_notes#1062
phernandez merged 5 commits into
mainfrom
fix/1034-cloud-delete-surfacing

Conversation

@phernandez

Copy link
Copy Markdown
Member

Summary

Client-side half of #1034: deleting a large cloud project failed with a detail-free Error removing project: because httpx transport errors (e.g. ReadTimeout) often stringify to an empty string, and the MCP delete tool both lacked delete_notes and always claimed files remained "on disk".

Defect (a): transport errors re-raised unwrapped in call_* helpers

call_delete (and its siblings call_get/call_put/call_patch/call_post had the same gap) only wrapped HTTPStatusError in ToolError; transport errors escaped raw with often-empty messages. All five helpers now wrap httpx.TransportError (which includes httpx.TimeoutException) in a ToolError that always names the exception type. Timeout messages note that long-running operations (such as deleting a large project) may still be completing server-side and point at bm project list before retrying.

Defect (b): CLI printed a blank error

bm project remove rendered str(e), which is empty for httpx timeouts. It now renders str(e) or repr(e) so the error line is never blank.

Defect (c): MCP delete_project lacked delete_notes and misreported file state

The MCP tool now accepts delete_notes: bool = False and passes it through to the typed ProjectClient (which, like the CLI, already supported it). The result text now reflects reality: local vs cloud file location (mirroring get_client routing) and deleted vs retained note files, instead of unconditionally printing "Files remain on disk". The LLM-facing docstring was updated to match.

Tests

  • tests/mcp/test_tool_utils.py: parametrized over all five call_* helpers via real httpx.MockTransport code paths — timeout wrapping (blank str()), connect-error wrapping, and non-transport errors still passing through unwrapped.
  • tests/mcp/test_tool_project_management.py: real create/delete flow asserting delete_notes=True removes the project directory on disk and delete_notes=False retains it; cloud-routed delete asserts the delete_notes passthrough and "cloud storage" wording; unit test for explicit-routing-flag handling.
  • tests/cli/test_project_remove_errors.py (new): bm project remove renders repr() for blank-message exceptions and str() otherwise.
  • tests/mcp/test_client_telemetry.py / test_tool_contracts.py: updated for the new wrapping and tool signature.

ruff check, ruff format, and just typecheck pass; 69 tests across the touched files pass, plus full tests/mcp + tests/cli runs.

Notes

The server-side half (purging large cloud projects without timing out) is tracked in the cloud repo.

Refs #1034 (server half remains)

🤖 Generated with Claude Code

Large cloud-project deletes could fail with a detail-free
"Error removing project:" because httpx transport errors often
stringify to an empty string. Client-side fixes for #1034:

- call_get/call_put/call_patch/call_post/call_delete now wrap
  httpx.TransportError (including TimeoutException) in a ToolError
  with an actionable message that names the failure type; timeouts
  note the operation may still be completing server-side and point
  at `bm project list`.
- `bm project remove` renders `str(e) or repr(e)` so the CLI never
  prints a blank error.
- MCP delete_project gains a `delete_notes: bool = False` parameter
  (passed through to the typed ProjectClient, matching the CLI), and
  the result text now reflects reality: local vs cloud file location
  and deleted vs retained notes, instead of unconditionally claiming
  "Files remain on disk".

The server-side purge half of #1034 is tracked in the cloud repo.

Refs #1034

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: phernandez <paul@basicmachines.co>
@phernandez

Copy link
Copy Markdown
Member Author

@codex review

recheck

@phernandez
phernandez force-pushed the fix/1034-cloud-delete-surfacing branch from 4a39693 to 29a43a2 Compare July 15, 2026 04:43
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: 29a43a2b98

ℹ️ 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".

Signed-off-by: phernandez <paul@basicmachines.co>
@phernandez

Copy link
Copy Markdown
Member Author

The integration matrix failures were all the same stale retained-files assertion. I updated it to the intentional new message and verified the full MCP project-management integration file (18 passed), Ruff, formatting, and git diff checks. @codex review\n\n/recheck

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

Copy link
Copy Markdown

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: 242a4a2331

ℹ️ 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".

Comment thread src/basic_memory/mcp/tools/project_management.py Outdated
Signed-off-by: phernandez <paul@basicmachines.co>
@phernandez

Copy link
Copy Markdown
Member Author

@codex review

/recheck

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

Copy link
Copy Markdown

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: b2aca7bb87

ℹ️ 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".

Comment thread src/basic_memory/mcp/tools/project_management.py Outdated
Signed-off-by: phernandez <paul@basicmachines.co>
@phernandez

Copy link
Copy Markdown
Member Author

@codex review
/recheck

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

Copy link
Copy Markdown

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: 359df9f993

ℹ️ 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".

Comment thread src/basic_memory/mcp/tools/project_management.py Outdated
Signed-off-by: phernandez <paul@basicmachines.co>
@phernandez

Copy link
Copy Markdown
Member Author

/recheck

@phernandez

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 712693b45f

ℹ️ 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".

@phernandez
phernandez merged commit ceb928a into main Jul 15, 2026
25 checks passed
@phernandez
phernandez deleted the fix/1034-cloud-delete-surfacing branch July 15, 2026 06:12
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