mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-02 22:52:58 +00:00
fix(app): refresh History after unarchiving an agent
History reused a cached archived snapshot on every visit because the global query defaults disable mount refetches. Fetch the saved pages when History opens so a completed Unarchive appears without restarting. Co-authored-by: siyxo <siyxo511@outlook.com>
This commit is contained in:
@@ -2,7 +2,8 @@ import { mkdtempSync, realpathSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import path from "node:path";
|
||||
import { test, expect } from "../support/fixtures";
|
||||
import { openSessions } from "../support/helpers/archive-tab";
|
||||
import type { Page } from "@playwright/test";
|
||||
import { closeWorkspaceAgentTab, openSessions } from "../support/helpers/archive-tab";
|
||||
import {
|
||||
assertChatTranscript,
|
||||
cleanupRewindFlow,
|
||||
@@ -31,6 +32,15 @@ async function historyContainsAgent(client: SeedDaemonClient, agentId: string):
|
||||
return history.entries.some((entry) => entry.agent.id === agentId);
|
||||
}
|
||||
|
||||
async function closeAgentTab(page: Page, agentId: string): Promise<void> {
|
||||
await page
|
||||
.getByTestId(`workspace-tab-agent_${agentId}`)
|
||||
.filter({ visible: true })
|
||||
.first()
|
||||
.hover();
|
||||
await closeWorkspaceAgentTab(page, agentId);
|
||||
}
|
||||
|
||||
test.describe("archived Codex agent recovery", () => {
|
||||
test.setTimeout(600_000);
|
||||
|
||||
@@ -112,4 +122,38 @@ test.describe("archived Codex agent recovery", () => {
|
||||
await cleanupRewindFlow({ handle, cwd });
|
||||
}
|
||||
});
|
||||
|
||||
test("refreshes cached History after unarchiving without restarting", async ({ page }) => {
|
||||
const cwd = realpathSync(mkdtempSync(path.join(tmpdir(), "paseo-unarchive-history-")));
|
||||
let handle: AgentHandle | undefined;
|
||||
try {
|
||||
handle = await launchAgent({
|
||||
page,
|
||||
provider: "codex",
|
||||
providerConfig: { model: "gpt-5.6-sol" },
|
||||
cwd,
|
||||
mode: "full-access",
|
||||
});
|
||||
await sendMessage(handle, INITIAL_PROMPT);
|
||||
await assertChatTranscript(handle, [
|
||||
{ role: "user", text: INITIAL_PROMPT },
|
||||
{ role: "assistant", text: INITIAL_REPLY },
|
||||
]);
|
||||
await closeAgentTab(page, handle.agentId);
|
||||
await openSessions(page);
|
||||
const row = page.getByTestId(`agent-row-${getServerId()}-${handle.agentId}`);
|
||||
await expect(row.getByText("Archived", { exact: true })).toBeVisible();
|
||||
await row.click();
|
||||
await page.getByRole("button", { name: "Unarchive", exact: true }).click();
|
||||
await expect(page.getByRole("textbox", { name: "Message agent..." })).toBeVisible({
|
||||
timeout: 60_000,
|
||||
});
|
||||
await openSessions(page);
|
||||
await expect(row.getByText("Archived", { exact: true })).toHaveCount(0);
|
||||
await row.click();
|
||||
await expect(page.getByRole("textbox", { name: "Message agent..." })).toBeEditable();
|
||||
} finally {
|
||||
await cleanupRewindFlow({ handle, cwd });
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -296,6 +296,7 @@ export function useAgentHistory(options: {
|
||||
queryKey,
|
||||
enabled: Boolean(enabled && targetHosts.length > 0),
|
||||
staleTime: 30_000,
|
||||
refetchOnMount: "always",
|
||||
initialPageParam: null,
|
||||
getNextPageParam: getNextAgentHistoryPageParam,
|
||||
queryFn: async ({ pageParam }) => {
|
||||
|
||||
Reference in New Issue
Block a user