π OpenHands: AI-Driven Development
fix(child-conversations): link Cloud children to Agent Canvas (#17842)
Lila Garcia1ff45c267fe5
diff --git a/__tests__/services/child-conversation-launch.test.ts b/__tests__/services/child-conversation-launch.test.tsindex 12bd247d2b..42a33067b9 100644--- a/__tests__/services/child-conversation-launch.test.ts+++ b/__tests__/services/child-conversation-launch.test.ts@@ -532,12 +532,36 @@ describe("handleLaunchChildConversationAction", () => {status: "launched",target: "cloud",conversation_id: "cloud-child-id",- url: "https://app.all-hands.dev/conversations/cloud-child-id",+ url: "https://app.all-hands.dev/canvas/conversations/cloud-child-id",initial_status: "READY",parent_link: false,});});+ // Cloud and self-hosted Enterprise serve the legacy UI at the host root and+ // Agent Canvas under /canvas.+ it("links the child to the backend's Agent Canvas, not its legacy UI", async () => {+ mockPickCloudBackend.mockReturnValueOnce({+ ...cloudBackend,+ host: "https://openhands.example.com/",+ });+ mockCreateCloudAppConversation.mockResolvedValue({+ id: "start-task-id",+ app_conversation_id: "cloud-child-id",+ status: "READY",+ });++ await handleLaunchChildConversationAction(+ action({ target: "cloud" }),+ PARENT_ID,+ nextToolCallId(),+ );++ expect(reportedResult()).toMatchObject({+ url: "https://openhands.example.com/canvas/conversations/cloud-child-id",+ });+ });+it("guides the agent back to local when no cloud backend is connected", async () => {mockPickCloudBackend.mockReturnValueOnce(null);diff --git a/src/services/child-conversation-launch.ts b/src/services/child-conversation-launch.tsindex 287715981d..bd8e5ad548 100644--- a/src/services/child-conversation-launch.ts+++ b/src/services/child-conversation-launch.ts@@ -40,6 +40,9 @@ import {const CLOUD_START_POLL_INTERVAL_MS = 3_000;const CLOUD_START_POLL_TIMEOUT_MS = 180_000;+/** Cloud and self-hosted Enterprise serve Agent Canvas here; the host root is the legacy UI. */+const CLOUD_AGENT_CANVAS_BASE_PATH = "/canvas";+const LEDGER_STORAGE_KEY_PREFIX = "openhands-child-conversation-launches:";interface LaunchSuccess {@@ -458,7 +461,7 @@ async function launchCloudChild(target: "cloud",conversation_id: conversationId,url: conversationId- ? `${backend.host.replace(/\/$/, "")}/conversations/${conversationId}`+ ? `${backend.host.replace(/\/$/, "")}${CLOUD_AGENT_CANVAS_BASE_PATH}/conversations/${conversationId}`: null,initial_status: settled.status,title: params.title,