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.
This commit is contained in:
Mohamed Boudra
2026-11-09 16:25:09 +01:00
parent 80462a44d8
commit 354165964f
3 changed files with 8 additions and 1 deletions
@@ -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();
});
@@ -472,6 +472,7 @@ export async function withPluginFocusingASubagent(
page: Page,
run: (author: {
openParentAgent(): Promise<void>;
openExplorer(): Promise<void>;
focusSubagent(): Promise<void>;
expectSubagentTabReadyToType(): Promise<void>;
}) => Promise<void>,
@@ -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(
@@ -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));
}