π OpenHands: AI-Driven Development
Fix conversation URL format in pull request links (#9143)
Graham Neubig2d2ccf1329f4
diff --git a/openhands/server/routes/mcp.py b/openhands/server/routes/mcp.pyindex 606a3c7d48..62f0854b79 100644--- a/openhands/server/routes/mcp.py+++ b/openhands/server/routes/mcp.py@@ -27,7 +27,7 @@ mcp_server = FastMCP()HOST = f'https://{os.getenv("WEB_HOST", "app.all-hands.dev").strip()}'-CONVO_URL = HOST + '/{}'+CONVO_URL = HOST + '/conversations/{}'async def get_convo_link(service: GitService, conversation_id: str, body: str) -> str:diff --git a/tests/unit/test_mcp_routes.py b/tests/unit/test_mcp_routes.pyindex 7721d1678b..9d32984277 100644--- a/tests/unit/test_mcp_routes.py+++ b/tests/unit/test_mcp_routes.py@@ -40,7 +40,10 @@ async def test_get_convo_link_saas_mode():# Test with SAAS modewith (patch('openhands.server.routes.mcp.server_config') as mock_config,- patch('openhands.server.routes.mcp.CONVO_URL', 'https://test.example.com/{}'),+ patch(+ 'openhands.server.routes.mcp.CONVO_URL',+ 'https://test.example.com/conversations/{}',+ ),):mock_config.app_mode = AppMode.SAAS@@ -50,7 +53,7 @@ async def test_get_convo_link_saas_mode():)# Verify the result- expected_link = '@testuser can click here to [continue refining the PR](https://test.example.com/test-convo-id)'+ expected_link = '@testuser can click here to [continue refining the PR](https://test.example.com/conversations/test-convo-id)'assert result == f'Original body\n\n{expected_link}'# Verify that get_user was called@@ -69,7 +72,10 @@ async def test_get_convo_link_empty_body():# Test with SAAS mode and empty bodywith (patch('openhands.server.routes.mcp.server_config') as mock_config,- patch('openhands.server.routes.mcp.CONVO_URL', 'https://test.example.com/{}'),+ patch(+ 'openhands.server.routes.mcp.CONVO_URL',+ 'https://test.example.com/conversations/{}',+ ),):mock_config.app_mode = AppMode.SAAS@@ -79,7 +85,7 @@ async def test_get_convo_link_empty_body():)# Verify the result- expected_link = '@testuser can click here to [continue refining the PR](https://test.example.com/test-convo-id)'+ expected_link = '@testuser can click here to [continue refining the PR](https://test.example.com/conversations/test-convo-id)'assert result == f'\n\n{expected_link}'# Verify that get_user was called