From 354165964f5e615a9494b2dde1f63fa497fe9fe6 Mon Sep 17 00:00:00 2001 From: Mohamed Boudra Date: Mon, 9 Nov 2026 16:25:09 +0100 Subject: [PATCH] fix(app): show a compact subagent's tab when focus promotes its sheet navigateToAgent stops at the sheet, so nothing closed an Explorer panel covering the promoted tab and focus() timed out. The promoted tab now goes through the same reveal as any other navigated tab. --- .../app/e2e/browser/plugin-composers-by-reference.spec.ts | 1 + .../app/e2e/support/helpers/plugin-composers-by-reference.ts | 5 +++++ packages/app/src/utils/navigate-to-agent/index.ts | 3 ++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/app/e2e/browser/plugin-composers-by-reference.spec.ts b/packages/app/e2e/browser/plugin-composers-by-reference.spec.ts index 520d355655..1138fab09a 100644 --- a/packages/app/e2e/browser/plugin-composers-by-reference.spec.ts +++ b/packages/app/e2e/browser/plugin-composers-by-reference.spec.ts @@ -122,6 +122,7 @@ test("focus opens a compact subagent as a tab with its composer", async ({ page test.setTimeout(120_000); await withPluginFocusingASubagent(page, async (author) => { await author.openParentAgent(); + await author.openExplorer(); await author.focusSubagent(); await author.expectSubagentTabReadyToType(); }); diff --git a/packages/app/e2e/support/helpers/plugin-composers-by-reference.ts b/packages/app/e2e/support/helpers/plugin-composers-by-reference.ts index 91fe96a381..70f9b3f531 100644 --- a/packages/app/e2e/support/helpers/plugin-composers-by-reference.ts +++ b/packages/app/e2e/support/helpers/plugin-composers-by-reference.ts @@ -472,6 +472,7 @@ export async function withPluginFocusingASubagent( page: Page, run: (author: { openParentAgent(): Promise; + openExplorer(): Promise; focusSubagent(): Promise; expectSubagentTabReadyToType(): Promise; }) => Promise, @@ -514,6 +515,10 @@ export async function withPluginFocusingASubagent( await expectOpenTabCount(page, 1); await page.waitForFunction(() => (globalThis as FocusAgentGlobal).focusAgent); }), + openExplorer: () => + test.step("open the Explorer over the parent's composer", async () => { + await expect(await ensureExplorerSidebar(page)).toBeVisible(); + }), focusSubagent: () => test.step("focus the subagent, which has no tab", async () => { const result = await page.evaluate( diff --git a/packages/app/src/utils/navigate-to-agent/index.ts b/packages/app/src/utils/navigate-to-agent/index.ts index fddcc4ea3f..5a22ca361c 100644 --- a/packages/app/src/utils/navigate-to-agent/index.ts +++ b/packages/app/src/utils/navigate-to-agent/index.ts @@ -4,6 +4,7 @@ import { useSessionStore } from "@/stores/session-store"; import { useWorkspaceLayoutStore } from "@/stores/workspace-layout-store"; import { normalizeWorkspaceOpaqueId } from "@/utils/workspace-identity"; import { buildWorkspaceTabPersistenceKey } from "@/workspace-tabs/model"; +import { revealWorkspaceTab } from "@/workspace-tabs/navigation"; import { resolveNavigateToAgent, type NavigateToAgentInput } from "./resolve"; export type { NavigateToAgentInput } from "./resolve"; @@ -43,5 +44,5 @@ export function navigateToAgentComposer(input: NavigateToAgentInput): void { const sheet = layout.sheetsByWorkspace[workspaceKey]?.find( ({ tab }) => tab.target.kind === "agent" && tab.target.agentId === input.agentId, ); - if (sheet) layout.openTabInFront(workspaceKey, sheet); + if (sheet) revealWorkspaceTab(workspaceKey, layout.openTabInFront(workspaceKey, sheet)); }