@@ -205,6 +205,43 @@ async def resolve_workspace_identifier(identifier, context=None):
205205 assert detected == "team-acme/research"
206206
207207
208+ @pytest .mark .asyncio
209+ @pytest .mark .parametrize (
210+ "message" ,
211+ [
212+ "Workspace 'team-acme' was not found." ,
213+ "No accessible workspaces found for this account." ,
214+ "Unable to discover projects in any accessible workspace. Failed workspaces: team-acme" ,
215+ ],
216+ )
217+ async def test_workspace_identifier_project_detection_ignores_discovery_failures (
218+ monkeypatch ,
219+ config_manager ,
220+ message ,
221+ ):
222+ """Workspace detection should fall back when cloud discovery is unavailable."""
223+ from basic_memory .services import link_resolver
224+
225+ async def fail_workspace_identifier (identifier , context = None ):
226+ raise ValueError (message )
227+
228+ monkeypatch .setattr (
229+ "basic_memory.mcp.project_context._workspace_identifier_discovery_available" ,
230+ lambda identifier , config : True ,
231+ )
232+ monkeypatch .setattr (
233+ "basic_memory.mcp.project_context.resolve_workspace_qualified_identifier" ,
234+ fail_workspace_identifier ,
235+ )
236+
237+ detected = await link_resolver .detect_project_from_workspace_identifier_prefix (
238+ "team-acme/research/note" ,
239+ config_manager .config ,
240+ )
241+
242+ assert detected is None
243+
244+
208245@pytest .mark .asyncio
209246async def test_workspace_identifier_project_detection_allows_mixed_local_cloud_config (
210247 monkeypatch ,
0 commit comments