Fix conversation URL format in pull request links (#9143)

This commit is contained in:
Graham Neubig 2025-06-15 15:41:08 -04:00 committed by GitHub
parent e5bff91e8e
commit 2d2ccf1329
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 5 deletions

View File

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

View File

@ -40,7 +40,10 @@ async def test_get_convo_link_saas_mode():
# Test with SAAS mode
with (
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 body
with (
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