Repository navigation
perf(chat): avoid repeated Explore timeline route scans - #8733
Conversation
Signed-off-by: aihop <4408344+hhyykk@users.noreply.github.com>
|
This pull request has merge conflicts with Choose the remote for the base repository, not an out-of-date fork. git fetch upstream
git rebase upstream/main
# Resolve each conflict, git add the resolved files, then git rebase --continue.
git push --force-with-lease origin HEADFor a same-repository clone whose Keep the DCO |
Signed-off-by: aihop <4408344+hhyykk@users.noreply.github.com>
Signed-off-by: aihop <4408344+hhyykk@users.noreply.github.com>
Signed-off-by: aihop <4408344+hhyykk@users.noreply.github.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent; model=gpt-6.1-sol; provider=OpenAI; declaration=runtime_reported; effort=max.
动机
让多路线 Explore 历史读取更快,保留记录、路线、连线、顺序和阅读控制。 apps/presentation/dashboard/src/features/personal-workspace/goal-research-timeline.tsx 是本次核验的实际用户入口。阅读内容、位置和选项保持一致。减少多路线渲染工作,单路线和线上端到端收益没有据此认证。 40路线原主干读取3280次节点标识,新头293次节点与126次边标识读取。36份完整HTML逐字一致。 计时是 arm64/macOS 与 Node 24 的本地 React SSR。浏览器布局、已安装 App 和在线延迟未测。
改动思路
对多路线先按 Typed routeId 分组,具体连线仍由成员位置过滤。单路线保留直接过滤。 保留现有 renderer 的局部索引。 索引只在多路线建立。每一条边仍必须拥有当前路线中有时间位置的两个端点,保留原来父关系与显式关系的渲染顺序。 现有入口
具体改动
GitHub 的历史比较是 587 条路径。以分支已合入的主干 c526242 为起点,提案有 5 条独有路径。本地合流到 c3e3ac5 成功。
固定夹具在两个物理源码树各自构建。arm64/Node 24 的 A-B-B-A 中,1,200 路线中位耗时约 131.6 ms → 33.3 ms。36 份中英文、筛选和部分历史的完整 HTML 逐字相同。 仓库原生 premerge 通过。 普通、小图及无路线、筛选和未完整历史也做了输出对照。类型检查和 14 项 Explore history 测试通过。
对主干的风险
基线的 40 路线回归按预期失败,新头通过。当前主干与该头的本地合流树保留现有工作流与包入口。 这个量级是本地渲染计时。单路线的小幅差异未建立显著性。没有发现内容漂移。保持 Benchmark 独立于发布路径,当前验证范围包括正常显示以及缺失端点被过滤。完整 App 与浏览器布局没有经过本地源代码 SSR 以外的验证。
我的整体评价
批准。没有发现阻塞项。 阅读内容、位置和选项保持一致。减少多路线渲染工作,单路线和线上端到端收益没有据此认证。 依据 docs/development/testing-and-quality.md 在 c3e3ac5 的 REAL_PATH,REGRESSION_SENSITIVITY。
同一 GoalResearchTimeline 真实生产 SSR 字节相同,未引入视觉或布局变化。 计时是 arm64/macOS 与 Node 24 的本地 React SSR。浏览器布局、已安装 App 和在线延迟未测。
English verdict: APPROVE. The 40-route sensitivity case and full-output parity support the bounded optimization.
The merge-base changed after approval.
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent; model=gpt-6.1-sol; provider=OpenAI; declaration=runtime_reported; effort=max.
动机
让多路线 Explore 历史读取更快,保留记录、路线、连线、顺序和阅读控制。 apps/presentation/dashboard/src/features/personal-workspace/goal-research-timeline.tsx 是本次核验的实际用户入口。阅读内容、位置和选项保持一致。减少多路线渲染工作,单路线和线上端到端收益没有据此认证。 40路线原主干读取3280次节点标识,新头293次节点与126次边标识读取。36份完整HTML逐字一致。 计时是 arm64/macOS 与 Node 24 的本地 React SSR。浏览器布局、已安装 App 和在线延迟未测。
改动思路
对多路线先按 Typed routeId 分组,具体连线仍由成员位置过滤。单路线保留直接过滤。 保留现有 renderer 的局部索引。 索引只在多路线建立。每一条边仍必须拥有当前路线中有时间位置的两个端点,保留原来父关系与显式关系的渲染顺序。 现有入口
具体改动
上一批准由作者以“The merge-base changed after approval.”为由撤销。我核对了两个主干提交与该精确头的实际 Git merge-base,均为 c526242。主干后来改动的四条路径不涉及本优化的 renderer、Core timeline 或依赖锁;本地 merge-tree 仍无冲突。发布前主干推进到 d210e4c;新增两处 Todo storage compatibility 改动已读,未涉及本优化,新的本地 merge-tree 也无冲突。因此沿用上一轮同头36份完整HTML和 A-B-B-A 实测,本轮重新执行40路线 smoke及当前目标的本地 premerge。
GitHub 的历史比较是 587 条路径。以分支已合入的主干 c526242 为起点,提案有 5 条独有路径。本地合流到 42483ac 成功。
固定夹具在两个物理源码树各自构建。arm64/Node 24 的 A-B-B-A 中,1,200 路线中位耗时约 131.6 ms → 33.3 ms。36 份中英文、筛选和部分历史的完整 HTML 逐字相同。 本轮仓库原生 premerge 通过:4项直接检查及8项选择检查。 普通、小图及无路线、筛选和未完整历史也做了输出对照。类型检查和 14 项 Explore history 测试通过。
对主干的风险
基线的 40 路线回归按预期失败,新头通过。当前主干与该头的本地合流树保留现有工作流与包入口。 这个量级是本地渲染计时。单路线的小幅差异未建立显著性。没有发现内容漂移。保持 Benchmark 独立于发布路径,当前验证范围包括正常显示以及缺失端点被过滤。完整 App 与浏览器布局没有经过本地源代码 SSR 以外的验证。
我的整体评价
批准。没有发现阻塞项。 阅读内容、位置和选项保持一致。减少多路线渲染工作,单路线和线上端到端收益没有据此认证。 依据 docs/development/testing-and-quality.md 在 42483ac 的 REAL_PATH,REGRESSION_SENSITIVITY。
同一 GoalResearchTimeline 真实生产 SSR 字节相同,未引入视觉或布局变化。 计时是 arm64/macOS 与 Node 24 的本地 React SSR。浏览器布局、已安装 App 和在线延迟未测。
English verdict: APPROVE. The 40-route sensitivity case and full-output parity support the bounded optimization.
The merge-base changed after approval.
Signed-off-by: aihop <4408344+hhyykk@users.noreply.github.com>
Signed-off-by: aihop <4408344+hhyykk@users.noreply.github.com>
Signed-off-by: aihop <4408344+hhyykk@users.noreply.github.com>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.1-sol · OpenAI · runtime_reported · reasoning_effort=max
动机 / Motivation
阅读大量研究路线的用户在打开历史时间线时,每条路线都会重复扫描全部节点和关系,历史越多,渲染成本越高。本 PR 在一次渲染中按已有路线归组,再为每条路线读取自己的节点和关系,减少重复扫描。可观察结果是多路线页面保持相同完整内容,同时降低本地组件渲染时间;小历史和单路线不承诺提速。本次不改变历史来源、路线含义、时间分组、证据可见性或用户操作,也不宣称已经改善线上或已安装应用的整体延迟。
改动思路 / Approach
位置和粒度合适:已有 Explore history parser/projector 继续解释原始记录,buildExploreTimeline 继续按显式关系和 parent grouping 生成连通路线;React 组件只在渲染时建立索引,不产生新的研究事实或维护另一份持久图。节点来源顺序和 edge 数组顺序都被保留,之后仍通过原来的已知时间、路线成员和 endpoint 过滤条件决定哪些弧线可以显示。不存在新增权限、激活设置或用户补录步骤。
保留当前组件内的局部索引,比添加全局缓存、持久索引或虚拟化框架更小;single-route 分支继续沿用原路径,避免没有收益时额外分配索引。当前 PR 的边界是相同数据与交互下减少渲染扫描,不需要顺带重写历史读取和用户界面。为独立比较,我用同一 head 的测量 harness 和依赖,仅以基线的不可变组件源码替换该一个生产模块,执行 A-B-B-A;这是一组本地 production-mode SSR 测量,不是线上端到端延迟。
具体改动 / Changes
本次重新审查完整 head 2ccf6814b40b85a5740a885a183872bdc8e065a4,基线 d210e4cc1d002f92498b2811c565b9430e79f4c1。五个文件共增加 167 行、删除 2 行:生产组件 +23/-2,88 行可复用 benchmark、53 行语义与扫描 smoke、两个 npm scripts,以及现有 dashboard CI job 的一条 smoke 命令。没有把旧 head 的已撤销结论当作当前证据。基线、当前 head 与本轮抓取的最新 main 的 parser、timeline owner 和 dashboard lockfile 相同;相关源码与入口查找未发现另一处已落地的等价渲染索引。
关键代码讲解
GoalResearchTimeline中的索引构建 从同一次渲染的timeline.nodes和timeline.edges归组。缺失 endpoint 或跨路线的关系不会进入索引;索引不替代 parser 的状态和权限规则。- 每条路线的弧线构建 读取自己的候选集合,继续以
position.has排除未知时间和缺失 endpoint,并保持 parent 弧线与 typed edge 的来源次序。时段高亮、完整/部分历史、双语文案与原交互均未改动。 explore-timeline-scan-smoke通过真实 parser、projection、timeline 和组件渲染验证 40 条路线、反驳边、乱序 parent、未知时间与悬空关系。它同时检查内容/顺序和线性来源访问上界,不依赖特定机器的毫秒阈值。explore-timeline-benchmark冻结输入、保存完整 HTML,分别测量公开 checkpoint、1200 条路线和单条路线。每个进程预热 3 次、计时 12 次,并校验重复输出;npm scripts 提供复现入口,workflow 将扫描回归纳入原 dashboard job。
未找到专门规定这个渲染优化验收的已接受书面规范,spec basis 为 no_spec;采用原有公开调用路径、记录不丢失和显示顺序作为独立语义判据,没有把未来 RFC 目标改写为当前义务。既有历史负例与未知时间不能因优化而隐藏。
对主干的风险 / Risks
没有发现阻塞问题。最强反例是索引错误地丢弃反驳边、parent 顺序变化、未知时间记录消失,或者缓存跨 reload 留下陈旧内容。当前索引每次渲染从同一个 typed projection 派生并随调用结束释放;旧的过滤条件仍在,避免另设失效、迁移或重试 owner。实跑 smoke 在原组件上先通过内容断言,再以节点被访问 3280 次失败;当前组件通过,节点/edge 来源访问分别为 293/126 次。该失败基线证明检查能抓到原始重复扫描,而不只是对新 helper 自证。
PASS:14 项 Explore history 测试、dashboard TypeScript 与 production build、control-plane typecheck、standard premerge(无失败、无 hold)。同一冻结输入 SHA-256 df0746f2aaa6573062faf72fe90ad5c394ad0654c6500414a26e18f8f58b5ace,在 Node v24.21.0、NODE_ENV=production 下四个独立进程的 36 份完整 HTML 全字节相同,覆盖中文全部、英文时段和中文部分历史。未读取或等待远端 CI;作者旧环境的测量不作为本次执行结果。
| 场景 | 基线 A1 / A2 中位数 | head B1 / B2 中位数 |
|---|---|---|
| 1200 路线、2400 节点、1248 条关系 | 55.625 / 57.035 ms | 13.300 / 13.850 ms |
| 单路线、800 节点 | 1.250 / 1.181 ms | 1.238 / 1.399 ms |
| 公开小 checkpoint、66 节点 | 0.128 / 0.137 ms | 0.130 / 0.141 ms |
大输入的改善可重复,小输入差异不支持收益声明。索引增加一次渲染中的线性引用存储;未做独立堆峰值测量,也未证明安装版端到端提速。没有 feature-off 或新版本兼容分支;数据、默认值、字段、设置、用户交互和持久化契约保持原状。回退只需撤销局部索引,不需迁移记录。
我的整体评价 / Verdict
APPROVE。这是完整且可逆的局部性能修复:使用现有 owner 的 typed 路线投影,验证了原始成本下降,完整历史输出保持一致。long_horizon 的记录、证据和后续读取语义得到保留;user_experience 保留原操作路径,并在多路线组件渲染上有实测改善,没有新增导航、输入或确认轮次。代码量与问题相称,当前无需拆模块或另造缓存生命周期;single-route 的低成本原路径有独立对照支持保留。
视觉检查不适用:完整 diff 没有样式、文案或布局修改,且 36 份完整渲染输出一致;本轮没有新增浏览器视觉检查。未验证范围为实际浏览器布局、已安装产品、全链路延迟和堆峰值;这些没有被本结论宣称已改善。当前结论覆盖完整 head,仍须在发布前核对其未变化;通过本次审查不授予合入权限。
English verdict: APPROVE at 2ccf681. Base/head output parity and independent A-B-B-A measurements support the local render optimization; native checks pass, with no blocking finding.
Current delivery (2026-11-17)
The Explore timeline previously scanned all nodes and edges separately for every route. This PR groups route parents and edges once while preserving source order and all existing rendering filters. It now includes main
d210e4cc1d002f92498b2811c565b9430e79f4c1.The shared queue/browser failure was independently fixed upstream by #8892, and historical Todo field compatibility by #8902. Those changes are reused from main; the final PR diff remains the original five performance files.
Validation
c526242source baseline and merged candidate were built with Vite SSR using the same dependencies and fixed dataset. The 40-route regression failed on main with 3,280 node identity reads and passed after optimization with 293 node and 126 edge identity reads.df0746f2aaa6573062faf72fe90ad5c394ad0654c6500414a26e18f8f58b5ace.These are medians of process medians on the local machine, not browser/online latency or a p95 claim. The small checkpoint did not improve. A separate V8 CPU capture exited successfully and located the repeated node/edge filters in the baseline; profile time is excluded from these measurements. Raw profiles and HTML remain private local artifacts.
Dashboard typecheck and the scan smoke passed. Standard premerge passed 4 direct and 8 selected checks after upstream reconciliation. The timeline implementation and benchmark dependencies are unchanged by the later main commits. The 20 upstream coordination projection regressions also passed. Pushed-head CI is checked separately. This PR does not change or remove historical events.
Historical qualification notes (preserved)
Problem and change
A timeline with multiple research routes scanned every node and every edge for each route. Group parent nodes and recorded edges once, preserving their source order and the existing handling of missing or unplaced endpoints. A single route keeps the direct read.
Validation
Main 45cfd0c follow-up: the timeline file merged in memory without a text conflict. A Vite SSR comparison used the same verified main-source overlay and the PR benchmark harness for baseline and candidate; the public-checkpoint source fixture and dependency lockfile matched the existing checkout. The synthetic fixture included timed and undated structured decisions. The original 40-route scan check failed on baseline with 3,280 node identity reads and passed on the candidate with 293 node and 126 edge reads. Eight counterbalanced processes (A-B-B-A repeated), each with 12 warm samples, produced 72 byte-identical complete HTML outputs. The median of process medians for 1,200 routes was 154.314 ms before and 54.281 ms after (-64.8%); the single-route case was 3.995 ms versus 4.205 ms, and the public checkpoint was 0.560 ms versus 0.705 ms. Fixture SHA-256: ae2a098fa21857c79c6cc9c454ee8978556ca7573ab3f879694242cacad9944a. This is local Node 26 production SSR with an in-memory source overlay, not browser, online or native CI latency; no combined checkout was created.
Main 859a23e preflight: the merge base is 53e80ca. Complete GitHub inventories contain five branch paths and 278 main paths, with two overlaps. Each overlap merged without text conflicts using in-memory git merge-file. A static YAML check retained all 20 main jobs, their job controls, and all existing step and nonblank run lines; one smoke line was added. The dashboard package retained all 87 main scripts and dependency sections, with two scripts added. Negative controls detected a removed job, a changed job control and removed run content. Both PR commits have Signed-off-by trailers. This is a file-level and static check, not a full-tree merge, runtime workflow execution or CI result.
Current-main compatibility note: PR #8703 TypeScript core shard 2 exposed a duplicate SHA-256 matcher already present in its main parent. The old main base used by this PR did not contain the new inbox module. A virtual-source scan of main 97fb254 reproduces the guard failure; this PR has not been tested as a full merge against that main.
Dashboard browser shard 3 passed the uninstrumented goal-workspace-m2 qualification with 200 items and a 771 ms expansion; its coverage pass also completed. This is CI on the recorded merge revision and does not establish performance on newer main.
Main follow-up at dd53ca5: the workflow and dashboard package file merge without text conflicts in an in-memory three-way check. For python-tests.yml, a static YAML comparison found no removed or reordered main jobs, steps or existing run lines, and no changes to the checked job, step or workflow controls. The PR adds one run line. This is not a full-tree merge or an integrated CI run.
CI queue snapshot (2026-11-14 around 09:36 UTC): each of the six Python test shards was pending behind 22 entries in its repository-wide concurrency group, including one running shard from this main run. The GitHub concurrency API was queried for each job, including shard 1. Queue positions can change and are not an estimated completion time. This snapshot does not establish the result of other checks.
Latest-main follow-up (2026-11-14): main at
f17ce83544f8b0420b6cb13dfdd086ca23cf6646changedapps/presentation/dashboard/package.json, which this PR also changes, since the earlier comparison atbaaf657e5df6b779be1401d143af6aa5970454ef. An in-memory three-way merge of that file found no text conflicts. This is not a whole-tree merge check. The benchmark and browser smoke have not run on the new combined tree; the current CI test merge has parent53e80ca8a1979fb176fc3b76962b75a73fac8599.Follow-up comparison: PR head
ba4b9b6b109f826e88e3cec6cf448e37fa58a8a0and mainbaaf657e5df6b779be1401d143af6aa5970454efhave a clean local merge-tree. All 15 main workflow lines invoking npm/node/python smokes remain; the merged tree has 16 such lines. The Windows native job on Fix release recovery and runtime compatibility #8703 head657de032passed; other CI remains independently reported.Earlier main comparison:
3cf2f45552dc2fdad0a160e3e736c1b7c9be21eechanged 26 files since the branch base; none overlap this PR, and a local merge-tree check is clean. The checks below cover the branch head, not the newer combined tree.At
ba4b9b6b109f826e88e3cec6cf448e37fa58a8a0, merged main53e80ca8a1979fb176fc3b76962b75a73fac8599into the feature branch and preserved both CI smoke commands. The packaged conversation-find scenario, timeline scan smoke, 14 Explore history tests and Chat bundle build passed; nine complete rendered outputs remained byte-identical to the baseline.npm run build:chat, including the dashboard TypeScript check, passed.npm run smoke:explore-timeline-scanpassed. It checks 40 routes, the correct edge-to-route association and order, missing and unknown-time endpoints, and bounded source reads. The same test failed on the original component because it read node identities 3,280 times; the changed component read them 293 times.node --experimental-strip-types --test tests/control_plane_ts/explore_history.test.ts: 14 passed.Both benchmark and smoke files passed a standalone strict TypeScript check.
Packaged
research-route-readingbrowser scenario passed against an isolated real history owner.Local performance and complete-output comparison
The baseline component is byte-identical to
mainat78e936f9d1f1a00505c4026ee0a5857de95cee27; the candidate component is byte-identical to this PR. The same fixed input (SHA-256d4a1ba1ef8c0dc5623f97847a73a148346dd5fe8be9b5a906fcd05c769183e77) was used for every run. The test alternated four baseline and four candidate Node processes. Each process took 12 warm, uninstrumented render samples; the table reports the median of the four process medians.All 72 complete HTML outputs across the eight processes and three rendering modes were byte-identical to the baseline. The input includes unknown timestamps, dangling edges, source-order differences and both explicit and parent links. The single-route and public-checkpoint samples are short and their small differences may be noise.
This is a local React server-render measurement on Node 26.12.1 with
NODE_ENV=production, two available CPUs and an AMD EPYC 7K62 host. It excludes browser DOM/layout, network, data loading and online workloads. A separate V8 CPU capture identified the original per-route scans; its sample weights are not used as latency measurements.To regenerate the fixed input and render snapshots from this checkout, run from
apps/presentation/dashboardwith fresh paths:For an independent baseline, run the same benchmark harness and input against the base component in an isolated checkout, then compare every HTML output. The fixture and output paths must not already exist.
Current-main overlap audit (2026-11-14)
A read-only tree comparison used main 8d7d234 and each PR's actual base and merge base. It checked every path changed on both sides with an in-memory three-way merge. This is not a full checkout, build or CI run.
For #8733, five PR paths and 286 main paths changed from merge base 53e80ca; all three overlapping paths merged cleanly in memory. The merged workflow retained all 20 main jobs, their step metadata, and 186 existing run lines; the dashboard package retained every main script.
The fixed-data performance measurements above were run against main 45cfd0c, not rerun at 8d7d234. The later main change inspected here affects an unrelated Python test. No online performance claim follows from the local measurement.