Skip to content

Commit 6605269

Browse files
authored
[Fix]: make sure to track opened PRs using Git MCP (OpenHands#8949)
1 parent fac0d59 commit 6605269

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

openhands/mcp/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ async def connect_http(
7373
)
7474

7575
if conversation_id:
76-
headers['X-OpenHands-Conversation-ID'] = conversation_id
76+
headers['X-OpenHands-ServerConversation-ID'] = conversation_id
7777

7878
# Instantiate custom transports due to custom headers
7979
if isinstance(server, MCPSHTTPServerConfig):

openhands/server/routes/mcp.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ async def get_convo_link(service: GitService, conversation_id: str, body: str) -
4949

5050

5151
async def save_pr_metadata(
52-
user_id: str, conversation_id: str, tool_result: str
52+
user_id: str | None, conversation_id: str, tool_result: str
5353
) -> None:
5454
conversation_store = await ConversationStoreImpl.get_instance(config, user_id)
5555
conversation: ConversationMetadata = await conversation_store.get_metadata(
@@ -70,7 +70,11 @@ async def save_pr_metadata(
7070
pr_number = int(match_merge_request.group(1))
7171

7272
if pr_number:
73+
logger.info(f'Saving PR number: {pr_number} for convo {conversation_id}')
7374
conversation.pr_number.append(pr_number)
75+
else:
76+
logger.warning(f'Failed to extract PR number for convo {conversation_id}')
77+
7478
await conversation_store.save_metadata(conversation)
7579

7680

@@ -124,7 +128,7 @@ async def create_pr(
124128
body=body,
125129
)
126130

127-
if conversation_id and user_id:
131+
if conversation_id:
128132
await save_pr_metadata(user_id, conversation_id, response)
129133

130134
except Exception as e:

0 commit comments

Comments
 (0)