Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

fix(frontend): give every sidebar, popup and builder chat the main chat's cards (#15067)

Bently984f91324361
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/chat-surface-parity.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/chat-surface-parity.test.tsx
new file mode 100644
index 0000000000..eb3b4c808e
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/chat-surface-parity.test.tsx
@@ -0,0 +1,301 @@
+import { readdirSync, readFileSync, statSync } from "node:fs";
+import { join, relative } from "node:path";
+import { act, cleanup, render } from "@/tests/integrations/test-utils";
+import type { UIDataTypes, UIMessage, UITools } from "ai";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import { BuilderChatPanel } from "@/app/(platform)/build/components/BuilderChatPanel/BuilderChatPanel";
+import { useBuilderChatPanel } from "@/app/(platform)/build/components/BuilderChatPanel/useBuilderChatPanel";
+import { MemoryChatPanel } from "@/app/(platform)/settings/memory/components/MemoryChatPanel/MemoryChatPanel";
+import { ExpertChatDrawer } from "@/app/(platform)/team/components/ExpertChatDrawer/ExpertChatDrawer";
+import { useExpertChatDrawer } from "@/app/(platform)/team/components/ExpertChatDrawer/useExpertChatDrawer";
+import {
+ getGetV2GetPendingReviewsForChatSessionMockHandler,
+ getGetV2GetPendingReviewsForExecutionMockHandler,
+} from "@/app/api/__generated__/endpoints/executions/executions.msw";
+import { server } from "@/mocks/mock-server";
+import { ChatContainer } from "../components/ChatContainer/ChatContainer";
+import {
+ CARD_FIXTURES,
+ MAIN_CHAT_CARD_TYPES,
+ transcriptFor,
+} from "./chatSurfaceFixtures";
+
+vi.mock("@/app/(platform)/copilot/components/ChatInput/ChatInput", () => ({
+ ChatInput: () => <textarea aria-label="Chat input" />,
+}));
+
+vi.mock(
+ "@/app/(platform)/copilot/components/UsageLimits/useIsUsageLimitReached",
+ () => ({ useIsUsageLimitReached: () => false }),
+);
+
+vi.mock("@/services/feature-flags/use-get-flag", async (importActual) => ({
+ ...(await importActual<
+ typeof import("@/services/feature-flags/use-get-flag")
+ >()),
+ useGetFlag: () => false,
+}));
+
+vi.mock(
+ "@/app/(platform)/build/components/BuilderChatPanel/useBuilderChatPanel",
+ () => ({ useBuilderChatPanel: vi.fn() }),
+);
+
+vi.mock(
+ "@/app/(platform)/team/components/ExpertChatDrawer/useExpertChatDrawer",
+ () => ({ useExpertChatDrawer: vi.fn() }),
+);
+
+type Messages = UIMessage<unknown, UIDataTypes, UITools>[];
+
+const SESSION_ID = "parity-session";
+const SRC = join(__dirname, "..", "..", "..", "..");
+
+interface Surface {
+ name: string;
+ /** The host that renders ChatMessagesContainer, relative to src/. */
+ host: string;
+ mount: (messages: Messages) => void;
+}
+
+const MAIN: Surface = {
+ name: "main chat",
+ host: "app/(platform)/copilot/components/ChatContainer/ChatContainer.tsx",
+ mount: (messages) =>
+ render(
+ <ChatContainer
+ messages={messages}
+ status="ready"
+ error={undefined}
+ sessionId={SESSION_ID}
+ isLoadingSession={false}
+ isCreatingSession={false}
+ onCreateSession={vi.fn()}
+ onSend={vi.fn()}
+ onStop={vi.fn()}
+ />,
+ ),
+};
+
+/** Every chat that isn't the full-screen one. Each must render every card
+ * exactly as the main chat does. */
+const OTHER_SURFACES: Surface[] = [
+ {
+ name: "memory settings chat",
+ host: "app/(platform)/settings/memory/components/MemoryChatPanel/MemoryChatPanel.tsx",
+ mount: (messages) =>
+ render(
+ <MemoryChatPanel
+ scopeName="Otto"
+ isOpen
+ isStarting={false}
+ startError={false}
+ sessionId={SESSION_ID}
+ messages={messages}
+ status="ready"
+ error={undefined}
+ queuedMessages={[]}
+ onSend={async () => {}}
+ onStop={vi.fn()}
+ onRetry={vi.fn()}
+ onClose={vi.fn()}
+ />,
+ ),
+ },
+ {
+ name: "builder chat",
+ host: "app/(platform)/build/components/BuilderChatPanel/BuilderChatPanel.tsx",
+ mount: (messages) => {
+ vi.mocked(useBuilderChatPanel).mockReturnValue({
+ isOpen: true,
+ handleToggle: vi.fn(),
+ sessionId: SESSION_ID,
+ messages,
+ status: "ready",
+ error: undefined,
+ stop: vi.fn(),
+ onSend: vi.fn(),
+ queuedMessages: [],
+ isBootstrapping: false,
+ revertTargetVersion: null,
+ handleRevert: vi.fn(),
+ bindError: null,
+ bootstrapError: null,
+ retryBind: vi.fn(),
+ retryBootstrap: vi.fn(),
+ } as unknown as ReturnType<typeof useBuilderChatPanel>);
+ render(<BuilderChatPanel />);
+ },
+ },
+ {
+ name: "team expert chat drawer",
+ host: "app/(platform)/team/components/ExpertChatDrawer/ExpertChatDrawer.tsx",
+ mount: (messages) => {
+ vi.mocked(useExpertChatDrawer).mockReturnValue({
+ sessionId: SESSION_ID,
+ startNewThread: vi.fn(),
+ messages,
+ status: "ready",
+ error: undefined,
+ stop: vi.fn(),
+ onSend: vi.fn(),
+ onActionSend: vi.fn(),
+ queuedMessages: [],
+ isResolvingSession: false,
+ isLoadingSession: false,
+ isCreating: false,
+ suppressOnboarding: true,
+ } as unknown as ReturnType<typeof useExpertChatDrawer>);
+ render(
+ <ExpertChatDrawer
+ target={{
+ expertId: null,
+ name: "Otto",
+ role: "autopilot",
+ avatarUrl: null,
+ }}
+ onClose={vi.fn()}
+ />,
+ );
+ },
+ },
+];
+
+/** Hosts that render the thread for an anonymous reader. They never show a
+ * live card, so they are out of the parity check on purpose. */
+const READ_ONLY_HOSTS = ["app/(no-navbar)/share/chat/[token]/page.tsx"];
+
+const KEPT_ATTRIBUTES = new Set([
+ "role",
+ "aria-label",
+ "aria-checked",
+ "aria-expanded",
+ "aria-hidden",
+ "aria-pressed",
+ "aria-selected",
+ "href",
+ "type",
+ "disabled",
+ "name",
+ "value",
+ "alt",
+ "placeholder",
+ "src",
+]);
+
+/** What the reader gets from the thread: its elements, text, roles and
+ * controls, without styling or generated ids — a compact panel is allowed
+ * to look smaller, not to render something else. */
+function threadSignature(): string {
+ const logs = document.body.querySelectorAll('[role="log"]');
+ expect(logs.length).toBe(1);
+ const clone = logs[0].cloneNode(true) as Element;
+ for (const element of [clone, ...clone.querySelectorAll("*")]) {
+ for (const attribute of [...element.attributes]) {
+ if (!KEPT_ATTRIBUTES.has(attribute.name))
+ element.removeAttribute(attribute.name);
+ }
+ }
+ return clone.outerHTML;
+}
+
+async function settle() {
+ for (let i = 0; i < 3; i++) {
+ await act(async () => {
+ await new Promise((resolve) => setTimeout(resolve, 0));
+ });
+ }
+}
+
+function sourceFiles(dir: string): string[] {
+ return readdirSync(dir).flatMap((name) => {
+ const path = join(dir, name);
+ if (statSync(path).isDirectory())
+ return name === "__tests__" ? [] : sourceFiles(path);
+ return /\.tsx$/.test(name) && !/\.(test|stories)\.tsx$/.test(name)
+ ? [path]
+ : [];
+ });
+}
+
+function filesRendering(tag: string): string[] {
+ return sourceFiles(join(SRC, "app"))
+ .filter((path) => readFileSync(path, "utf8").includes(`<${tag}`))
+ .map((path) => relative(SRC, path))
+ .sort();
+}
+
+class MockResizeObserver {
+ observe() {}
+ disconnect() {}
+ unobserve() {}
+}
+
+beforeEach(() => {
+ vi.stubGlobal("ResizeObserver", MockResizeObserver);
+ // Generated mocks answer with random data, which would differ from one
+ // surface's render to the next. Nothing is waiting on review here.
+ server.use(
+ getGetV2GetPendingReviewsForChatSessionMockHandler([]),
+ getGetV2GetPendingReviewsForExecutionMockHandler([]),
+ );
+});
+
+afterEach(() => {
+ cleanup();
+ vi.unstubAllGlobals();
+});
+
+// Each card mounts four full chat surfaces and the coverage checks read every
+// source file under app/ — well past the 5s default on a loaded runner.
+describe("chat surface parity", { timeout: 30_000 }, () => {
+ it("covers every chat that renders the shared thread", () => {
+ expect(filesRendering("ChatMessagesContainer")).toEqual(
+ [MAIN, ...OTHER_SURFACES]
+ .map((surface) => surface.host)
+ .concat(READ_ONLY_HOSTS)
+ .sort(),
+ );
+ });
+
+ it("keeps a single message renderer, with no second copy of the card switch", () => {
+ const renderer = "app/(platform)/copilot/components/ChatMessagesContainer/";
+ for (const tag of ["MessagePartRenderer", "ChainMessageParts"]) {
+ expect(
+ filesRendering(tag).filter((path) => !path.startsWith(renderer)),
+ ).toEqual([]);
+ }
+ });
+
+ it("has a fixture for every card the main chat renders", () => {
+ expect(
+ MAIN_CHAT_CARD_TYPES.filter((type) => !(type in CARD_FIXTURES)),
+ ).toEqual([]);
+ });
+
+ it.each(MAIN_CHAT_CARD_TYPES)(
+ "renders %s on every other chat as the main chat does",
+ async (type) => {
+ const fixture = CARD_FIXTURES[type];
+ expect(fixture, `no fixture for ${type}`).toBeDefined();
+ const messages = transcriptFor(fixture);
+
+ MAIN.mount(messages);
+ await settle();
+ const expected = threadSignature();
+ expect(
+ document.body.querySelector('[role="log"]')?.textContent,
+ ).toContain(fixture.marker);
+ cleanup();
+
+ for (const surface of OTHER_SURFACES) {
+ surface.mount(messages);
+ await settle();
+ expect(threadSignature(), `${type} in the ${surface.name}`).toBe(
+ expected,
+ );
+ cleanup();
+ }
+ },
+ );
+});
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/chatSurfaceFixtures.ts b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/chatSurfaceFixtures.ts
new file mode 100644
index 0000000000..68ab84da9a
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/chatSurfaceFixtures.ts
@@ -0,0 +1,466 @@
+import type { UIDataTypes, UIMessage, UITools } from "ai";
+import { TOOL_CARD_TOOLS } from "../components/ToolChain/ToolResult";
+import {
+ COMPACTION_PART_TYPE,
+ EXPERT_CHANGE_TOOLS,
+} from "../components/ToolChain/helpers";
+import { EXPERT_ONBOARDING_PART_TYPE } from "../components/ExpertOnboardingCard/helpers";
+
+type Message = UIMessage<unknown, UIDataTypes, UITools>;
+type Part = Message["parts"][number];
+
+export interface CardFixture {
+ part: Part;
+ /** Visible text that proves the card itself rendered, not a fallback. */
+ marker: string;
+}
+
+/** Every part type the main chat has a card for, read from the renderer's own
+ * registries: the tool chain's card switch, plus the parts that render as
+ * cards of their own outside a chain. */
+export const MAIN_CHAT_CARD_TYPES: string[] = [
+ ...TOOL_CARD_TOOLS.map((tool) => `tool-${tool}`),
+ COMPACTION_PART_TYPE,
+ EXPERT_ONBOARDING_PART_TYPE,
+ ...[...EXPERT_CHANGE_TOOLS].map((tool) => `tool-${tool}`),
+];
+
+function toolPart(
+ type: string,
+ output: unknown,
+ input: Record<string, unknown> = {},
+): Part {
+ return {
+ type,
+ toolCallId: `call-${type.slice("tool-".length)}`,
+ state: "output-available",
+ input,
+ output,
+ } as unknown as Part;
+}
+
+function card(
+ tool: string,
+ output: unknown,
+ marker: string,
+ input?: Record<string, unknown>,
+): [string, CardFixture] {
+ const type = `tool-${tool}`;
+ return [type, { part: toolPart(type, output, input), marker }];
+}
+
+function subSession(response: string, elapsed: number) {
+ return {
+ status: "COMPLETED",
+ response,
+ elapsed_seconds: elapsed,
+ sub_autopilot_session_link: "/copilot?session=sub-1",
+ };
+}
+
+function expertProposal(kind: string, name: string, role: string) {
+ return {
+ type: "expert_change_proposed",
+ applied: false,
+ confirmation_id: `confirm-${kind}`,
+ preview: { kind, name, role },
+ };
+}
+
+const DESKTOP = {
+ type: "desktop_stream",
+ message: "Desktop started.",
+ desktop_stream: {
+ kind: "desktop_stream",
+ url: "https://6080-sbx.e2b.app/vnc.html?autoconnect=true",
+ provider: "e2b",
+ sandbox_id: "sbx-1",
+ },
+};
+
+export const CARD_FIXTURES: Record<string, CardFixture> = Object.fromEntries([
+ card(
+ "run_agent",
+ {
+ graph_name: "Research Agent",
+ execution_id: "exec-1",
+ status: "COMPLETED",
+ library_agent_link: "/library/agents/lib-1",
+ },
+ "Research Agent",
+ ),
+ card(
+ "schedule_agent",
+ { execution_id: "exec-2", graph_id: "graph-9" },
+ "creator/scraper",
+ { username_agent_slug: "creator/scraper" },
+ ),
+ card(
+ "view_agent_output",
+ { outputs: [{ name: "report", value: "Weekly report ready" }] },
+ "Weekly report ready",
+ ),
+ card(
+ "create_agent",
+ { suggested_goal: "Build a scraper", reason: "You asked for it" },
+ "Build a scraper",
+ ),
+ card(
+ "customize_agent",
+ { agent_name: "Custom Agent", library_agent_link: "/library/agents/lib-3" },
+ "Custom Agent",
+ ),
+ card(
+ "edit_agent",
+ {
+ agent_name: "Edited Agent",
+ graph_version: 2,
+ library_agent_link: "/library/agents/lib-2",
+ agent_page_link: "/build?flowID=graph-2",
+ },
+ "Edited Agent",
+ ),
+ card(
+ "run_sub_session",
+ subSession("Everything worked", 75),
+ "Everything worked",
+ ),
+ card(
+ "get_sub_session_result",
+ subSession("The poll came back", 30),
+ "The poll came back",
+ ),
+ card("delegate_to_expert", subSession("Delegated", 75), "1m 15s"),
+ card("handoff_to_expert", subSession("Handed off", 125), "2m 5s"),
+ card(
+ "consult_teammate",
+ { verdict: "approve", reason: "The plan holds up" },
+ "Teammate checked",
+ ),
+ card(
+ "find_agent",
+ {
+ agents: [
+ {
+ id: "store-1",
+ source: "marketplace",
+ name: "Store Agent",
+ creator: "toran",
+ },
+ ],
+ },
+ "Store Agent",
+ ),
+ card(
+ "find_library_agent",
+ {
+ agents: [
+ { id: "lib-1", source: "library", name: "Lib Agent", creator: "abhi" },
+ ],
+ },
+ "Lib Agent",
+ ),
+ card(
+ "find_block",
+ {
+ blocks: [
+ {
+ name: "HTTP Request",
+ description: "Makes HTTP requests",
+ categories: ["NETWORK"],
+ },
+ ],
+ },
+ "Makes HTTP requests",
+ ),
+ card(
+ "find_capability",
+ {
+ capabilities: [
+ { name: "Slack poster", purpose: "Posts to a channel", kind: "block" },
+ ],
+ },
+ "Posts to a channel",
+ ),
+ card(
+ "run_block",
+ { block_name: "FillTextTemplateBlock", outputs: { output: ["Hello"] } },
+ "Fill Text Template",
+ ),
+ card(
+ "continue_run_block",
+ {
+ block_name: "Send Email",
+ success: false,
+ outputs: { error_message: ["SMTP down"] },
+ },
+ "SMTP down",
+ ),
+ card(
+ "describe_capability",
+ { block: { name: "Web Scraper", description: "Reads web pages" } },
+ "Reads web pages",
+ ),
+ card(
+ "run_capability",
+ { block_name: "Summarizer", outputs: { summary: ["Short version"] } },
+ "Short version",
+ ),
+ card(
+ "resume_capability",
+ { block_name: "Resumer", outputs: { status: ["Resumed fine"] } },
+ "Resumed fine",
+ ),
+ card(
+ "connect_integration",
+ {
+ type: "setup_requirements",
+ message: "Connect GitHub to continue.",
+ setup_info: {
+ agent_id: "github",
+ agent_name: "GitHub",
+ requirements: {},
+ user_readiness: { has_all_credentials: true },
+ },
+ },
+ "GitHub",
+ ),
+ card(
+ "decompose_goal",
+ {
+ steps: [
+ { description: "Fetch the data", status: "completed" },
+ { description: "Summarize it", status: "in_progress" },
+ ],
+ },
+ "Fetch the data",
+ ),
+ card("validate_agent_graph", { valid: true }, "Graph is valid"),
+ card(
+ "fix_agent_graph",
+ { valid_after_fix: true, fixes_applied: ["Linked input"] },
+ "Fixed — applied 1 fix",
+ ),
+ card(
+ "ask_question",
+ {
+ type: "agent_builder_clarification_needed",
+ message: "I need a bit more detail.",
+ questions: [
+ {
+ question: "Which memories should I forget?",
+ keyword: "memories",
+ options: ["Emberline", "Monday summaries"],
+ },
+ ],
+ },
+ "Which memories should I forget?",
+ ),
+ card(
+ "list_schedules",
+ {
+ schedules: [
+ {
+ name: "Daily run",
+ next_run_time: "2026-08-21T10:00:00Z",
+ cron: "0 10 * * *",
+ kind: "copilot_turn",
+ },
+ ],
+ },
+ "Daily run",
+ ),
+ card(
+ "schedule_followup",
+ { next_run_time: "2026-08-21T10:00:00Z", is_recurring: true },
+ "Follow-up scheduled",
+ ),
+ card(
+ "list_folders",
+ { folders: [{ name: "Marketing", agent_count: 3 }] },
+ "Marketing",
+ ),
+ card("create_folder", { folder: { name: "New Folder" } }, "New Folder"),
+ card(
+ "update_folder",
+ { folder: { name: "Renamed Folder" } },
+ "Renamed Folder",
+ ),
+ card("move_folder", { folder: { name: "Moved Folder" } }, "Moved Folder"),
+ card(
+ "list_workspace_files",
+ {
+ files: [{ path: "chart.png", mime_type: "image/png", size_bytes: 2048 }],
+ },
+ "chart.png",
+ ),
+ card(
+ "search_docs",
+ {
+ results: [
+ {
+ title: "Blocks",
+ section: "Guide",
+ snippet: "How blocks work",
+ doc_url: "https://docs.agpt.co/blocks",
+ },
+ ],
+ },
+ "How blocks work",
+ ),
+ card("get_doc_page", { title: "Getting Started" }, "Getting Started"),
+ card(
+ "setup_agent_webhook_trigger",
+ { message: "Webhook ready", webhook_url: "https://hooks.example.com/h1" },
+ "Webhook ready",
+ ),
+ card(
+ "search_feature_requests",
+ {
+ results: [
+ { title: "Dark mode", description: "Please", identifier: "FR-1" },
+ ],
+ },
+ "Dark mode",
+ ),
+ card(
+ "create_feature_request",
+ {
+ issue_url: "https://linear.app/agpt/issue/OPEN-1",
+ issue_title: "Add dark mode",
+ },
+ "Add dark mode",
+ ),
+ card(
+ "run_mcp_tool",
+ { result: "The MCP tool answered" },
+ "The MCP tool answered",
+ ),
+ card(
+ "store_skill",
+ {
+ name: "Weekly digest",
+ description: "Summarizes the week",
+ triggers: ["every friday"],
+ },
+ "Weekly digest",
+ ),
+ card(
+ "read_skill",
+ { name: "Reader skill", description: "Reads things" },
+ "Reader skill",
+ ),
+ card(
+ "delete_skill",
+ { name: "Old skill", description: "Not needed" },
+ "Old skill",
+ ),
+ card(
+ "list_skills",
+ { skills: [{ name: "summarize" }, { name: "draft" }] },
+ "summarize",
+ ),
+ card(
+ "list_chat_platform_channels",
+ { channels: [{ name: "general" }] },
+ "#general",
+ ),
+ card(
+ "web_search",
+ {
+ answer: "Paris is the capital",
+ results: [{ title: "Wiki", url: "https://en.wikipedia.org/x" }],
+ },
+ "Paris is the capital",
+ ),
+ card("bash_exec", { stdout: "file.txt", exit_code: 0 }, "file.txt", {
+ command: "ls",
+ }),
+ card("start_desktop", DESKTOP, "Desktop"),
+ card("TodoWrite", { ok: true }, "Task A", {
+ todos: [
+ { content: "Task A", status: "completed" },
+ { content: "Task B", status: "in_progress" },
+ ],
+ }),
+ card(
+ "read_workspace_file",
+ { size_bytes: 2048, mime_type: "text/plain", preview: "hello world" },
+ "notes.txt",
+ { path: "notes.txt" },
+ ),
+ card(
+ "write_workspace_file",
+ { size_bytes: 7, mime_type: "text/plain" },
+ "out.txt",
+ { path: "out.txt", content: "written" },
+ ),
+ card("delete_workspace_file", { success: true }, "old.txt", {
+ path: "old.txt",
+ }),
+ card("Read", "print(1)", "reader.py", { file_path: "/tmp/reader.py" }),
+ card("Write", "ok", "writer.py", {
+ file_path: "/tmp/writer.py",
+ content: "x = 1",
+ }),
+ [
+ COMPACTION_PART_TYPE,
+ {
+ part: toolPart(COMPACTION_PART_TYPE, {
+ type: "context_compaction",
+ messages_before: 40,
+ messages_after: 8,
+ }),
+ marker: "Condensed",
+ },
+ ],
+ [
+ EXPERT_ONBOARDING_PART_TYPE,
+ {
+ part: toolPart(EXPERT_ONBOARDING_PART_TYPE, {
+ type: "expert_onboarding",
+ message: "Which outcome should I start with?",
+ expert_id: "expert-zara",
+ greeting: "Hi, I'm Zara.",
+ steps: [
+ {
+ question: "Which outcome should I start with?",
+ keyword: "outcome",
+ options: ["Positioning", "Pricing"],
+ },
+ ],
+ }),
+ marker: "Which outcome should I start with?",
+ },
+ ],
+ card("hire_expert", expertProposal("hire", "Zara", "Designer"), "Designer"),
+ card("raise_expert", expertProposal("raise", "Otto", "Engineer"), "Engineer"),
+ card(
+ "update_expert",
+ expertProposal("update", "Mira", "Researcher"),
+ "Researcher",
+ ),
+ card(
+ "confirm_expert_change",
+ expertProposal("hire", "Theo", "Analyst"),
+ "Analyst",
+ ),
+]);
+
+/** One turn: the user asks, and the assistant's reply is the card under test.
+ * As the last message it is also live — an unanswered question or a fresh
+ * onboarding card is still waiting on the user. */
+export function transcriptFor(fixture: CardFixture): Message[] {
+ return [
+ {
+ id: "parity-user-1",
+ role: "user",
+ parts: [{ type: "text", text: "Go ahead" }],
+ },
+ {
+ id: "parity-assistant-1",
+ role: "assistant",
+ parts: [fixture.part],
+ },
+ ];
+}
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatContainer/ChatContainer.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatContainer/ChatContainer.tsx
index f431e99dd4..aa3c6925d4 100644
--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatContainer/ChatContainer.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatContainer/ChatContainer.tsx
@@ -17,7 +17,6 @@ import type { FloatingControls } from "../ChatMessagesContainer/components/Threa
import { CopilotChatActionsProvider } from "../CopilotChatActionsProvider/CopilotChatActionsProvider";
import { NewChatOnboarding } from "../ExpertOnboardingCard/NewChatOnboarding";
import { EmptySession } from "../EmptySession/EmptySession";
-import { PendingAnswerContexts } from "./components/PendingAnswerContexts";
import { UsageLimitReachedCard } from "../UsageLimits/UsageLimitReachedCard/UsageLimitReachedCard";
import { useIsUsageLimitReached } from "../UsageLimits/useIsUsageLimitReached";
import { TaskProgressBar } from "../TaskProgressBar/TaskProgressBar";
@@ -347,191 +346,185 @@ export const ChatContainer = ({
onSend={guardedOnSend}
onBackendTurn={onBackendTurn}
>
- <PendingAnswerContexts messages={messages}>
- <LayoutGroup id="copilot-2-chat-layout">
- <div className="flex h-full min-h-0 w-full flex-col px-2 lg:px-0">
- {/* The chat column runs full width: the max-w-3xl cap lives on the
+ <LayoutGroup id="copilot-2-chat-layout">
+ <div className="flex h-full min-h-0 w-full flex-col px-2 lg:px-0">
+ {/* The chat column runs full width: the max-w-3xl cap lives on the
message list and the input instead, so the expert thread header
can span edge to edge while staying aligned with the messages. */}
- {sessionId && isSessionNotFound ? (
- <SessionNotFound />
- ) : sessionId ? (
- <div className="relative flex h-full min-h-0 w-full flex-col bg-white">
- <div className="absolute right-0 top-0 z-30">
- <ContextPanelToggle
- sessionId={sessionId}
- expert={chatExpert}
- />
- </div>
- <NewChatOnboarding
- expertId={expertIdentity?.id ?? null}
- enabled={
- messages.length === 0 &&
- !isInputDisabled &&
- !isStreaming &&
- !isCreatingSession &&
- !isExpertArchived
- }
+ {sessionId && isSessionNotFound ? (
+ <SessionNotFound />
+ ) : sessionId ? (
+ <div className="relative flex h-full min-h-0 w-full flex-col bg-white">
+ <div className="absolute right-0 top-0 z-30">
+ <ContextPanelToggle sessionId={sessionId} expert={chatExpert} />
+ </div>
+ <NewChatOnboarding
+ expertId={expertIdentity?.id ?? null}
+ enabled={
+ messages.length === 0 &&
+ !isInputDisabled &&
+ !isStreaming &&
+ !isCreatingSession &&
+ !isExpertArchived
+ }
+ >
+ <ChatMessagesContainer
+ messages={messages}
+ status={status}
+ error={error}
+ isLoading={isLoadingSession}
+ isRestoringActiveSession={isRestoringActiveSession}
+ restoreStatusMessage={restoreStatusMessage}
+ activeStreamStartedAt={activeStreamStartedAt}
+ sessionID={sessionId}
+ sessionChatStatus={sessionChatStatus}
+ sessionSentFrom={sessionSentFrom}
+ hasMoreMessages={hasMoreMessages}
+ isLoadingMore={isLoadingMore}
+ onLoadMore={onLoadMore}
+ onRetry={handleRetry}
+ turnStats={turnStats}
+ queuedMessages={queuedMessages}
+ pendingSend={pendingSend}
+ bottomContentPadding={usageCardHeight}
+ expertIdentity={expertIdentity}
+ isResolvingExpertIdentity={isResolvingExpertIdentity}
+ floatingControls={floatingControls}
+ />
+ </NewChatOnboarding>
+ {archivedExpertIdentity ? (
+ <ArchivedExpertNotice
+ expertName={archivedExpertIdentity.name}
+ reason={archivedExpertIdentity.readOnlyReason ?? "fired"}
+ />
+ ) : (
+ <motion.div
+ initial={{ opacity: 0 }}
+ animate={{ opacity: 1 }}
+ transition={{ duration: 0.3 }}
+ className="relative mx-auto w-full max-w-3xl px-3 pb-6 pt-2"
>
- <ChatMessagesContainer
- messages={messages}
- status={status}
- error={error}
- isLoading={isLoadingSession}
- isRestoringActiveSession={isRestoringActiveSession}
- restoreStatusMessage={restoreStatusMessage}
- activeStreamStartedAt={activeStreamStartedAt}
- sessionID={sessionId}
- sessionChatStatus={sessionChatStatus}
- sessionSentFrom={sessionSentFrom}
- hasMoreMessages={hasMoreMessages}
- isLoadingMore={isLoadingMore}
- onLoadMore={onLoadMore}
- onRetry={handleRetry}
- turnStats={turnStats}
- queuedMessages={queuedMessages}
- pendingSend={pendingSend}
- bottomContentPadding={usageCardHeight}
- expertIdentity={expertIdentity}
- isResolvingExpertIdentity={isResolvingExpertIdentity}
- floatingControls={floatingControls}
- />
- </NewChatOnboarding>
- {archivedExpertIdentity ? (
- <ArchivedExpertNotice
- expertName={archivedExpertIdentity.name}
- reason={archivedExpertIdentity.readOnlyReason ?? "fired"}
- />
- ) : (
- <motion.div
- initial={{ opacity: 0 }}
- animate={{ opacity: 1 }}
- transition={{ duration: 0.3 }}
- className="relative mx-auto w-full max-w-3xl px-3 pb-6 pt-2"
- >
- {isLimitReached && (
+ {isLimitReached && (
+ <div
+ ref={usageCardRef}
+ className="pointer-events-none absolute bottom-full left-0 right-0 z-20 mb-2.5 pb-2"
+ >
<div
- ref={usageCardRef}
- className="pointer-events-none absolute bottom-full left-0 right-0 z-20 mb-2.5 pb-2"
+ aria-hidden="true"
+ data-testid="usage-limit-backdrop"
+ className="absolute -inset-x-14 -top-20 bottom-[-18px] overflow-hidden rounded-[2rem] bg-[radial-gradient(ellipse_at_center,rgba(255,255,255,0.96)_0%,rgba(255,255,255,0.9)_42%,rgba(255,255,255,0.58)_68%,rgba(255,255,255,0)_100%)] backdrop-blur-lg [mask-image:linear-gradient(to_bottom,transparent_0%,black_26%,black_100%)]"
>
- <div
- aria-hidden="true"
- data-testid="usage-limit-backdrop"
- className="absolute -inset-x-14 -top-20 bottom-[-18px] overflow-hidden rounded-[2rem] bg-[radial-gradient(ellipse_at_center,rgba(255,255,255,0.96)_0%,rgba(255,255,255,0.9)_42%,rgba(255,255,255,0.58)_68%,rgba(255,255,255,0)_100%)] backdrop-blur-lg [mask-image:linear-gradient(to_bottom,transparent_0%,black_26%,black_100%)]"
- >
- <div className="absolute inset-x-10 bottom-0 h-28 rounded-full bg-white/80 blur-2xl" />
- <div className="absolute inset-x-16 bottom-8 h-16 rounded-full bg-white/55 blur-xl" />
- </div>
- <div className="pointer-events-auto relative px-3">
- <UsageLimitReachedCard />
- </div>
+ <div className="absolute inset-x-10 bottom-0 h-28 rounded-full bg-white/80 blur-2xl" />
+ <div className="absolute inset-x-16 bottom-8 h-16 rounded-full bg-white/55 blur-xl" />
</div>
- )}
- <SharedChatNotice sessionId={sessionId} />
- {isTaskBarEnabled && (
- <div className="relative z-10">
- <TaskProgressBar
- todos={getLatestTaskList(messages) ?? []}
+ <div className="pointer-events-auto relative px-3">
+ <UsageLimitReachedCard />
+ </div>
+ </div>
+ )}
+ <SharedChatNotice sessionId={sessionId} />
+ {isTaskBarEnabled && (
+ <div className="relative z-10">
+ <TaskProgressBar
+ todos={getLatestTaskList(messages) ?? []}
+ isStreaming={isStreaming}
+ />
+ </div>
+ )}
+ <Tooltip
+ open={Boolean(isLimitReached && isUsageTooltipOpen)}
+ onOpenChange={(open) =>
+ setIsUsageTooltipOpen(open && isLimitReached)
+ }
+ >
+ <TooltipTrigger asChild>
+ <div>
+ <ChatInput
+ inputId="chat-input-session"
+ onSend={guardedOnSend}
+ disabled={isInputDisabled}
isStreaming={isStreaming}
+ isUploadingFiles={isUploadingFiles}
+ onStop={onStop}
+ onEnqueue={onEnqueue}
+ placeholder="What else can I help with?"
+ droppedFiles={droppedFiles}
+ onDroppedFilesConsumed={onDroppedFilesConsumed}
+ hasSession={!!sessionId}
+ sessionId={sessionId}
+ expertId={expertIdentity?.id ?? null}
+ modeSelector={modeSelector}
+ expertName={expertIdentity?.name ?? null}
+ voiceToggle={
+ isVoiceModeEnabled ? (
+ <VoiceModeButton
+ isActive={voice.isActive}
+ disabled={
+ isInputDisabled ||
+ isSendLocked ||
+ voice.isStarting
+ }
+ onClick={voice.toggle}
+ />
+ ) : undefined
+ }
+ voiceBar={
+ voice.isActive ? (
+ <VoiceModeBar
+ state={voice.state}
+ statusLabel={voice.statusLabel}
+ failure={voice.failure}
+ onRetry={voice.retryFailedUtterance}
+ onDownload={voice.downloadFailedUtterance}
+ leaveButton={
+ <VoiceModeButton
+ isActive
+ speaking={voice.state === "speaking"}
+ onClick={voice.toggle}
+ />
+ }
+ />
+ ) : undefined
+ }
/>
</div>
- )}
- <Tooltip
- open={Boolean(isLimitReached && isUsageTooltipOpen)}
- onOpenChange={(open) =>
- setIsUsageTooltipOpen(open && isLimitReached)
- }
- >
- <TooltipTrigger asChild>
- <div>
- <ChatInput
- inputId="chat-input-session"
- onSend={guardedOnSend}
- disabled={isInputDisabled}
- isStreaming={isStreaming}
- isUploadingFiles={isUploadingFiles}
- onStop={onStop}
- onEnqueue={onEnqueue}
- placeholder="What else can I help with?"
- droppedFiles={droppedFiles}
- onDroppedFilesConsumed={onDroppedFilesConsumed}
- hasSession={!!sessionId}
- sessionId={sessionId}
- expertId={expertIdentity?.id ?? null}
- modeSelector={modeSelector}
- expertName={expertIdentity?.name ?? null}
- voiceToggle={
- isVoiceModeEnabled ? (
- <VoiceModeButton
- isActive={voice.isActive}
- disabled={
- isInputDisabled ||
- isSendLocked ||
- voice.isStarting
- }
- onClick={voice.toggle}
- />
- ) : undefined
- }
- voiceBar={
- voice.isActive ? (
- <VoiceModeBar
- state={voice.state}
- statusLabel={voice.statusLabel}
- failure={voice.failure}
- onRetry={voice.retryFailedUtterance}
- onDownload={voice.downloadFailedUtterance}
- leaveButton={
- <VoiceModeButton
- isActive
- speaking={voice.state === "speaking"}
- onClick={voice.toggle}
- />
- }
- />
- ) : undefined
- }
- />
- </div>
- </TooltipTrigger>
- <TooltipContent side="top" className="max-w-sm">
- You&apos;ve reached your usage limit. Wait for it to
- refresh or upgrade your plan to continue sending
- messages.
- </TooltipContent>
- </Tooltip>
- </motion.div>
- )}
- </div>
- ) : (
- <EmptySession
- isCreatingSession={isCreatingSession}
- onCreateSession={onCreateSession}
- onSend={guardedOnSend}
- modeSelector={modeSelector}
- voiceToggle={
- isVoiceModeEnabled ? (
- <VoiceModeButton
- isActive={false}
- disabled={
- isInputDisabled || isSendLocked || isCreatingSession
- }
- onClick={handleStartVoiceInNewChat}
- />
- ) : undefined
- }
- isUploadingFiles={isUploadingFiles}
- droppedFiles={droppedFiles}
- onDroppedFilesConsumed={onDroppedFilesConsumed}
- isInteractionLocked={isSendLocked || !!isAdoptingExpertSession}
- isKickoffStarting={isKickoffStarting}
- expertName={expertIdentity?.name}
- expertId={expertIdentity?.id ?? null}
- />
- )}
- </div>
- </LayoutGroup>
- </PendingAnswerContexts>
+ </TooltipTrigger>
+ <TooltipContent side="top" className="max-w-sm">
+ You&apos;ve reached your usage limit. Wait for it to
+ refresh or upgrade your plan to continue sending messages.
+ </TooltipContent>
+ </Tooltip>
+ </motion.div>
+ )}
+ </div>
+ ) : (
+ <EmptySession
+ isCreatingSession={isCreatingSession}
+ onCreateSession={onCreateSession}
+ onSend={guardedOnSend}
+ modeSelector={modeSelector}
+ voiceToggle={
+ isVoiceModeEnabled ? (
+ <VoiceModeButton
+ isActive={false}
+ disabled={
+ isInputDisabled || isSendLocked || isCreatingSession
+ }
+ onClick={handleStartVoiceInNewChat}
+ />
+ ) : undefined
+ }
+ isUploadingFiles={isUploadingFiles}
+ droppedFiles={droppedFiles}
+ onDroppedFilesConsumed={onDroppedFilesConsumed}
+ isInteractionLocked={isSendLocked || !!isAdoptingExpertSession}
+ isKickoffStarting={isKickoffStarting}
+ expertName={expertIdentity?.name}
+ expertId={expertIdentity?.id ?? null}
+ />
+ )}
+ </div>
+ </LayoutGroup>
</CopilotChatActionsProvider>
);
};
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/ChatMessagesContainer.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/ChatMessagesContainer.tsx
index 2e1cd9c478..884e4ce0b7 100644
--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/ChatMessagesContainer.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/ChatMessagesContainer.tsx
@@ -56,6 +56,7 @@ import { CopyButton } from "./components/CopyButton";
import { TailSpacer } from "./components/TailSpacer";
import { MessageAttachments } from "./components/MessageAttachments";
import { MessagePartRenderer } from "./components/MessagePartRenderer";
+import { PendingAnswerContexts } from "./components/PendingAnswerContexts";
import { QueueBadge } from "./components/QueueBadge";
import { ThreadHeader, type FloatingControls } from "./components/ThreadHeader";
import {
@@ -468,7 +469,7 @@ export function ChatMessagesContainer({
wasStreamingRef.current = isActivelyStreaming;
});
- return (
+ const thread = (
<>
{showThreadHeader && (
<ThreadHeader
@@ -864,4 +865,14 @@ export function ChatMessagesContainer({
</Conversation>
</>
);
+
+ // Every chat surface renders through here, so the pending-answer state
+ // (clarifying questions, a hire's onboarding, held calls) lives here too
+ // instead of in each host. A read-only viewer answers nothing.
+ if (readOnly) return thread;
+ return (
+ <PendingAnswerContexts messages={allMessages}>
+ {thread}
+ </PendingAnswerContexts>
+ );
}
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatContainer/components/PendingAnswerContexts.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/PendingAnswerContexts.tsx
similarity index 88%
rename from autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatContainer/components/PendingAnswerContexts.tsx
rename to autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/PendingAnswerContexts.tsx
index 342146d98a..e0df0c6de8 100644
--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatContainer/components/PendingAnswerContexts.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ChatMessagesContainer/components/PendingAnswerContexts.tsx
@@ -1,8 +1,8 @@
"use client";
import type { UIDataTypes, UIMessage, UITools } from "ai";
-import { getHeldOutcomes } from "../../ChatMessagesContainer/heldCallRows";
-import { HeldOutcomesContext } from "../../ChatMessagesContainer/HeldOutcomesContext";
+import { getHeldOutcomes } from "../heldCallRows";
+import { HeldOutcomesContext } from "../HeldOutcomesContext";
import { getPendingOnboardingCallId } from "../../ExpertOnboardingCard/helpers";
import { PendingOnboardingContext } from "../../ExpertOnboardingCard/PendingOnboardingContext";
import { getPendingQuestions } from "../../QuestionDock/helpers";
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ToolChain/ToolResult.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ToolChain/ToolResult.tsx
index 431b09dcb4..bbb1039da4 100644
--- a/autogpt_platform/frontend/src/app/(platform)/copilot/components/ToolChain/ToolResult.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/components/ToolChain/ToolResult.tsx
@@ -247,6 +247,71 @@ function setupRequirementsCard(row: ChainRow, output: Record<string, unknown>) {
);
}
+/** Every tool with a card of its own. toolCard's switch is typed against
+ * this list, so a new case cannot land without joining it — and the
+ * chat-surface parity test renders each entry on every chat, not just the
+ * main one. */
+export const TOOL_CARD_TOOLS = [
+ "run_agent",
+ "schedule_agent",
+ "view_agent_output",
+ "create_agent",
+ "customize_agent",
+ "edit_agent",
+ "run_sub_session",
+ "get_sub_session_result",
+ "delegate_to_expert",
+ "handoff_to_expert",
+ "consult_teammate",
+ "find_agent",
+ "find_library_agent",
+ "find_block",
+ "find_capability",
+ "run_block",
+ "continue_run_block",
+ "describe_capability",
+ "run_capability",
+ "resume_capability",
+ "connect_integration",
+ "decompose_goal",
+ "validate_agent_graph",
+ "fix_agent_graph",
+ "ask_question",
+ "list_schedules",
+ "schedule_followup",
+ "list_folders",
+ "create_folder",
+ "update_folder",
+ "move_folder",
+ "list_workspace_files",
+ "search_docs",
+ "get_doc_page",
+ "setup_agent_webhook_trigger",
+ "search_feature_requests",
+ "create_feature_request",
+ "run_mcp_tool",
+ "store_skill",
+ "read_skill",
+ "delete_skill",
+ "list_skills",
+ "list_chat_platform_channels",
+ "web_search",
+ "bash_exec",
+ "start_desktop",
+ "TodoWrite",
+ "read_workspace_file",
+ "write_workspace_file",
+ "delete_workspace_file",
+ "Read",
+ "Write",
+] as const;
+
+type ToolCardTool = (typeof TOOL_CARD_TOOLS)[number];
+
+function cardTool(tool: string | undefined): ToolCardTool | undefined {
+ return TOOL_CARD_TOOLS.find((name) => name === tool);
+}
+
function toolCard(
row: ChainRow,
output: Record<string, unknown> | null,
@@ -261,7 +326,7 @@ function toolCard(
if (questions) return <QuestionsCard questions={questions} />;
}
- switch (row.tool) {
+ switch (cardTool(row.tool)) {
case "run_agent":
case "schedule_agent": {
const name =
diff --git a/autogpt_platform/frontend/src/app/(platform)/settings/memory/__tests__/forget-topic-chat.test.tsx b/autogpt_platform/frontend/src/app/(platform)/settings/memory/__tests__/forget-topic-chat.test.tsx
new file mode 100644
index 0000000000..70e63f80ec
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/settings/memory/__tests__/forget-topic-chat.test.tsx
@@ -0,0 +1,158 @@
+import { render, screen, within } from "@/tests/integrations/test-utils";
+import userEvent from "@testing-library/user-event";
+import type { UIMessageChunk } from "ai";
+import { http } from "msw";
+import { beforeEach, describe, expect, it, vi } from "vitest";
+
+import { resetCopilotChatRegistry } from "@/app/(platform)/copilot/copilotChatRegistry";
+import { TEST_BACKEND_BASE_URL } from "@/app/(platform)/copilot/__tests__/sse-helpers";
+import { getListExpertsMockHandler200 } from "@/app/api/__generated__/endpoints/experts/experts.msw";
+import {
+ getGetV2GetSessionMockHandler200,
+ getGetV2GetSessionResponseMock200,
+ getPostV2CreateSessionMockHandler200,
+ getPostV2CreateSessionResponseMock200,
+} from "@/app/api/__generated__/endpoints/chat/chat.msw";
+import {
+ getGetMyMemoryOverviewMockHandler200,
+ getListMyMemoryFactsMockHandler200,
+} from "@/app/api/__generated__/endpoints/memory/memory.msw";
+import { server } from "@/mocks/mock-server";
+import { streamSseResponse } from "@/tests/integrations/copilot-sse";
+
+vi.mock("@/services/environment", async (importActual) => {
+ const actual = await importActual<typeof import("@/services/environment")>();
+ return {
+ ...actual,
+ environment: {
+ ...actual.environment,
+ getAGPTServerBaseUrl: () => TEST_BACKEND_BASE_URL,
+ },
+ };
+});
+
+vi.mock("@/app/(platform)/copilot/helpers", async (importActual) => {
+ const actual =
+ await importActual<typeof import("@/app/(platform)/copilot/helpers")>();
+ return {
+ ...actual,
+ getCopilotAuthHeaders: async () => ({ "x-test-auth": "yes" }),
+ };
+});
+
+vi.mock("@/services/feature-flags/use-get-flag", () => ({
+ Flag: {
+ GRAPHITI_MEMORY: "graphiti-memory",
+ HIRE_EXPERTS: "hire-experts",
+ CHAT_MODE_OPTION: "chat-mode-option",
+ ENABLE_PLATFORM_PAYMENT: "enable-platform-payment",
+ },
+ useGetFlag: (flag: string) =>
+ flag === "graphiti-memory" || flag === "hire-experts",
+}));
+
+vi.mock("@/services/feature-flags/with-feature-flag", () => ({
+ withFeatureFlag: (Component: React.ComponentType) => Component,
+}));
+
+import SettingsMemoryPage from "../page";
+
+const SESSION_ID = "forget-topic-session";
+
+const ASK_WHICH_MEMORIES: UIMessageChunk[] = [
+ { type: "start", messageId: "forget-reply-1" },
+ { type: "start-step" },
+ {
+ type: "tool-input-available",
+ toolCallId: "call-ask-forget",
+ toolName: "ask_question",
+ input: {},
+ },
+ {
+ type: "tool-output-available",
+ toolCallId: "call-ask-forget",
+ output: {
+ type: "agent_builder_clarification_needed",
+ message: "Which of these should I forget?",
+ questions: [
+ {
+ question: "Which memories should I forget?",
+ keyword: "memories",
+ options: ["Runs Emberline", "Monday summary emails"],
+ },
+ ],
+ },
+ },
+ { type: "finish-step" },
+ { type: "finish" },
+];
+
+beforeEach(() => {
+ resetCopilotChatRegistry();
+ window.history.replaceState({}, "", "/settings/memory");
+ server.use(
+ getListExpertsMockHandler200([]),
+ getListMyMemoryFactsMockHandler200({
+ expert_id: null,
+ items: [
+ {
+ uuid: "edge-1",
+ fact: "Runs a DTC candle brand called Emberline",
+ name: "runs",
+ source: "User",
+ target: "Emberline",
+ created_at: "2026-08-16T00:00:00Z",
+ },
+ ],
+ }),
+ getGetMyMemoryOverviewMockHandler200({
+ expert_id: null,
+ facts: 1,
+ entities: 1,
+ episodes: 1,
+ }),
+ getPostV2CreateSessionMockHandler200(
+ getPostV2CreateSessionResponseMock200({ id: SESSION_ID }),
+ ),
+ getGetV2GetSessionMockHandler200(
+ getGetV2GetSessionResponseMock200({
+ id: SESSION_ID,
+ messages: [],
+ active_stream: null,
+ }),
+ ),
+ http.post(
+ `${TEST_BACKEND_BASE_URL}/api/chat/sessions/${SESSION_ID}/stream`,
+ ({ request }) =>
+ streamSseResponse(ASK_WHICH_MEMORIES, { abortSignal: request.signal }),
+ ),
+ );
+});
+
+describe("Forget a topic chat", () => {
+ it("renders Otto's question card so the user can pick what to forget", async () => {
+ render(<SettingsMemoryPage />);
+
+ await screen.findByText("Runs a DTC candle brand called Emberline");
+ await userEvent
+ .setup()
+ .click(screen.getByRole("button", { name: "Forget a topic…" }));
+
+ const panel = await screen.findByRole("complementary", {
+ name: "Memory chat panel",
+ });
+ const options = await within(panel).findByRole("radiogroup");
+ expect(
+ within(options).getByRole("radio", { name: "Runs Emberline" }),
+ ).toBeDefined();
+ expect(
+ within(options).getByRole("radio", { name: "Monday summary emails" }),
+ ).toBeDefined();
+ expect(
+ within(panel).getByText("Which memories should I forget?"),
+ ).toBeDefined();
+ expect(
+ within(panel).getByRole("button", { name: "Send answers" }),
+ ).toBeDefined();
+ });
+});
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/components/ExpertChatDrawer/ExpertChatDrawer.tsx b/autogpt_platform/frontend/src/app/(platform)/team/components/ExpertChatDrawer/ExpertChatDrawer.tsx
index abe0c9d37f..7582a3dc73 100644
--- a/autogpt_platform/frontend/src/app/(platform)/team/components/ExpertChatDrawer/ExpertChatDrawer.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/team/components/ExpertChatDrawer/ExpertChatDrawer.tsx
@@ -4,7 +4,6 @@ import { getExpertRoleLabel } from "@/services/experts/expert-role-label";
import { ChatInput } from "@/app/(platform)/copilot/components/ChatInput/ChatInput";
import { NewChatOnboarding } from "@/app/(platform)/copilot/components/ExpertOnboardingCard/NewChatOnboarding";
-import { PendingAnswerContexts } from "@/app/(platform)/copilot/components/ChatContainer/components/PendingAnswerContexts";
import { ChatMessagesContainer } from "@/app/(platform)/copilot/components/ChatMessagesContainer/ChatMessagesContainer";
import { CopilotChatActionsProvider } from "@/app/(platform)/copilot/components/CopilotChatActionsProvider/CopilotChatActionsProvider";
import { Button } from "@/components/atoms/Button/Button";
@@ -136,28 +135,26 @@ function ChatPanelBody({ target, identity, chat }: BodyProps) {
</div>
) : sessionId ? (
<div className="flex min-h-0 flex-1 flex-col">
- <PendingAnswerContexts messages={messages}>
- <NewChatOnboarding
- expertId={target.expertId}
- enabled={
- messages.length === 0 &&
- !isLoadingSession &&
- !suppressOnboarding &&
- !isStreaming
- }
- >
- <ChatMessagesContainer
- messages={messages}
- status={status}
- error={error}
- isLoading={false}
- sessionID={sessionId}
- queuedMessages={queuedMessages}
- variant="compact"
- showThreadHeader={false}
- />
- </NewChatOnboarding>
- </PendingAnswerContexts>
+ <NewChatOnboarding
+ expertId={target.expertId}
+ enabled={
+ messages.length === 0 &&
+ !isLoadingSession &&
+ !suppressOnboarding &&
+ !isStreaming
+ }
+ >
+ <ChatMessagesContainer
+ messages={messages}
+ status={status}
+ error={error}
+ isLoading={false}
+ sessionID={sessionId}
+ queuedMessages={queuedMessages}
+ variant="compact"
+ showThreadHeader={false}
+ />
+ </NewChatOnboarding>
</div>
) : (
<NewChatOnboarding