Repository navigation
fix(workspace): preserve research reading and expanded task layout - #9132
Conversation
Integrate the existing #8973 record reader and the retained search-focus follow-up from 9932d870ef. Keep exact saved source identity and historical failures available during reload. Signed-off-by: LoopX Agent <[email protected]>
Carry 641df68d09 onto the current research reader candidate. A single content wrapper keeps the existing task disclosure groups and layout eligible in Chromium. Signed-off-by: LoopX Agent <[email protected]>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · Gemini · Google DeepMind · self_reported
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
动机 / Motivation
在 Dashboard 或打包后的 Chat 页面中浏览研究记录(Research history)与概览任务列表(Overview)的 Goal 负责人或只读审阅者。修改前,研究记录抽屉的展开状态、关键词搜索、状态筛选、分页页码(limit)以及已展开的条目仅保存在组件本地 state 中,刷新页面或跨 Goal、跨来源浏览后触发浏览器的前进/后退时会全部重置;同时概览页中每个负责人折叠组内的其余任务按钮直接作为 details 子节点渲染,在 Chromium 下曾出现偶发漏排(200 项仅显示 184 项)。修改后,研究记录抽屉的状态以 Goal 与物理来源为作用域序列化写入 URL 查询参数 research_records,并在刷新或前进/后退时精确恢复展开条目与键盘焦点;概览折叠组内任务统一包入单一 div 容器。
同一 Goal 与同一物理来源下,刷新页面、切换概览/研究标签页以及浏览器 Back/Forward 都能恢复研究记录抽屉开关、搜索词、状态筛选、已加载页大小(如 limit=100)和已展开条目,并在恢复后将焦点稳定落在原展开条目的 summary 上;当变更或清除筛选条件时重置为首屏 50 项并折叠展开项;切换至其他 Goal 或来源时保持关闭而不串读;当原展开分组在当前快照中不可用时,仅以 role=status 提示不可用而不静默选中其他记录;概览折叠组在桌面和窄屏下均完整呈现全部 200 项任务。
边界说明:本 PR 不改动后端研究历史数据源、不触发新的模型分析或写操作、不改变默认折叠首屏布局,也不将前端 URL 书签迁移到原生桌面窗口偏好的持久化存储。
改动思路 / Approach
本 PR 在现有路由与组件所有权体系内完成两点聚焦修复。将研究记录的本地浏览书签严格限定在前端 URL 位置契约内(由 useResearchRecordsLocation 负责 replaceState 与 popstate 同步,由 readResearchRecordsLocation 以 Goal 和物理来源组合键做反序列化隔离),使浏览器历史与页面刷新成为唯一阅读定位载体,避免引入第二套前端持久化状态或触发额外后台请求;同时在 RemainingWork 中以单层 div 包裹折叠任务列表,属最小可逆的 DOM 容器修正。
从数据流与历史栈看,用户点击任务或研究记录内的筛选、分页与条目展开操作通过 window.history.replaceState 原地更新当前历史条目的 research_records 查询参数,因此不会污染目标切换或来源切换产生的 pushState 导航栈;当发生跨 Goal 或跨物理来源跳转时,路由层的 clearedResearchSearch 与读取层的 scope 校验共同形成双重隔离,防止同名 Goal 跨源继承旧阅读位置。当用户执行浏览器前进/后退或整页刷新时,useResearchRecordsLocation 通过 popstate 与初始化读取还原位置状态,并由 ResearchRecordSearch 的焦点恢复门控(consumeFocusRestore)在完整历史加载就绪后将焦点恢复至原展开条目的 summary,而不会在用户主动点击搜索按钮打开抽屉时抢夺搜索框焦点。当前 PR 边界仅覆盖 Dashboard/Chat 研究记录浏览器的 URL 状态读写、TanStack Router 白名单保留、单测与浏览器回归场景,以及 Overview 折叠体容器包装和前端交付文档同步;不修改任何后端控制面权限、默认展示密度或跨标签聚合策略。
在概览页方面,RemainingWork 将原本直接平铺在 <details class="goal-work-more"> 下的多条任务行统一收入一个 <div> 容器,既完全保留现有 .goal-work-more > summary 选择器与键盘焦点回落语义,也规避了 Chromium 对 <details> 多直系子节点插槽的偶发排版丢失。
具体改动 / Changes
关键代码讲解
apps/presentation/dashboard/src/features/personal-workspace/research-record-search.ts(readResearchRecordsLocation、writeResearchRecordsLocation)- 定义
ResearchRecordsLocation(open、query、status、expanded、limit)及默认关闭常量defaultResearchRecordsLocation。读取时严格校验:仅当research_records参数恰好出现 1 次(拒绝重复参数导致的歧义)、JSON 解析成功、字段类型合法(limit为不小于 50 的安全整数、expanded为去重后的非空字符串数组)且value.scope === scope时才采信,否则回退为关闭状态且不静默代选其他记录。
- 定义
apps/presentation/dashboard/src/features/personal-workspace/research-record-browser.tsx(useResearchRecordsLocation、ResearchRecordSearch、GroupedResearchRecord)useResearchRecordsLocation(scope)维护与当前scope(JSON.stringify([goalId, originalGoalId, readSourceUrl]))绑定的阅读位置与navigation计数,提供update(写replaceState并消费当前导航轮次的焦点恢复标志)与consumeFocusRestore。ResearchRecordSearch将局部 state 切换为受控reading.value,在complete && !busy后才消费焦点恢复标志并将焦点移至原展开项;当expanded中的条目不在allGroups内时展示明确的role="status"不可用提示;修改或清除筛选词时重置limit: 50与expanded: []。GroupedResearchRecord与单条记录统一采用受控open与onToggle同步。
apps/presentation/dashboard/src/features/personal-workspace/goal-research-history.tsx&apps/presentation/dashboard/src/router.tsxGoalResearchHistory将抽屉展开状态托管给useResearchRecordsLocation(historySource),在<details className="research-history-all-records">的onToggle中仅在状态实际变化时更新,避免初始化重复写 URL;router.tsx在researchSearchShape中登记research_records: z.unknown().optional(),确保同一 Goal 内标签切换保留参数,同时clearedResearchSearch自动在跨 Goal/跨源切换时清除该参数。
apps/presentation/dashboard/src/features/personal-workspace/goal-workspace-work.tsx(RemainingWork)- 将
<details className="goal-work-more">的{children}包裹于单个<div>中,不改变样式钩子或OwnerWorkGroups焦点恢复逻辑。
- 将
docs/development/frontend-delivery.md、apps/presentation/dashboard/src/features/personal-workspace/research-record-search.test.mjs、examples/personal-workspace-browser/research-source-recovery.ts- 文档同步补充已加载记录阅读器的 URL 恢复与隔离契约;单测新增作用域隔离、畸形/重复参数恢复与分组保留用例;Playwright 浏览器场景新增开关抽屉、搜索框聚焦、跨源 Back/Forward 与原展开条目焦点恢复断言。
规范对齐(docs/development/design.md @ eb552a8bb0532de117513ee5277a92e74e746309)
本 PR 未修改目标规范文档 docs/development/design.md,基于基准提交 eb552a8bb0532de117513ee5277a92e74e746309 逐条核对如下:
research-workspace-reload-back-forward(IMPLEMENTED):刷新与浏览器 Back/Forward 恢复研究阅读视图、筛选与原展开焦点,且只读不触发写操作(research-record-browser.tsx、research-source-recovery.ts)。research-workspace-goal-source-isolation(IMPLEMENTED):阅读状态严格绑定 Goal 与物理来源组合scope,同名 Goal 跨源不继承(research-record-search.ts、router.tsx、research-record-search.test.mjs)。research-workspace-default-folding(IMPLEMENTED):默认首屏保持全部已读记录抽屉折叠,未破坏既有层级展示(research-record-search.ts、research-record-first-1440.png)。overview-work-group-expansion(IMPLEMENTED):概览负责人任务组默认折叠超出 3 项的后续任务,展开后可完整访问全部 200 项任务且无布局丢失(goal-workspace-work.tsx、goal-workspace-m2.mjs)。
(注:PR 同步更新了 docs/development/frontend-delivery.md 第 152–158 行,将上述已加载记录阅读器行为正式写入交付文档,与既有设计契约一致。)
对主干的风险 / Risks
- 非阻塞观察(低风险):
ResearchRecordSearch中的toggle闭包读取渲染期reading.value.expanded来拼接下一组展开数组,而非读取同步 ref。在人类逐项点击或键盘切换场景下不会触发并发覆盖;仅在极端的同一帧脚本连续切换多个<details>且未等 React 提交渲染时才可能发生后者覆盖前者,可在后续顺手改为基于current.current的函数式更新,不构成当前合入阻塞。 - 隔离与兼容边界:
research_records为新增纯阅读态查询参数,未携带时完全回退到默认折叠与limit=50,与既有直链书签和clearedResearchSearch完全兼容;对禁用/非研究页面无任何副作用。 - 生产调用链确认(
scope_fit):全部变更均有真实生产调用链(DashboardPage->GoalResearchHistory->ResearchRecordSearch/GoalWorkspaceWork),无死代码或孤立模块。 - 本地验证矩阵(Exact Head
0bd2e50e924da7a8c2e73f57782e12e95b500009):node --experimental-strip-types --test apps/presentation/dashboard/src/features/personal-workspace/research-record-search.test.mjs:PASS(7 passed / 0 failed)。npm --prefix apps/presentation/dashboard run build(tsc --noEmit && vite build && npm run build:chat):PASS(打包与 Chat bundle 校验通过)。LOOPX_PERSONAL_WORKSPACE_PACKAGED=1 LOOPX_PERSONAL_WORKSPACE_SCENARIO=research-record-search node examples/personal-workspace-browser-smoke.mjs:PASS(5365ms,后端只读无写入)。LOOPX_PERSONAL_WORKSPACE_PACKAGED=1 LOOPX_PERSONAL_WORKSPACE_SCENARIO=research-source-recovery node examples/personal-workspace-browser-smoke.mjs:PASS(2206ms,含跨源失败/恢复与 Back/Forward 焦点恢复)。LOOPX_PERSONAL_WORKSPACE_PACKAGED=1 LOOPX_PERSONAL_WORKSPACE_SCENARIO=goal-workspace-m2 node examples/personal-workspace-browser-smoke.mjs:PASS(11657ms,expandMs=82.7ms,200/200 任务完整展开无超时)。- 独立 Playwright 反事实探针(覆盖第 2 页
limit=100展开后整页reload()、Overview <-> Research标签页往返、过滤词变更重置、Goal One -> Goal Two -> Back隔离与焦点恢复、缺失expandedID 状态提示不代选):PASS(全部断言通过)。 uv run --extra test loopx canary premerge --from-git-diff --git-diff-base origin/main --tier quick:PASS(4 项 direct checks 含check_rfc_bilingual.py、3 项 catalog canaries、1 项loopx check公私边界扫描全数通过)。- 历史远程 CI 观察(
required=false诊断项):Release Artifacts browser partition 1已于同 head 通过;Pages 断链、Windows SQLite lease 与 mutation locator 属既有无关或非本地环境诊断项,不阻塞本 PR 正确性评价。
我的整体评价 / Verdict
综合评估,long_horizon 为 improved(刷新与前进/后退不再丢失长程研究排查进度与定位),user_experience 为 improved。已通过打包构建后的 Chat bundle 与 Playwright 真实 Chromium 运行核查桌面端(1440x900)与移动端窄屏(390x844/900)的默认折叠首屏、搜索筛选展开态、版本对比视图及 200 项任务概览页;默认研究视图保持折叠与首屏一致性,展开长记录列表、版本比对和任务折叠体在宽窄视口下均无横向溢出或遮挡,缺失条目亦以明确状态提示兜底。
剩余未验证范围:已验证本地构建与打包后的 macOS arm64 Chromium 渲染;PR 描述提及的旧版远程 hosted Ubuntu x86_64 偶发 184/200 现象无法在本地复现(本地 macOS 稳定显示 200/200),且远程 hosted x64 上的 research-source-recovery 独立运行结果尚未在本机闭环(按 Goal 配置不依赖远程 CI 状态)。
就代码体量与架构边界而言,变更精简克制(8 个文件 +185/-25,纯本地客户端状态契约扩展与单容器 DOM 修复),完全复用已有 researchSearchShape / clearedResearchSearch 与 GoalResearchHistory 所有权边界,未引入新后端状态或冗余配置,也不涉及全局语义词表新增(research_records 属本地局部 URL 书签字段)。在精确提交 0bd2e50e924da7a8c2e73f57782e12e95b500009 上本地验证与视觉检查均已完备通过,建议批准。
English verdict: APPROVE — exact head 0bd2e50 has no blocking findings; 7/7 unit tests, dashboard/chat build, 3 packaged Playwright browser suites (including 200-item expansion and cross-source Back/Forward focus recovery), custom reload/tab counterfactuals, and quick premerge checks all passed.
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI (runtime_reported, xhigh)
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
动机 / Motivation
在工作台切换来源、重载后继续阅读研究记录的读者,以及展开负责人任务组查看长列表的使用者。 旧版重载会关闭记录抽屉,丢失已选筛选及原记录。展开较大的任务组也有过任务行未全部呈现的报告。 候选从同一 Goal 和物理来源恢复筛选、展开项与焦点,保留原记录。任务概览中的余项收在同一展开容器内,合成 200 项在两种宽度全部可见。 已独立验证本机打包 Web 界面、实际只读 HTTP 服务及仓库留存输入,任务布局使用合成 200 行。正式安装 App、真实来源采用和间歇性旧布局故障的跨平台触发仍待验证。
改动思路 / Approach
在现有研究位置使用受 Goal 和物理来源约束的阅读书签,在既有任务 disclosure 中加入一个内容容器。 阅读状态收在 apps/presentation/dashboard/src/features/personal-workspace/research-record-browser.tsx。原记录从现有来源 HTTP 服务读取,任务行仍由现有工作清单提供。翻页、筛选和聚焦在当前浏览器历史条目内读回。
具体改动 / Changes
精确头 0bd2e50e924da7a8c2e73f57782e12e95b500009,当前主干整合干净,主要产品改动与精确头一致。浏览器验证使用本地打包产物。 原交付规范
关键代码讲解
resume-exact-source-reading已实现。以当前 Goal、原 Goal 和物理来源限定书签,再用已读原记录的 ID 还原展开和焦点。缺失组保留可见提示。 阅读位置 解析和来源范围render-all-expanded-tasks已实现。每个负责人组的余项进入一个展开内容容器。独立将实际组件放在 1440 和 390 像素的样例中,两边都呈现 200/200 个不同任务,第 200 项可用键盘选中。 任务 disclosure
对主干的风险 / Risks
主干整合树的生产构建和七项搜索回归通过。打包基线用同一来源验证时,重载关闭抽屉且失去输入。候选保留已展开记录、输入和键盘焦点。缺失的保存标识显示不可用,未选替代记录。切换到暂时读不到的第二来源时,旧记录未泄入;重试后读回第二来源的 11 条,浏览器后退再前进分别恢复 33 条与 11 条及其原焦点。 旧 Chromium 布局故障具有间歇性,这轮复测只确认候选的 200 项路径。未查询托管 CI。
我的整体评价 / Verdict
APPROVE。 桌面保留来源、时间线和记录入口。窄屏使用同一记录,标题和原文纵向换行,当前来源一直可辨。200 项布局实验包含长双语标题和混合状态。 已独立验证本机打包 Web 界面、实际只读 HTTP 服务及仓库留存输入,任务布局使用合成 200 行。正式安装 App、真实来源采用和间歇性旧布局故障的跨平台触发仍待验证。
English verdict: APPROVE at 0bd2e50e924da7a8c2e73f57782e12e95b500009. The packaged Web reader restores the correct source-scoped record through reload and Back/Forward, and the checked overview rendered all 200 synthetic rows on both widths. Installed App adoption and the intermittent baseline layout trigger remain unverified.
Research record filters, expanded entries and focus were lost after reload or source navigation. This carries the existing grouped reader recovery onto current integration history and keeps all owner task rows inside one disclosure body, addressing an intermittent Chromium layout loss.
Replaces the implementation proposal in #8973 with its retained search-focus and overview-layout follow-ups. Reading stays scoped to the original Goal/source; unavailable saved identities remain unavailable rather than selecting another record. No source records or execution permissions change.
Validation
Tested revision:
0bd2e50e924da7a8c2e73f57782e12e95b500009(two signed commits; base8e9a28a866da06cc6fd63e78709910fe35dad564). The branch merges cleanly with maineb552a8bb0532de117513ee5277a92e74e746309at submission.Visual evidence
Screenshots below use synthetic inputs and the exact packaged revision above. The default research viewport is unchanged; the behavior change preserves reading across reload/navigation. Desktop first viewport, narrow comparison and overview composition are attached here.
Hosted validation readback (2026-11-20)
The existing Release Artifacts browser partition 1 passed on hosted Ubuntu x64 with an isolated installed wheel. Its provenance checks bind the wheel to PR head
0bd2e50e924da7a8c2e73f57782e12e95b500009integrated with baseeb552a8bb0532de117513ee5277a92e74e746309as merge candidate4d8d2de7f9df5d6884d5933a7186b57179055fd5. The log confirms packagedresearch-results,research-history,research-turn-costs,research-record-searchandresearch-modescenarios passed. The previously unconfirmed browser partition 3 used the same checksum-verified installed wheel. Its result artifact records 29 passing scenarios, including:research-source-recoverypassed same-source refresh retention, failed cross-source switch and retry, source-scoped export with the original records, Back/Forward restoration, bilingual narrow/keyboard readback, analysis-scope focus and zero write requests. The two fixtures intentionally share a logical Goal ID.goal-workspace-m2independently passed all 200 overview rows and the view-switch budgets. The recorded expansion was about 218 ms in this hosted run. This was a synthetic workspace fixture.The artifact manifest binds both the product and test fixtures to
4d8d2de7f9df5d6884d5933a7186b57179055fd5, the merge candidate for the head and base above. The wheel SHA-256 is7a8147d095b45a825010b64db9b1a3c1914361e360125b986dd563172b561fca. Git reports a clean merge tree with current main64353773dc.All three hosted browser partitions passed 87 distinct scenarios from the same candidate artifact. Partition 2 includes the retained-record research workspace replay.
An isolated local replay of that same installed wheel passed the retained Grid on/off, Ad placement and Schemathesis histories. All 393 source records survived paged reading and JSON export in their original order. The Ad history spans 14h 03m and the Schemathesis history spans 45h 48m. Desktop and 390 px checks preserved a rejected result and 39 saved revisions of an Ad finding. The replay also checked saved Graph citations and kept missing adoption or cost evidence visible. Browsing made zero source mutations.
Matched CI baseline
The hosted checks ran at merge candidate
4d8d2de7f9df5d6884d5933a7186b57179055fd5, whose first parent is maineb552a8bb0532de117513ee5277a92e74e746309.refresh_task_lease_unavailableon the exact base and the PR merge candidate. Base Windows job · PR Windows jobpublic_refresh_writes_owned_paragraphin the sameloopx/state_refresh.pysource. The PR's Stage2c aggregate failed because that job failed. Base Stage2c job · PR Stage2c jobturn-envelope-v0.md. The hosted Pages job counted the same warning. PR Pages jobCurrent main includes follow-up changes to the Windows fixture and Stage2c locator. The hosted results above remain attached to their original revisions. Windows fixture follow-up · Stage2c follow-up