fix(conversations): OHE-3432 return an Agent Canvas link in the API - #606
Merged
Merged
Conversation
AppConversation responses now carry conversation_ui_url, the browser link that opens the conversation at /canvas/conversations/<id>. Agents that delegate to a sub-agent read the conversation back from the API and can share this link instead of hand-building the legacy /conversations/<id> route. Co-authored-by: openhands <openhands@all-hands.dev>
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||||||||
2 of 6 tasks
saurya
approved these changes
Oct 2, 2026
Contributor
|
🚀 Released in 1.68.0. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
HUMAN:
Manually verified this, along with OpenHands/OpenHands#17842 and OpenHands/extensions#714, produced the correct, canvas conversation link when for a sub agent delegated conversation.
AGENT:
Why
When an agent hands work to a sub-agent through
POST /api/v1/app-conversations, the link it gives the user opens the legacy UI at/conversations/<id>, not Agent Canvas. The API gives the agent no browser link to use. The only URL on the conversation record isconversation_url, which points at the sandbox's agent-server API. So agents build the link themselves from theopenhands-apiskill, which uses the legacy route.Summary
AppConversationhas a newconversation_ui_urlfield:<web_url>/canvas/conversations/<id>. It isNonewhen no web URL is configured. It is filled in inside_build_conversation, which every endpoint that returns a conversation goes through, includingGET /api/v1/app-conversations?ids=.web_url. With no web URL configured, the service's value falls back to ahost.docker.internaladdress that only sandboxes can reach./canvas/conversations/.Issue Number
Refs #598 (OHE-3432). This is the backend part only; see Notes.
How to Test
uv run pytest tests/unit/app_server/test_conversation_ui_url.py. There are four tests. They were written first and failed with the field missing; they pass now. The main one saves a conversation to the Postgres test database the way an API-started delegation stores it, reads it back throughbatch_get_app_conversations, and checks for the Canvas link.uv run pytest tests/unit/app_server/test_live_status_app_conversation_service.py: 213 passed.tests/unit/app_serverandtests/unit/server/routes: everything passes except 17 quota tests. Those return 401 because the sandbox setsSESSION_API_KEY; they fail the same way onmainand pass with it unset.GET /api/v1/app-conversations?ids=<id>should returnconversation_ui_urlpointing at/canvas/conversations/<id>.Video/Screenshots
None. The change only adds an API field.
Type
Notes
Follow-ups outside this repo:
openhands-apiskill (OpenHands/extensions): shareconversation_ui_url, fall back to<HOST>/canvas/conversations/<id>on older servers, and drop the hardcodedapp.all-hands.dev.launchCloudChildinsrc/services/child-conversation-launch.tsalso returns the legacy/conversations/<id>link for Cloud child conversations.This PR does not set
parent_conversation_idfor delegated conversations. That field makes the child share the parent's sandbox, hides it from/search(Canvas never asks for sub-conversations), and deletes it along with the parent.This PR was drafted by an AI agent on behalf of the user.
@lilagrc can click here to continue refining the PR
Enterprise server image for this PR: