From 243a0615f106f3c9ae7cfc9d005cadfa43006dc6 Mon Sep 17 00:00:00 2001 From: mateo Date: Fri, 10 Jul 2026 04:31:14 +0000 Subject: [PATCH] fix(mcp): propagate draft deletion failures Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- basedpyright-code-budget.json | 8 ++++---- litellm/proxy/_experimental/mcp_server/db.py | 15 ++++++--------- ruff-strict-budget.json | 10 +++++----- .../mcp_server/test_db_draft_mcp_servers.py | 11 +++++++---- type-discipline-budget.json | 2 +- 5 files changed, 23 insertions(+), 23 deletions(-) diff --git a/basedpyright-code-budget.json b/basedpyright-code-budget.json index cb3427bed4d..27e6291f069 100644 --- a/basedpyright-code-budget.json +++ b/basedpyright-code-budget.json @@ -18,13 +18,13 @@ "limit": 59 }, "reportDeprecated": { - "limit": 326 + "limit": 323 }, "reportDuplicateImport": { "limit": 42 }, "reportExplicitAny": { - "limit": 10397 + "limit": 10395 }, "reportFunctionMemberAccess": { "limit": 11 @@ -111,7 +111,7 @@ "limit": 20418 }, "reportUnknownVariableType": { - "limit": 32151 + "limit": 32150 }, "reportUnnecessaryCast": { "limit": 177 @@ -123,7 +123,7 @@ "limit": 7 }, "reportUnnecessaryIsInstance": { - "limit": 1212 + "limit": 1211 }, "reportUntypedBaseClass": { "limit": 165 diff --git a/litellm/proxy/_experimental/mcp_server/db.py b/litellm/proxy/_experimental/mcp_server/db.py index 32f9eee1b82..08a1717bae2 100644 --- a/litellm/proxy/_experimental/mcp_server/db.py +++ b/litellm/proxy/_experimental/mcp_server/db.py @@ -694,15 +694,12 @@ async def _delete_draft_mcp_server( prisma_client: PrismaClient, server_id: str, ) -> None: - try: - await MCPServerRepository(prisma_client).table.delete_many( - where={ - "server_id": server_id, - "approval_status": MCPApprovalStatus.draft, - } - ) - except Exception: - pass + await MCPServerRepository(prisma_client).table.delete_many( + where={ + "server_id": server_id, + "approval_status": MCPApprovalStatus.draft, + } + ) async def delete_expired_draft_mcp_servers( diff --git a/ruff-strict-budget.json b/ruff-strict-budget.json index 7750ac6628a..035c6d0444a 100644 --- a/ruff-strict-budget.json +++ b/ruff-strict-budget.json @@ -60,7 +60,7 @@ "limit": 4 }, "BLE001": { - "limit": 2903 + "limit": 2898 }, "C401": { "limit": 11 @@ -90,7 +90,7 @@ "limit": 5 }, "DTZ003": { - "limit": 33 + "limit": 30 }, "DTZ005": { "limit": 244 @@ -225,7 +225,7 @@ "limit": 721 }, "RUF010": { - "limit": 874 + "limit": 869 }, "RUF012": { "limit": 168 @@ -324,7 +324,7 @@ "limit": 883 }, "UP006": { - "limit": 12869 + "limit": 12866 }, "UP007": { "limit": 2570 @@ -363,6 +363,6 @@ "limit": 105 }, "UP045": { - "limit": 18517 + "limit": 18516 } } diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_db_draft_mcp_servers.py b/tests/test_litellm/proxy/_experimental/mcp_server/test_db_draft_mcp_servers.py index ab5b6791bc9..58788f96fae 100644 --- a/tests/test_litellm/proxy/_experimental/mcp_server/test_db_draft_mcp_servers.py +++ b/tests/test_litellm/proxy/_experimental/mcp_server/test_db_draft_mcp_servers.py @@ -255,13 +255,16 @@ class TestDeleteDraftMcpServer: assert where["approval_status"] == MCPApprovalStatus.draft @pytest.mark.asyncio - async def test_swallows_exceptions(self): + async def test_propagates_delete_errors(self): repo_instance, mock_table = _mock_repo() mock_table.delete_many = AsyncMock(side_effect=Exception("db error")) prisma = MagicMock() - with patch( - "litellm.proxy._experimental.mcp_server.db.MCPServerRepository", - return_value=repo_instance, + with ( + patch( + "litellm.proxy._experimental.mcp_server.db.MCPServerRepository", + return_value=repo_instance, + ), + pytest.raises(Exception, match="db error"), ): await _delete_draft_mcp_server(prisma, "target-id") diff --git a/type-discipline-budget.json b/type-discipline-budget.json index 2c44ab5a049..ac43afb0906 100644 --- a/type-discipline-budget.json +++ b/type-discipline-budget.json @@ -1,6 +1,6 @@ { "LIT001": { - "limit": 23452 + "limit": 23449 }, "LIT002": { "limit": 27522