Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
fix(sidebar): reset loaded sessions on collapse
vastsac2932b13a3e2
diff --git a/apps/desktop/src/components/Sidebar.tsx b/apps/desktop/src/components/Sidebar.tsxindex a142bbf97..7efb738ca 100644--- a/apps/desktop/src/components/Sidebar.tsx+++ b/apps/desktop/src/components/Sidebar.tsx@@ -16,8 +16,6 @@ import {} from "react";import { TooltipButton, cx } from "./ui";-/** Default number of most-recent sessions shown per project group before the rest fold. */-const MAX_VISIBLE_SESSIONS = 10;import { portalToBody } from "../lib/portal-visibility";import {clampSidebarFloatingMenuTop,@@ -35,6 +33,10 @@ import {sessionArchived,sessionPinned,} from "../lib/sidebar-session-groups";+import {+ getVisibleProjectSessions,+ updateProjectSessionExpansion,+} from "../lib/sidebar-project-sessions";import { listableSessions } from "../lib/session-origin";import {composerDropItems,@@ -1192,6 +1194,11 @@ export function Sidebar({const setCollapsed = (path: string, value: boolean) => {const normalized = normalizeProjectPath(path) || path;setProjectCollapsed(normalized, value);+ if (value) {+ setExpandedProjectSessions((previous) =>+ updateProjectSessionExpansion(previous, normalized, false),+ );+ }};const setSort = (next: SessionSort) => {@@ -1207,7 +1214,9 @@ export function Sidebar({};const expandProjectSessions = (projectKey: string) => {- setExpandedProjectSessions((prev) => ({ ...prev, [projectKey]: true }));+ setExpandedProjectSessions((previous) =>+ updateProjectSessionExpansion(previous, projectKey, true),+ );};const toggleSessionPin = (session: SessionSummary) => {@@ -1834,13 +1843,14 @@ export function Sidebar({const projectId = projectDomId(entry.key);const isMenuOpen = projectMenu === entry.key;- // Show the most recent MAX_VISIBLE_SESSIONS rows by default; the remaining- // sessions stay folded behind the same load-more affordance used for the- // time-grouped overflow and expand on click.+ // Show the initial page by default; the remaining sessions stay folded+ // behind the same load-more affordance used for time-group overflow.const sessionsExpanded = expandedProjectSessions[entry.key] ?? false;const history = entry.sessions.filter((session) => !pinnedSessionIds.has(session.id));- const visibleSessions = sessionsExpanded ? history : history.slice(0, MAX_VISIBLE_SESSIONS);- const hiddenCount = history.length - visibleSessions.length;+ const { visibleSessions, hiddenCount } = getVisibleProjectSessions(+ history,+ sessionsExpanded,+ );const renderTimeGroupedSessions = (sessions: SessionSummary[]) => {const result: React.ReactNode[] = [];diff --git a/apps/desktop/src/lib/sidebar-project-sessions.ts b/apps/desktop/src/lib/sidebar-project-sessions.tsnew file mode 100644index 000000000..a3b5bcf05--- /dev/null+++ b/apps/desktop/src/lib/sidebar-project-sessions.ts@@ -0,0 +1,27 @@+export const DEFAULT_VISIBLE_PROJECT_SESSION_COUNT = 10;++export function updateProjectSessionExpansion(+ expandedByProject: Record<string, boolean>,+ projectKey: string,+ expanded: boolean,+): Record<string, boolean> {+ if (expanded) return { ...expandedByProject, [projectKey]: true };++ const next = { ...expandedByProject };+ delete next[projectKey];+ return next;+}++export function getVisibleProjectSessions<T>(+ sessions: T[],+ expanded: boolean,+): { visibleSessions: T[]; hiddenCount: number } {+ const visibleSessions = expanded+ ? sessions+ : sessions.slice(0, DEFAULT_VISIBLE_PROJECT_SESSION_COUNT);++ return {+ visibleSessions,+ hiddenCount: sessions.length - visibleSessions.length,+ };+}diff --git a/apps/desktop/test/app-store-sidebar.test.mjs b/apps/desktop/test/app-store-sidebar.test.mjsindex 59771a197..bc98da109 100644--- a/apps/desktop/test/app-store-sidebar.test.mjs+++ b/apps/desktop/test/app-store-sidebar.test.mjs@@ -89,6 +89,24 @@ test("project title toggles its conversation group without forcing it open", ()assert.doesNotMatch(sidebarSource, /className="project-collapse-toggle"/);});+test("collapsing a project resets its expanded session history", () => {+ const collapseBlock = sidebarSource.match(+ /const setCollapsed = \(path: string, value: boolean\) => \{[\s\S]*?\n \};/,+ )?.[0] ?? "";++ assert.match(+ collapseBlock,+ /if \(value\) \{[\s\S]*?setExpandedProjectSessions\([\s\S]*?updateProjectSessionExpansion\(previous, normalized, false\)/,+ );+ const loadMoreBlock = sidebarSource.match(+ /const expandProjectSessions = \(projectKey: string\) => \{[\s\S]*?\n \};/,+ )?.[0] ?? "";+ assert.match(+ loadMoreBlock,+ /updateProjectSessionExpansion\(previous, projectKey, true\)/,+ );+});+test("global search stays on the conversation topbar, not the sidebar header", () => {assert.doesNotMatch(sidebarSource, /onOpenSearch|IconSearch|nav\.search/);assert.doesNotMatch(sidebarSource, /sidebar-session-search|toggleSearch/);diff --git a/apps/desktop/test/sidebar-project-sessions.test.mjs b/apps/desktop/test/sidebar-project-sessions.test.mjsnew file mode 100644index 000000000..19c4a13ab--- /dev/null+++ b/apps/desktop/test/sidebar-project-sessions.test.mjs@@ -0,0 +1,56 @@+import assert from "node:assert/strict";+import test from "node:test";+import {+ DEFAULT_VISIBLE_PROJECT_SESSION_COUNT,+ getVisibleProjectSessions,+ updateProjectSessionExpansion,+} from "../src/lib/sidebar-project-sessions.ts";++test("loading more project sessions resets to the initial page after collapse", () => {+ const projectKey = "/work/demo";+ const otherProjectKey = "/work/other";+ const sessions = Array.from({ length: 12 }, (_, index) => `session-${index + 1}`);+ let expandedByProject = {};++ const initialPage = getVisibleProjectSessions(+ sessions,+ expandedByProject[projectKey] ?? false,+ );+ assert.deepEqual(initialPage.visibleSessions, sessions.slice(0, 10));+ assert.equal(initialPage.hiddenCount, 2);++ expandedByProject = updateProjectSessionExpansion(+ expandedByProject,+ projectKey,+ true,+ );+ expandedByProject = updateProjectSessionExpansion(+ expandedByProject,+ otherProjectKey,+ true,+ );+ const loadedPage = getVisibleProjectSessions(+ sessions,+ expandedByProject[projectKey] ?? false,+ );+ assert.deepEqual(loadedPage.visibleSessions, sessions);+ assert.equal(loadedPage.hiddenCount, 0);++ expandedByProject = updateProjectSessionExpansion(+ expandedByProject,+ projectKey,+ false,+ );+ assert.equal(expandedByProject[projectKey], undefined);+ assert.equal(expandedByProject[otherProjectKey], true);++ const reopenedPage = getVisibleProjectSessions(+ sessions,+ expandedByProject[projectKey] ?? false,+ );+ assert.deepEqual(reopenedPage.visibleSessions, sessions.slice(0, 10));+ assert.equal(+ reopenedPage.hiddenCount,+ sessions.length - DEFAULT_VISIBLE_PROJECT_SESSION_COUNT,+ );+});diff --git a/docs/spec/04-ux/08-component-spec.md b/docs/spec/04-ux/08-component-spec.mdindex 7fd48a937..247c4835d 100644--- a/docs/spec/04-ux/08-component-spec.md+++ b/docs/spec/04-ux/08-component-spec.md@@ -730,7 +730,7 @@ controls.| Project close | removes retained tab only; durable project/sessions remain || Project delete | row-menu danger action behind a second confirmation that names the project and the number of its sessions; refused with a message while any of those sessions is running and leaves group membership unchanged; removes the durable project row, those sessions, their transcripts, and its project memory; never deletes the folder on disk; deleting a root of a multi-folder project group detaches it as part of deletion, promotes the first remaining root when the primary is deleted, and removes the group record when its last root is deleted. A path the host no longer knows is still removed from the list. Detaching a root with chats through Edit project preserves them under a standalone project || Project memory | row-menu editor reads and saves a compact list of titled or untitled memory cards for the exact project path; cards can be added, edited, and removed, the context is available in later chats, and it is never a higher-priority instruction |-| Session list | exact-path matches only; no basename grouping |+| Session list | exact-path matches only; no basename grouping; the latest ten unpinned sessions appear initially, Load more reveals the remaining history, and collapsing the project clears that expanded-list state so the next expansion returns to the initial ten || Active group | exactly one group reflects the selected host workspace || Task state | In-progress, selected, completed, and failed indicators update by session without replacing the visible transcript; precedence is in-progress, selected, then terminal outcome |diff --git a/docs/spec/04-ux/09-interaction-patterns.md b/docs/spec/04-ux/09-interaction-patterns.mdindex fe3d6aa2d..e6cc5f930 100644--- a/docs/spec/04-ux/09-interaction-patterns.md+++ b/docs/spec/04-ux/09-interaction-patterns.md@@ -229,12 +229,13 @@ may be retained while exactly one workspace supplies the visible shell context.bridge. Its path then drives topbar identity, active workspace state, andnew-task scope.3. **Collapse** — disclosure state belongs to each project path. Collapsing- hides children only; it neither changes the selected session nor stops a- run. The directory row is one full-width disclosure target containing its- chevron, folder, and label: selecting an inactive directory activates it- first, and every directory-row click toggles that group's children without- changing any other group's state. Project actions are separate sibling- controls and never toggle the directory.+ does not change the selected session or stop a run, and clears that group's+ loaded-more session history so its next expansion starts with the initial+ ten unpinned sessions. The directory row is one full-width disclosure target+ containing its chevron, folder, and label: selecting an inactive directory+ activates it first, and every directory-row click toggles that group's+ children without changing any other group's state. Project actions are+ separate sibling controls and never toggle the directory.4. **Close** — closing removes only the retained tab. If it was active, thelast remaining tab is selected or the visible workspace is cleared. Durableprojects, sessions, and transcripts remain.diff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.mdindex 63b87d44b..27936fb3b 100644--- a/docs/spec/06-delivery/04-e2e-test-plan.md+++ b/docs/spec/06-delivery/04-e2e-test-plan.md@@ -9694,6 +9694,7 @@ must keep splitting are covered by `markdown-blocks.test.mjs`.| C — Conversation & stream | E2E-CHAT-long-history-stream-keeps-responsive, E2E-CHAT-running-status-survives-output-pauses, E2E-008, E2E-008d, E2E-008e, E2E-008a, E2E-009, E2E-010, E2E-011, E2E-011a, E2E-011b, E2E-011d, E2E-011e, E2E-011g, E2E-031, E2E-040, E2E-047, E2E-048, E2E-048A, E2E-049, E2E-052, E2E-053, E2E-054, E2E-055, E2E-059, E2E-059a, E2E-060c, E2E-060d, E2E-061, E2E-061a, E2E-062, E2E-064, E2E-065, E2E-068, E2E-071, E2E-073, E2E-074, E2E-075, E2E-081, E2E-083, E2E-084, E2E-086, E2E-087, E2E-088, E2E-088b, E2E-089, E2E-090, E2E-COMPOSER-narrow-controls, E2E-094, E2E-095, E2E-096, E2E-097, E2E-098, E2E-099, E2E-102, E2E-102a, E2E-102b, E2E-102c, E2E-102d, E2E-102g, E2E-106, E2E-109, E2E-111, E2E-114, E2E-116, E2E-117, E2E-118, E2E-119, E2E-120, E2E-121, E2E-218, E2E-259, E2E-219, E2E-AGENTS-001, E2E-142, E2E-144, E2E-145, E2E-146, E2E-146a, E2E-147, E2E-151, E2E-154, E2E-155, E2E-158, E2E-159, E2E-161, E2E-162, E2E-166, E2E-172, E2E-173, E2E-174, E2E-177, E2E-178, E2E-179, E2E-180, E2E-182, E2E-183, E2E-187, E2E-198, E2E-199, E2E-202, E2E-203, E2E-207, E2E-208, E2E-CHAT-content-width-handles, E2E-250, E2E-102i, E2E-PLUGIN-session-orchestrator-real-workers, E2E-SUBAGENT-settlement-updates-before-parent-poll, E2E-SUBAGENT-resume-a-settled-delegation || C — Conversation & stream (composer drafts) | E2E-011c, E2E-011c-1 || D — Workspace | E2E-012, E2E-013, E2E-022B, E2E-024I, E2E-047, E2E-049, E2E-057, E2E-058, E2E-060, E2E-068, E2E-075, E2E-078, E2E-153, E2E-158, E2E-182, E2E-187, E2E-252 |+| C / D / Quality — Project session history resets after collapse | E2E-263 || D — Workspace (project ordering) | E2E-253 || E — Tools & permissions | E2E-008a, E2E-014, E2E-015, E2E-016, E2E-017, E2E-018, E2E-019, E2E-024I, E2E-024K, E2E-040, E2E-049, E2E-074, E2E-093, E2E-097, E2E-099, E2E-100, E2E-101, E2E-102, E2E-102d, E2E-102e, E2E-102g, E2E-103, E2E-105, E2E-106, E2E-107, E2E-111, E2E-112, E2E-113, E2E-114, E2E-115, E2E-116, E2E-119, E2E-121, E2E-122, E2E-142, E2E-145, E2E-147, E2E-155, E2E-158, E2E-166, E2E-181, E2E-PLUGIN-imported-pi-package-skills || F — Persistence | E2E-020, E2E-021, E2E-021a, E2E-038, E2E-SETTINGS-inline-capability-imports, E2E-040, E2E-042, E2E-047, E2E-048, E2E-051, E2E-054, E2E-056, E2E-061, E2E-062, E2E-064, E2E-066, E2E-068, E2E-071, E2E-072, E2E-073, E2E-082, E2E-084, E2E-096, E2E-098, E2E-102, E2E-102b, E2E-102c, E2E-102d, E2E-102g, E2E-102i, E2E-103, E2E-AGENTS-001, E2E-061a, E2E-073a, E2E-104, E2E-106, E2E-107, E2E-108, E2E-109, E2E-110, E2E-112, E2E-118, E2E-119, E2E-120, E2E-121, E2E-123, E2E-142, E2E-146, E2E-146a, E2E-148, E2E-151, E2E-158, E2E-160, E2E-168, E2E-171, E2E-177, E2E-178, E2E-183, E2E-186, E2E-005J, E2E-PLUGIN-session-orchestrator-real-workers, E2E-PLUGIN-provider-catalog-add-service, E2E-SESSION-outbox-unclassifiable-failure-does-not-stall-the-queue |@@ -15570,9 +15571,10 @@ plugin-form fixtures in an isolated temporary directory at runtime.#### E2E-LAYOUT-sidebar-project-group-fold-- **Preconditions**: Four retained sidebar project groups, seeded through the+- **Preconditions**: Five retained sidebar project groups, seeded through thehost: one holding five sessions across four date buckets, one holding a singlesession, one holding none, and one holding ten pinned sessions.+ A fifth group has twelve unpinned sessions for the project history pager.`prefers-reduced-motion` is unset.- **Steps**:1. Inspect the groups: body layering, row and date-label counts, the empty@@ -15627,9 +15629,11 @@ plugin-form fixtures in an isolated temporary directory at runtime.- **Steps**: In dark and light themes, select a project conversation, hover itsproject title and an unselected conversation, then hover the selected row.Exercise the window-blur handler, drop-target styling, project action hover- and keyboard Tab/Shift+Tab focus. Fold and reopen the selected conversation's- group. Select pinned and standalone conversations. Open Settings and return.- Enable reduced motion and inspect both row transition durations.+ and keyboard Tab/Shift+Tab focus. Fold and reopen its group. Select pinned and+ standalone conversations. Open Settings and return. Enable reduced motion and+ inspect both row transition durations. In a separate twelve-session project,+ load the remaining two sessions, fold and reopen the group, and verify only+ the initial ten sessions remain visible.- **Expected**: Project and conversation hover backgrounds, radii and transitionsmatch. The title button stays transparent. Only a conversation uses selectedfill, which wins over hover; workspace identity remains a separate dot with@@ -15638,17 +15642,21 @@ plugin-form fixtures in an isolated temporary directory at runtime.retains an outline, action buttons retain local feedback, drop-target paintwins over hover, and blur releases hover without clearing selection. Settingsreplaces sidebar navigation, and returning restores conversation and workspace- context without a second selected row. Rendered component tests additionally- cover no selected session, a pending destination and non-chat page state.+ context without a second selected row. Loading more sessions reveals all+ twelve; folding and reopening restores the initial ten and the two-session+ remainder control. Rendered component tests additionally cover no selected+ session, a pending destination and non-chat page state.- **Specs linked**: `04-ux/01-ui-ia.md`, `04-ux/08-component-spec.md`,`04-ux/09-interaction-patterns.md` §9.1c- **Acceptance**: C, D, Quality- **Milestone**: Post-M6 desktop shell maintenance- **Status**: Automated via `pnpm test:e2e:layout` and`scripts/e2e/sidebar-row-states.mjs`: real CDP pointer/keyboard input and- computed-style assertions. Window blur/focus events and the drop-target class- are injected for those styling checks; this is not a native focus/drag test.- Unit coverage: `sidebar-navigation.test.mjs`, `sidebar-pinned-rendering.test.mjs`.+ computed-style assertions, plus the load-more / fold / reopen session-history+ flow. Window blur/focus events and the drop-target class are injected for those+ styling checks; this is not a native focus/drag test. Unit coverage:+ `sidebar-navigation.test.mjs`, `sidebar-pinned-rendering.test.mjs`, and+ `sidebar-project-sessions.test.mjs`.#### E2E-LAYOUT-sidebar-settings@@ -17202,6 +17210,28 @@ renderer's durable transcript reads. No real model or provider is contacted.`LinkifiedText` and `FilesTab` in isolated Electron with filesystem IPCfixtures; no real project files or provider are used.+#### E2E-263: Collapsing a project resets its loaded session history++- **Preconditions:** One retained project has at least twelve unpinned sessions,+ and its group can be expanded in the sidebar.+- **Steps:** 1. Expand the project and confirm the latest ten sessions plus a+ Load more control are visible. 2. Click Load more and confirm all twelve+ sessions appear. 3. Collapse the project, then expand it again. 4. Inspect the+ visible sessions and the Load more count.+- **Expected:** Reopening the project shows only the latest ten unpinned+ sessions, and Load more reports the two hidden sessions. The collapse clears+ only that project's loaded-more state; session selection and other project+ groups remain unchanged.+- **Specs:** `04-ux/08-component-spec.md` §3.9;+ `04-ux/09-interaction-patterns.md` §1.6.+- **Acceptance:** C / D / Quality.+- **Milestone:** Post-MVP maintenance.+- **Coverage:** `scripts/e2e/sidebar-row-states.mjs` exercises the full user path+ with a host-seeded project and real CDP pointer clicks. The unit test+ `sidebar-project-sessions.test.mjs` covers the initial page, Load more,+ collapse reset, and project isolation. `app-store-sidebar.test.mjs` checks+ that sidebar collapse and Load more use those transitions.+### Imported-extension GUI executable discovery regression (#1173)Start dependency installation with a GUI-like PATH that cannot resolve Node/npmdiff --git a/docs/zh-CN/spec/04-ux/08-component-spec.md b/docs/zh-CN/spec/04-ux/08-component-spec.mdindex 1efd8269d..4ec5a7b23 100644--- a/docs/zh-CN/spec/04-ux/08-component-spec.md+++ b/docs/zh-CN/spec/04-ux/08-component-spec.md@@ -543,7 +543,7 @@ expanded/collapsed 侧边栏仍为 20px/18px 且启动画面为 64 像素。| 项目结束 | 仅删除保留的选项卡;持久的项目与会话仍然存在 || 删除项目 | 行菜单中的危险操作,位于第二次确认之后,该确认会指明项目名称及其会话数量;只要其中仍有会话在运行就会先被拒绝并给出提示消息;移除持久项目行、这些会话、其转录本及其项目记忆;从不删除磁盘上的文件夹;属于多文件夹项目组的路径会被拒绝并给出提示消息,而宿主已不再知晓的路径仍会从列表中移除 || 项目记忆 | 行菜单编辑器读取并保存一份紧凑的、按规范项目路径键控的有标题或无标题记忆卡列表;卡片可添加、编辑和移除,该上下文在后续聊天中可用,且它绝不是更高优先级的指令 |-| 会话列表 | 仅精确路径匹配;无基本名称分组 |+| 会话列表 | 仅精确路径匹配;无基本名称分组;项目组初始显示最新的 10 条未置顶会话,“加载更多”显示剩余历史记录;折叠项目会清除该组的扩展状态,下次展开时恢复到初始的 10 条 || 活跃组 | 恰好一组反映了选定的主机工作区 || 任务状态 | 正在进行、已选择、已完成和失败的指标按会话更新,无需替换可见的记录;优先级是进行中、选择、然后是最终结果 |diff --git a/docs/zh-CN/spec/04-ux/09-interaction-patterns.md b/docs/zh-CN/spec/04-ux/09-interaction-patterns.mdindex 448de7e80..89795c8a0 100644--- a/docs/zh-CN/spec/04-ux/09-interaction-patterns.md+++ b/docs/zh-CN/spec/04-ux/09-interaction-patterns.md@@ -186,13 +186,8 @@2. **激活** — 选择不同的组调用现有的 `project.set`桥。然后,它的路径驱动顶栏标识、活动工作区状态,以及新任务范围。-3. **折叠** — 披露状态属于每个项目路径。崩溃- 仅隐藏儿童;它既不更改选定的会话,也不停止- 跑。目录行是一个全角公开目标,包含其- V 形、文件夹和标签:选择非活动目录将其激活- 首先,每次目录行单击都会切换该组的子级,而无需- 改变任何其他组的状态。项目操作是独立的兄弟项目- 控制并且从不切换目录。+3. **折叠** — 展开状态属于每个项目路径。折叠项目会清除该组已加载更多会话的状态,因此下次展开时会从最初的 10 条未置顶会话开始;折叠既不更改选定会话,也不停止运行。+ 目录行是一个全宽展开目标,包含其 V 形、文件夹和标签:选择非活动目录会先激活项目,每次目录行点击都会切换该组的子项,而不改变其他组。项目操作是独立的同级控件,不会切换项目组。4. **关闭** — 关闭仅删除保留的选项卡。如果它处于活动状态,则选择最后一个剩余选项卡或清除可见工作区。耐用项目、会议和成绩单仍然保留。diff --git a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.mdindex da9145fb1..fc0bda3fe 100644--- a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md+++ b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md@@ -5633,6 +5633,7 @@ eleven-tool-round desktop paths are verified by| B / F / Security — 提供商复制 | E2E-PROVIDER-copy-config-without-credentials || B / F / Quality — 已选模型顺序 | E2E-MODEL-selected-order-persists || E / F / Quality — MCP 服务器超时覆盖 | E2E-261 |+| C / D / Quality — 折叠项目后重置会话历史 | E2E-263 || A — 应用程序启动 | E2E-001、E2E-002、E2E-003、E2E-004、E2E-067、E2E-076、E2E-079、E2E-092、E2E-097、E2E-143、E2E-150、E2E-168、E2E-204、E2E-217 || B——模型配置 | E2E-005、E2E-005G、E2E-006、E2E-007、E2E-038、E2E-050、E2E-052、E2E-055、E2E-066、E2E-080、E2E-082、E2E-151、E2E-005J、E2E-199、E2E-201、E2E-202、E2E-203、E2E-209、E2E-166 || C — 对话和直播 | E2E-CHAT-running-status-survives-output-pauses、E2E-008、E2E-008d、E2E-008a、E2E-009、E2E-010、E2E-011、E2E-011a、E2E-011b、E2E-031、E2E-040、E2E-047、E2E-048、E2E-048c、E2E-048A、E2E-049、E2E-052、 E2E-053、E2E-054、E2E-055、E2E-059、E2E-059a、E2E-060c、E2E-060d、E2E-061、E2E-061a、E2E-062、E2E-064、E2E-065、E2E-068、E2E-071、 E2E-073、E2E-074、E2E-075、E2E-081、E2E-083、E2E-084、E2E-086、E2E-087、E2E-088、E2E-088b、E2E-089、E2E-090、E2E-094、E2E-095、E2E-096、 E2E-097、E2E-098、E2E-099、E2E-102、E2E-102a、E2E-102b、E2E-106、E2E-109、E2E-111、E2E-114、E2E-116、E2E-117、E2E-118、E2E-119、 E2E-120、E2E-121、E2E-代理-001、E2E-142、E2E-144、E2E-145、E2E-146、E2E-147、E2E-151、E2E-199、E2E-250、E2E-166、E2E-SUBAGENT-resume-a-settled-delegation |@@ -9481,6 +9482,16 @@ Follow the [current S3 acceptance scenario](/spec/06-delivery/04-e2e-test-plan#e- **规格:** `04-ux/08` §11.8;ADR 0262。- **状态:** `node scripts/e2e-file-ref-line-scroll.mjs` 在隔离 Electron 中挂载生产 `LinkifiedText` 与 `FilesTab`,并通过文件系统 IPC fixture 提供文件内容;不访问真实项目文件或模型服务。+#### E2E-263:折叠项目后重置已加载的会话历史++- **前提:** 侧边栏中保留一个至少有 12 条未置顶会话的项目,并可展开该项目组。+- **步骤:** 1. 展开项目,确认最新的 10 条会话和“加载更多”控件可见。2. 点击“加载更多”,确认 12 条会话全部显示。3. 折叠项目后再次展开。4. 检查显示的会话和“加载更多”数量。+- **预期:** 重新展开项目后只显示最新的 10 条未置顶会话,“加载更多”显示剩余的 2 条。折叠只清除该项目已加载更多的状态;会话选择和其他项目组不变。+- **规格:** `04-ux/08-component-spec.md` §3.9;`04-ux/09-interaction-patterns.md` §1.6。+- **验收:** C / D / Quality。+- **里程碑:** MVP 后维护。+- **覆盖:** `scripts/e2e/sidebar-row-states.mjs` 使用 Host fixture 项目和真实 CDP 指针点击验证完整用户流程。`sidebar-project-sessions.test.mjs` 覆盖初始页面、加载更多、折叠重置和项目隔离;`app-store-sidebar.test.mjs` 验证侧边栏折叠与加载更多使用对应状态转换。+### 导入扩展时发现 GUI 环境下的可执行文件回归(#1173)使用无法解析 Node/npm 的 GUI 风格 `PATH` 启动依赖安装,并在 `~/.local/bin` 准备可信 fixture 安装。diff --git a/scripts/e2e-three-column-layout.mjs b/scripts/e2e-three-column-layout.mjsindex c578ce3dd..42b1fb773 100644--- a/scripts/e2e-three-column-layout.mjs+++ b/scripts/e2e-three-column-layout.mjs@@ -58,7 +58,7 @@ function resolveHostBinary() {}/**- * Seed four retained project groups into the same throwaway data directory the+ * Seed five retained project groups into the same throwaway data directory the* app will open, using only the host protocol:** alpha five sessions across four date buckets, so the group draws date@@ -67,6 +67,7 @@ function resolveHostBinary() {* gamma no sessions, the empty group* delta ten sessions that the renderer pins, so the Pinned section has more* rows than its eight-row budget+ * history twelve unpinned sessions for the project load-more reset flow** `session.import` is the only protocol entry point that accepts a session's own* timestamps, which is what puts rows in the yesterday / this-week / older@@ -84,7 +85,8 @@ async function seedSidebarProjects(hostBinary, dataDir, tempDirs) {const beta = join(projectRoot, "beta");const gamma = join(projectRoot, "gamma");const delta = join(projectRoot, "delta");- for (const dir of [alpha, beta, gamma, delta]) mkdirSync(dir, { recursive: true });+ const history = join(projectRoot, "history");+ for (const dir of [alpha, beta, gamma, delta, history]) mkdirSync(dir, { recursive: true });const startOfToday = new Date();startOfToday.setHours(0, 0, 0, 0);@@ -145,6 +147,12 @@ async function seedSidebarProjects(hostBinary, dataDir, tempDirs) {await importRow(id, title, delta, updatedMs);pinnedSessionIds.push(id);}+ const historySessionIds = [];+ for (let index = 0; index < 12; index += 1) {+ const id = `e2e-history-project-${index}`;+ await importRow(id, `history session ${index}`, history, Date.now() - index * 1_000);+ historySessionIds.push(id);+ }// The host canonicalizes every project path; read the stored values back so// the renderer's retained-tab list matches exactly.@@ -157,15 +165,17 @@ async function seedSidebarProjects(hostBinary, dataDir, tempDirs) {beta: canonical("e2e-fold-beta-0"),gamma,delta: canonical("e2e-fold-delta-0"),+ history: canonical("e2e-history-project-0"),};- if (!paths.alpha || !paths.beta || !paths.delta) {+ if (!paths.alpha || !paths.beta || !paths.delta || !paths.history) {throw new Error(`seeded sessions carry no project path: ${JSON.stringify(paths)}`);}return {paths,alphaSessionIds,pinnedSessionIds,- keys: [paths.alpha, paths.beta, paths.gamma, paths.delta],+ historySessionIds,+ keys: [paths.alpha, paths.beta, paths.gamma, paths.delta, paths.history],};} finally {await host.stop();@@ -1456,6 +1466,7 @@ async function main() {[sidebarSeed.paths.beta]: { order: 1 },[sidebarSeed.paths.gamma]: { order: 2 },[sidebarSeed.paths.delta]: { order: 3 },+ [sidebarSeed.paths.history]: { order: 4 },},projectSort: "manual",sessionView: { sort: "recent", archived: false },diff --git a/scripts/e2e/sidebar-row-states.mjs b/scripts/e2e/sidebar-row-states.mjsindex 453d463e0..5803f7b5e 100644--- a/scripts/e2e/sidebar-row-states.mjs+++ b/scripts/e2e/sidebar-row-states.mjs@@ -224,6 +224,57 @@ export async function checkSidebarRowStates({ cdp, check, waitFor, seed }) {"reduced motion suppresses both project and conversation hover transitions",JSON.stringify({ reducedHeader, reducedRow }),);++ const historyGroup = group(seed.paths.history);+ const historyBody = `${historyGroup} .sidebar-session-group-body`;+ const historyLoadMore = `${historyGroup} .sidebar-load-more`;+ const historyRowIds = () => cdp.evaluate(`+ [...document.querySelectorAll(${JSON.stringify(`${historyGroup} [data-sidebar-session-row]`)})]+ .map(element => element.getAttribute('data-sidebar-session-row'))+ `);+ const expectedInitialIds = seed.historySessionIds.slice(0, 10);+ await waitFor(+ async () =>+ (await historyRowIds()).length === 10 &&+ (await cdp.evaluate(`!!document.querySelector(${JSON.stringify(historyLoadMore)})`)),+ "history project starts with ten sessions and a load-more control",+ );+ check(+ JSON.stringify(await historyRowIds()) === JSON.stringify(expectedInitialIds),+ "project history initially shows the ten most recent sessions",+ JSON.stringify(await historyRowIds()),+ );+ await click(historyLoadMore);+ await waitFor(+ async () => (await historyRowIds()).length === 12,+ "history project loads all twelve sessions",+ );+ check(+ JSON.stringify(await historyRowIds()) === JSON.stringify(seed.historySessionIds),+ "Load more reveals the remaining project sessions",+ JSON.stringify(await historyRowIds()),+ );+ await click(title(seed.paths.history));+ await waitFor(+ () => cdp.evaluate(`document.querySelector(${JSON.stringify(historyBody)}).inert`),+ "history project folds after loading more",+ );+ await click(title(seed.paths.history));+ await waitFor(+ async () =>+ !(await cdp.evaluate(`document.querySelector(${JSON.stringify(historyBody)}).inert`)) &&+ (await historyRowIds()).length === 10,+ "history project reopens with its initial session page",+ );+ const resetLoadMoreText = await cdp.evaluate(+ `document.querySelector(${JSON.stringify(historyLoadMore)})?.textContent.trim() ?? null`,+ );+ check(+ (await historyRowIds()).join() === expectedInitialIds.join() &&+ resetLoadMoreText?.includes("2"),+ "folding a project resets its loaded history and restores the two-session remainder",+ JSON.stringify({ rowIds: await historyRowIds(), loadMoreText: resetLoadMoreText }),+ );} finally {await cdp.send("Emulation.setEmulatedMedia", { features: [] });await cdp.evaluate(`(() => {diff --git a/scripts/e2e/sidebar-settings.mjs b/scripts/e2e/sidebar-settings.mjsindex a22f6f6b5..9d42f7e53 100644--- a/scripts/e2e/sidebar-settings.mjs+++ b/scripts/e2e/sidebar-settings.mjs@@ -127,10 +127,15 @@ export async function checkSidebarSettings({ cdp, check, waitFor, artifactDir })String(sameChat),);const trace = await finishTrace();+ // MutationObserver may sample the same commit before computed layout settles.+ // Ignore only leading zero-width samples; any later width change still fails.+ const firstVisibleFrame = trace.frames.findIndex((frame) => frame.width > 0);+ const checkedFrames =+ firstVisibleFrame >= 0 ? trace.frames.slice(firstVisibleFrame) : trace.frames;check(trace.animations.length === 0 && (collapsed? trace.frames.length === 0- : trace.frames.length > 0 && trace.frames.every(frame => Math.abs(frame.width - width) < 0.5 && frame.animation === "none")),+ : checkedFrames.length > 0 && checkedFrames.every(frame => Math.abs(frame.width - width) < 0.5 && frame.animation === "none")),`${label}: settings return restores layout without sidebar entrance`,JSON.stringify({ animations: trace.animations, widths: trace.frames.map(frame => Math.round(frame.width)) }),);