Skip to content

fix(mcp): skip conversation link when conversation_id is None#12941

Merged
malhotra5 merged 2 commits intoOpenHands:mainfrom
machov:fix/OpenHands-12832-broken-conversation-link
Feb 19, 2026
Merged

fix(mcp): skip conversation link when conversation_id is None#12941
malhotra5 merged 2 commits intoOpenHands:mainfrom
machov:fix/OpenHands-12832-broken-conversation-link

Conversation

@machov
Copy link
Copy Markdown
Contributor

@machov machov commented Feb 19, 2026

Fixes #12832

When PRs are created via MCP tools without a valid conversation context (e.g., from external MCP clients or contexts where X-OpenHands-ServerConversation-ID header is missing), the conversation_id can be None. This results in broken links pointing to /conversations/None in PR descriptions.

Changes

  • openhands/server/routes/mcp.py: Added an early return in get_conversation_link when conversation_id is None or empty, and updated the type hint to str | None.
  • tests/unit/server/routes/test_mcp_routes.py: Added test covering both None and empty string conversation_id cases, verifying the body is returned unchanged and get_user is never called.

When PRs are created via MCP tools without a valid conversation context,
the conversation_id can be None, resulting in broken links pointing to
/conversations/None in PR descriptions.

This adds an early return in get_conversation_link when conversation_id
is None or empty, preventing the broken link from being appended.

Fixes OpenHands#12832

Signed-off-by: machov <mv1742@nyu.edu>
Copy link
Copy Markdown
Collaborator

@all-hands-bot all-hands-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clean fix! The early return properly handles the edge case, type hints are correct, and the test coverage is thorough.

Copy link
Copy Markdown
Collaborator

@malhotra5 malhotra5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thank you!

@malhotra5 malhotra5 enabled auto-merge (squash) February 19, 2026 21:28
@malhotra5 malhotra5 merged commit 3fc977e into OpenHands:main Feb 19, 2026
24 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Broken 'continue refining the PR' links with conversations/None in PR descriptions

3 participants