fix(app): keep agent history visible during catch-up
Visibility catch-up could select the blocking overlay after optimistic continuity cleared, even though history was already hydrated. Keep hydrated content non-blocking and cover the creation handoff with a browser regression test.
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import { test, expect } from "./fixtures";
|
import { test, expect } from "./fixtures";
|
||||||
import { expectComposerVisible, submitMessage } from "./helpers/composer";
|
import { expectComposerVisible, submitMessage } from "./helpers/composer";
|
||||||
|
import { delayCreatedAgentInitialTailResponse } from "./helpers/agent-timeline-gate";
|
||||||
import { delayBrowserAgentCreatedStatus } from "./helpers/new-workspace";
|
import { delayBrowserAgentCreatedStatus } from "./helpers/new-workspace";
|
||||||
import { seedWorkspace, type SeedDaemonClient } from "./helpers/seed-client";
|
import { seedWorkspace, type SeedDaemonClient } from "./helpers/seed-client";
|
||||||
import { waitForWorkspaceTabsVisible } from "./helpers/workspace-tabs";
|
import { waitForWorkspaceTabsVisible } from "./helpers/workspace-tabs";
|
||||||
@@ -43,6 +44,49 @@ async function fetchActiveAgentTitle(
|
|||||||
}
|
}
|
||||||
|
|
||||||
test.describe("Workspace agent title handoff", () => {
|
test.describe("Workspace agent title handoff", () => {
|
||||||
|
test("does not cover the agent pane while the optimistic create becomes authoritative", async ({
|
||||||
|
page,
|
||||||
|
}) => {
|
||||||
|
test.setTimeout(120_000);
|
||||||
|
await page.setViewportSize({ width: 1440, height: 900 });
|
||||||
|
|
||||||
|
const timelineGate = await delayCreatedAgentInitialTailResponse(page);
|
||||||
|
const workspace = await seedWorkspace({ repoPrefix: "workspace-create-handoff-flash-" });
|
||||||
|
|
||||||
|
try {
|
||||||
|
await page.goto(buildHostWorkspaceRoute(getServerId(), workspace.workspaceId));
|
||||||
|
await waitForWorkspaceTabsVisible(page);
|
||||||
|
await page.getByTestId("workspace-new-agent-tab-inline").click();
|
||||||
|
await expectComposerVisible(page);
|
||||||
|
|
||||||
|
const prompt = "Keep the optimistic agent pane visible during handoff";
|
||||||
|
await submitMessage(page, prompt);
|
||||||
|
const agentId = await timelineGate.waitForCreatedAgent();
|
||||||
|
await timelineGate.waitForDelayedResponse();
|
||||||
|
|
||||||
|
await expect(page.getByTestId(`workspace-tab-agent_${agentId}`).first()).toBeVisible({
|
||||||
|
timeout: 15_000,
|
||||||
|
});
|
||||||
|
await expect(page.getByText(prompt, { exact: true }).first()).toBeVisible();
|
||||||
|
await expect(page.getByTestId("agent-history-overlay")).toHaveCount(0);
|
||||||
|
|
||||||
|
const overlayAppeared = page
|
||||||
|
.getByTestId("agent-history-overlay")
|
||||||
|
.waitFor({ state: "attached", timeout: 2_000 })
|
||||||
|
.then(
|
||||||
|
() => true,
|
||||||
|
() => false,
|
||||||
|
);
|
||||||
|
timelineGate.release();
|
||||||
|
await timelineGate.waitForForwardedResponse();
|
||||||
|
|
||||||
|
expect(await overlayAppeared).toBe(false);
|
||||||
|
} finally {
|
||||||
|
timelineGate.release();
|
||||||
|
await workspace.cleanup();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
test("shows the prompt tab title and replaces it when the daemon title updates", async ({
|
test("shows the prompt tab title and replaces it when the daemon title updates", async ({
|
||||||
page,
|
page,
|
||||||
}) => {
|
}) => {
|
||||||
|
|||||||
@@ -209,7 +209,7 @@ describe("deriveAgentScreenViewState", () => {
|
|||||||
expect(sync.ui).toBe("silent");
|
expect(sync.ui).toBe("silent");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("covers already-hydrated history while a newly visible agent catches up", () => {
|
it("keeps already-hydrated history visible while a newly visible agent catches up", () => {
|
||||||
const memory = createBaseMemory({
|
const memory = createBaseMemory({
|
||||||
hasRenderedReady: true,
|
hasRenderedReady: true,
|
||||||
lastReadyAgent: createAgent("agent-1"),
|
lastReadyAgent: createAgent("agent-1"),
|
||||||
@@ -225,7 +225,7 @@ describe("deriveAgentScreenViewState", () => {
|
|||||||
const ready = expectReadyState(result.state);
|
const ready = expectReadyState(result.state);
|
||||||
const sync = expectCatchingUpSync(ready);
|
const sync = expectCatchingUpSync(ready);
|
||||||
|
|
||||||
expect(sync.ui).toBe("overlay");
|
expect(sync.ui).toBe("silent");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("keeps hydrated history readable after a visibility catch-up error", () => {
|
it("keeps hydrated history readable after a visibility catch-up error", () => {
|
||||||
|
|||||||
@@ -150,13 +150,11 @@ function resolveCatchingUpUi(args: {
|
|||||||
hasOptimisticCreateContinuity: boolean;
|
hasOptimisticCreateContinuity: boolean;
|
||||||
isVisibilityCatchUpPending: boolean;
|
isVisibilityCatchUpPending: boolean;
|
||||||
hasHydratedHistoryBefore: boolean;
|
hasHydratedHistoryBefore: boolean;
|
||||||
needsAuthoritativeSync: boolean;
|
|
||||||
hadInitialSyncFailure: boolean;
|
hadInitialSyncFailure: boolean;
|
||||||
}): "overlay" | "silent" {
|
}): "overlay" | "silent" {
|
||||||
if (args.hasOptimisticCreateContinuity) return "silent";
|
if (args.hasOptimisticCreateContinuity) return "silent";
|
||||||
if (args.hasHydratedHistoryBefore && args.needsAuthoritativeSync) return "silent";
|
|
||||||
if (args.isVisibilityCatchUpPending) return "overlay";
|
|
||||||
if (args.hasHydratedHistoryBefore) return "silent";
|
if (args.hasHydratedHistoryBefore) return "silent";
|
||||||
|
if (args.isVisibilityCatchUpPending) return "overlay";
|
||||||
if (args.hadInitialSyncFailure) return "silent";
|
if (args.hadInitialSyncFailure) return "silent";
|
||||||
return "overlay";
|
return "overlay";
|
||||||
}
|
}
|
||||||
@@ -186,7 +184,6 @@ function resolveAgentScreenSync(args: {
|
|||||||
hasOptimisticCreateContinuity: hasOptimisticCreateContinuity(input),
|
hasOptimisticCreateContinuity: hasOptimisticCreateContinuity(input),
|
||||||
isVisibilityCatchUpPending: input.visibilityCatchUpStatus === "pending",
|
isVisibilityCatchUpPending: input.visibilityCatchUpStatus === "pending",
|
||||||
hasHydratedHistoryBefore: input.hasHydratedHistoryBefore,
|
hasHydratedHistoryBefore: input.hasHydratedHistoryBefore,
|
||||||
needsAuthoritativeSync: input.needsAuthoritativeSync,
|
|
||||||
hadInitialSyncFailure,
|
hadInitialSyncFailure,
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user