Repository navigation
Read archived decisions without repeating the original prose - #9173
loopx-agent wants to merge 8 commits into
Conversation
Signed-off-by: LoopX Agent <[email protected]>
Signed-off-by: LoopX Agent <[email protected]>
Signed-off-by: LoopX Agent <[email protected]>
Signed-off-by: LoopX Agent <[email protected]>
Signed-off-by: LoopX Agent <[email protected]>
Signed-off-by: LoopX Agent <[email protected]>
Signed-off-by: LoopX Agent <[email protected]>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · Antigravity · Google Deepmind · self_reported
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
无阻塞性发现(no blocking finding)。
动机 / Motivation
需要核对归档或只读来源 Goal 历史执行决策的维护者与研究复盘人员,在工作台执行抽屉(ContextDrawer 的 SourceRunHistory)与策略历史阅读器(GoalSourceStrategies)中阅读原文记录。
改动前,只读来源 Goal 的执行抽屉只展示时间、回合编号和策略检查点决策标签,缺失完整原始决策正文;同一条目的“其他决策字段”展开后会把上方已结构化呈现的目标、观察与后续计划再重复渲染一遍,导致同一段原文在阅读区出现两次、破坏浏览器验收,且当来源使用 workspace_goal_id 别名时状态路由还会把 agent_vision 内的原始 goal_id 改写为本地别名。改动后,执行抽屉直接复用共享文档阅读器展示每条保留记录的完整结构化决策与附加字段,结构化章节已消费的键不会在附加字段中重复出现,未保留完整正文时明确提示未留存,状态投影也跳过 agent_vision 以保持原始身份不变。
用户在只读来源 Goal 的执行抽屉与策略历史页中可以无重复地通读结构化决策、按需展开附加未映射字段与完整原始记录(含原始 Goal、来源命名空间与记录身份),并隐藏不适用于归档记录的实时会话标签与高级诊断开关,同时保留本地正常 Goal 与提案/调度抽屉的原先诊断入口。
边界与非目标:不改变只读限制、不引入新的后端历史接口或持久化状态、不修改实时 Goal 的执行会话与高级诊断路径,也不承担已安装桌面 App WebView 读取、完整未压缩执行包下载或父级跨 Goal 对比。
当前增量仍留边界:受限于 status.json 的 compact_run 窗口,执行抽屉只呈现 latest_runs 中保留的最近记录而非全量历史;完整历史与未压缩原始记录仍需经策略历史接口读取,且正式已安装桌面 App、完整执行包与父级对比仍待后续独立验证。
改动思路 / Approach
本 PR 通过“状态投影保真 + 前端唯一文档组件复用 + 归档抽屉诊断隔离”三条最小接缝打通只读归档决策阅读。上游 projectGoalSourceStatus 在递归映射 workspace_goal_id 时跳过 agent_vision 子树,确保无论来源是否使用工作区别名,原生决策对象内的 goal_id 及未来嵌套字段都不被本地路由字段污染;runRecordSchema 以 .nullish().catch(null) 宽容接纳 agent_id、turn_instance_id、vision_checkpoint 与 agent_vision,在老快照缺失或异常字段时静默降级而非打断整份状态解析;前端 dashboard-page.tsx 仅在 goal.source_access 存在时映射 sourceRunHistory,ContextDrawer 的 SourceRunHistory 与策略历史页 GoalSourceStrategies 共用同一个 GoalStrategyDocument 组件渲染,既避免维护两份结构化/回退逻辑,也使本次去重修复同时惠及两处阅读入口。
在结构化与未映射字段去重上,方案选择了在 GoalStrategyDocument 内部基于浅拷贝 additional、由 readDecisionSection / readDecisionText 按已消费键摘除的策略,而非在“其他决策字段”处整体重绘原始对象或硬编码黑名单。这样既不修改原记录对象引用,也能在零重复的前提下自动接纳任何新增顶层或嵌套字段(包含 0 与 false)。对于归档执行记录,抽屉在 sourceRunGoal 命中时直接呈现 SourceRunHistory(含来源、原 Goal 身份和记录数),并屏蔽实时运行标签页与 personal-diagnostics-trigger“高级诊断”开关,因为归档条目本身已在每份文档底部折叠区提供“完整原始记录与来源”。
架构边界判定与当前 PR 边界:复用现有的 GoalStrategyDocument 作为策略历史与归档执行抽屉的唯一决策文档渲染 owner,用纯读取-消费浅拷贝将结构化章节与附加未映射字段在同一渲染层分离,并在状态投影入口 projectGoalSourceStatus 显式保留 agent_vision 原文身份,无需新增第二套历史阅读器或后端投影接口。本 PR 边界限定在只读来源 Goal 的执行抽屉接入、GoalStrategyDocument 去重展示、alias 状态路由保真、以及用真实 ContextDrawer SSR 校验替代源码正则耦合;不扩展后端 history/status 窗口,也不在本轮修改通用 .personal-detail-card 的网格布局。
具体改动 / Changes
精确 head fb09887f12bcac638b3fef03254998d04f66f8cb,基线 64353773dc8b1ca82ff531cc7653dec6c3d41c0b,共 6 笔签署提交、11 个文件(生产代码 9 个 +224/-61;测试 2 个 +126/-1;文档 0 个;总计 +350/-62)。按 docs/development/frontend-delivery.md(spec_revision 387a8ea7b404222aec95edf4e4a7c061f7ea0b29)以及 design.md 核对以下映射条目(注:原规范为连续散文而非编号清单,以下标识符为本评审对对应条款的映射):
source-original-identity:implemented(projectGoalSourceStatus、SourceRunHistory;验证:npm --prefix apps/presentation/dashboard run test:native-decision-read、tests/control_plane_ts/goal_source_links.test.ts15/15 PASS)。使用workspace_goal_id时仅外层run.goal_id与路由字段改为别名,run.agent_vision与抽屉显示的原 Goal 身份保持原始值。source-read-only:implemented(SourceRunHistory、ContextDrawer;验证:smoke:runtime-source-workspacePASS、native-decision-read.test.mjsPASS)。归档执行抽屉无执行、恢复、纠偏或会话控制按钮,且隐藏实时诊断入口。original-decision-content:implemented(GoalStrategyDocument、readDecisionSection、readDecisionText、NativeDecisionFields;验证:test:native-decision-readPASS、smoke:runtime-source-workspacePASS)。结构化章节消费过的字段不会在“其他决策字段”中二次出现,未知嵌套字段及0/false保留可读,且不修改传入agent_vision对象。archived-execution-provenance:implemented(SourceRunHistory、ContextDrawer、native-decision-read.test.mjs;验证:test:native-decision-readPASS、实测 Playwright 归档抽屉检查 PASS)。归档执行记录依赖每条记录内置的“完整原始记录与来源”折叠区并省略personal-diagnostics-trigger,同时保留本地正常run、proposal、schedule的诊断开关与output排除规则。native-app-source-readback:deferred(超出本 PR 边界,留待正式安装版桌面 App 验收阶段由发布与桌面端负责)。
关键代码讲解
GoalStrategyDocument与readDecisionSection:先建立顶层浅拷贝additional,在渲染vision_patch、path_delta、stride_decision各已支持字段时通过readDecisionSection为每个嵌套段建立局部浅拷贝并在提取后delete已渲染键;当整个段被消费完时从上层对象删除,若仍留有未映射键(如axes、未知扩展字段或非字符串值0/false),才保留在“其他决策字段”中由NativeDecisionFields展示。若additional为空则不渲染该折叠区,从源头避免空折叠与 prose 重复。projectGoalSourceStatus:在递归路由函数route(value, key)中对key === "agent_vision"直接返回原值,明确将 Agent 原生决策文档视为不透明原生载荷,只路由外层run与调度索引字段。SourceRunHistory与ContextDrawer:在selection.kind === "goal"(sourceAccess存在时)与selection.kind === "run"(sourceRunGoal命中时)两条入口复用的折叠列表组件;为每条保留记录展示记录类型、原回合turn_instance_id、检查点决策,并在存在agent_vision时传入GoalStrategyDocument executionRecord,否则显示drawer.sourceRunDecisionUnavailable;同时在第 404、713、1127–1128、1388 行将归档执行抽屉与实时运行页签及personal-diagnostics-trigger隔离。runRecordSchema与buildPersonalHomeModel:前者以.nullish().catch(null)保护老快照与畸形字段,后者仅在goal.source_access存在时构建sourceRunHistory,确保本地常规 Goal 完全不走该分支。native-decision-read.test.mjs与personal-workspace-contract.test.mjs:移除了原先要求selection.kind === "run" || ...源码字面量的脆弱正则断言,改为直接 SSR 渲染ContextDrawer验证归档运行、当前运行、提案、调度与输出五类对象的诊断开关存在性,并将npm run test:native-decision-read纳入smoke:personal-workspace与打包门禁脚本。
对主干的风险 / Risks
- 回归与负面路径分析:
- 本地正常 Goal(feature-off / 无
source_access)隔离完整:dashboard-page.tsx#L1150-L1154仅在goal.source_access存在时生成sourceRunHistory,context-drawer.tsx#L398-L400、#L940、#L1128与#L1388对本地 Goal 保留原personal-goal-session、personal-run-drawer-tabs与personal-diagnostics-trigger;native-decision-read.test.mjs对照验证了currentDrawer、proposalDrawer、scheduleDrawer保留诊断开关而archivedDrawer与outputDrawer隐藏它。 - 状态与边界负例:非对象或畸形
agent_vision(undefined、null、[]、字符串、数字)经runRecordSchema降级为null并显示“未保留完整决策正文”;projectGoalSourceStatus拒绝goal_id不匹配的原生状态;策略历史切换或损坏保留原有错误提示与重试按钮。 - 非阻塞样式观察(P3):在
ContextDrawer(data-context-kind="run")内展开SourceRunHistory下方的“其他决策字段”时,personal-workspace.css#L1351的.personal-detail-card dl div(grid-template-columns: 74px minmax(0, 1fr))在 390px 与 1440px 下都会使顶层未知长键名(如future_field)在 74px 列内换行并收窄嵌套对象右栏;上方主结构化正文与下方原始 JSON 区块排版正常,也无横向溢出(scrollWidth <= innerWidth),建议后续将.personal-source-run-history .source-strategy-document dl > div或窄屏下的.personal-detail-card dl div改为单列堆叠。 - 轻微展示细节:
context-drawer.tsx#L86当run.turn_instance_id缺失时,version字符串会留下末尾·,仅影响折叠来源详情内的文本美观。
- 本地正常 Goal(feature-off / 无
- 本地全量验证矩阵(
wait_for_ci: false,均在精确 headfb09887f12bcac638b3fef03254998d04f66f8cb上执行):npm --prefix apps/presentation/dashboard run test:native-decision-read(含中英文去重 SSR、0/false、不可变性、alias/non-alias 投影、ContextDrawer诊断边界):PASS。node --no-warnings --experimental-strip-types --test tests/control_plane_ts/goal_source_links.test.ts:PASS(15/15 passed)。node --no-warnings --experimental-strip-types --test tests/control_plane_ts/source_projection.test.ts tests/control_plane_ts/source_grants.test.ts tests/control_plane_ts/vision_checkpoint.test.ts:PASS(59/59 passed)。node --no-warnings --experimental-strip-types --test ...research-record-versions/export/search.test.mjs:PASS(12/12 passed)。node apps/presentation/dashboard/src/features/personal-workspace/personal-workspace-contract.test.mjs:PASS。npm run typecheck:control-plane与npm --prefix apps/presentation/dashboard run build(含tsc --noEmit && vite build && npm run build:chat)与check:css-custom-properties(43 份样式表、62 个定义 token、0 未定义引用):PASS。smoke:presentation-surface-schema、smoke:status-projection-contract、smoke:research-analysis-read、smoke:goal-work-browse、smoke:team-report、smoke:answer-report、smoke:goal-order、smoke:goal-activity、smoke:proposal-recency、workspace-theme.test.mjs、font-token.test.mjs、server-startup.test.mjs:PASS。npm --prefix apps/presentation/dashboard run smoke:runtime-source-workspace(修复了 #9128 在第 203 行失败的重复文本 strict mode 断言)与smoke:status-source-switch-packaged:PASS。- 打包浏览器场景
research-source-recovery、research-finding-reader、research-native-reading:PASS;另有RuntimeWorkspaceServer+source_access的 Playwright 实景抽屉测试(1440px 与 390px 折叠/展开/缺失正文/Escape 焦点归还):PASS。 pytest tests/presentation/test_runtime_workspace.py tests/presentation/test_research_analysis_api.py tests/presentation/test_goal_source.py tests/presentation/test_linked_goal_sources.py:PASS(85 passed;本 PR 未修改任何.py文件,故未针对.py改动运行 ruff/mypy)。examples/semantic-vocabulary-drift-smoke.py与loopx check --scan-path ...(全部 11 个改动文件):PASS(0 errors, 0 warnings)。loopx canary premerge --from-git-diff --git-diff-base 64353773dc8b1ca82ff531cc7653dec6c3d41c0b --tier standard:PASS(4/4 direct checks,10/10 catalog canaries,8/8 risk-profile smokes,0 manual holds)。- 远程 CI 状态:UNVERIFIED(按当前配置
wait_for_ci: false不等待也不参考远程 CI)。
我的整体评价 / Verdict
本 PR 在精确 head fb09887f12bcac638b3fef03254998d04f66f8cb 上完整解决了 #9128 遗留的别名身份改写与阅读区正文重复两大问题,并妥善修复了随后的诊断按钮测试耦合,使策略历史页与归档执行抽屉能够共享同一套不重复、不改写原记录的渲染路径,本地 TS/构建/打包浏览器/Python 后端/标准 premerge 门禁均全部通过,无阻塞性发现。就产物与长期影响判断,long_horizon 为 preserved(只读边界与本地状态不变,无额外持久化或重试副作用),user_experience 为 improved(归档执行可直接在抽屉读取完整原文,同时在策略历史与抽屉两端消除重复正文)。
可视化核查结果(visual_review: inspected):已在 exact head fb09887 构建产物上直接核验渲染结果:通过 smoke:runtime-source-workspace 在 1512x982 桌面与 390x844 窄屏实测策略历史总览、单条策略正文(结构化段落下方折叠“其他决策字段”与“完整原始记录与来源”),并额外以真实 RuntimeWorkspaceServer 挂载带 source_access 的双条归档运行(含完整决策与缺失决策对照)在 1440x900 与 390x844 的默认折叠态和展开态下检视 ContextDrawer。默认视图在桌面与 390px 窄屏均保持单行时间折叠、层级清楚、无横向溢出;展开后主结构化正文以正常阅读字号单次呈现、无重复段落、无实时诊断开关,缺失正文回退文案清晰,390px 下无横向溢出且 Escape 正常归还焦点。观察到一个非阻塞样式细节:在 ContextDrawer 内展开“其他决策字段”时,.personal-detail-card dl div 的 74px 列宽规则使较长嵌套键名(如 future_field)出现换行且深层嵌套对象右栏较窄,但不影响上方结构化正文与下方原始 JSON 的完整可读性。 未覆盖范围:未在正式已安装桌面 App 的原生 WebView 中实际打开归档来源抽屉,未执行后端 403/503 对 SourceRunHistory 本身的分页外超窗数据测试;远程 GitHub Actions 第三分片浏览器结果未作为判定依据(wait_for_ci=false)。
对照基线 64353773dc8b1ca82ff531cc7653dec6c3d41c0b 与目标语义判断,observable_semantics 为 intentional_change_validated(本地常规 Goal 行为完全不变;只读归档 Goal 显式新增 sourceRunHistory 并用“完整原始记录与来源”替代实时诊断按钮,且在 GoalStrategyDocument 中去除结构化已展示正文在附加字段中的重复);code_volume 为 necessary(兼容性策略 retain:保留 runRecordSchema 的 .nullish().catch(null) 宽容解析以兼容旧运行记录,未引入冗余适配层);change_proportionality 为 proportionate(architecture_assessment: retain:复用现有的 GoalStrategyDocument 作为策略历史与归档执行抽屉的唯一决策文档渲染 owner,用纯读取-消费浅拷贝将结构化章节与附加未映射字段在同一渲染层分离,并在状态投影入口 projectGoalSourceStatus 显式保留 agent_vision 原文身份,无需新增第二套历史阅读器或后端投影接口。本 PR 边界限定在只读来源 Goal 的执行抽屉接入、GoalStrategyDocument 去重展示、alias 状态路由保真、以及用真实 ContextDrawer SSR 校验替代源码正则耦合;不扩展后端 history/status 窗口,也不在本轮修改通用 .personal-detail-card 的网格布局。);default_off_isolation 为 isolated(以 goal.source_access 为开关隔离本地 Goal 与归档来源 Goal);authority_semantics 为 not_applicable(未引入新的 Actor 生命周期或协调权限语义)。语义与词汇方面,本 PR 复用既有 agent_vision、vision_checkpoint、source_access 模型(semantic_alignment: not_applicable / reuse_existing),未引入新的控制面词汇或状态机。
残余风险与未覆盖范围:主要限于上文指出的“其他决策字段”内嵌长键在 .personal-detail-card dl div 中的局部换行样式细节(非阻塞 follow-up),以及超出本 PR 范围的桌面端已安装 WebView 实机读取与 latest_runs 窗口外历史读取。
English verdict: APPROVE — verified on exact head fb09887; fixes alias provenance leakage and repeated prose in GoalStrategyDocument, isolates archived execution drawer provenance/diagnostics with all local TS, build, packaged Playwright browser, Python presentation (85 passed), and standard premerge checks (18/18) passing; non-blocking P3 CSS nesting polish in SourceRunHistory additional-fields table noted for follow-up.
Signed-off-by: LoopX Agent <[email protected]>
Supersedes #9128. The branch includes the archived execution reader, shared renderer fix, and release browser checks. The branch incorporates main at
64353773dc. Previous exact-head reviewRead an archived decision once
The archive drawer and strategy history share the same decision reader. The structured view presents the original objective, findings, changes, and recorded next plan. The Additional decision fields disclosure shows the fields that the structured sections did not display, including unknown nested fields. Complete original record and source still exposes the complete original record with its source identity, version and timestamp.
Validation
The new bilingual SSR regression failed before the fix because an exact paragraph occurred twice in the reading views. It passes on
cb84dd09b1c85d681cd5e341875bb29a8e867178and verifies nested additional fields, zero and false values, and preservation of the original decision. The alias/non-alias source projection checks passed, with 15 source-owner TypeScript tests passing.A local isolated replay of the hosted wheel loaded both the runtime HTTP backend and the browser assets from the installed package. The read-only fixture covers 23 archived decisions, original task and version access, switching between separate sources that share an ID, failed reads and retry, and focus return at desktop and 390 px. Browsing made zero analysis writes.
Ego browser readback on the same record found two matching paragraphs before the fix and one after. At 390 px, pressing Enter opened the disclosure and the full original record was still present. Both views fit without horizontal overflow.
The installed wheel also passed a separate archived execution drawer check at 1440 px and 390 px with two synthetic retained runs. The drawer renders the original paragraph once, preserves the nested field and original run identifiers, shows when a decision was unavailable, and restores keyboard focus on close.
Standard premerge passed four direct and 18 selected checks after installing the root TypeScript development dependency.
Release browser qualification
The three original browser partitions stopped at the same source assertion for the diagnostics control. It required the old live-execution expression even on the archived reading path. The release smoke now renders the actual drawer and checks that archived executions show source provenance, live executions and applicable actions retain diagnostics, and result artifacts omit the control. Forcing diagnostics back onto an archived execution makes the test fail.
At
fb09887f12bcac638b3fef03254998d04f66f8cb, partition 3/3 passed all 29 scenarios locally against a freshly installed wheel, including research-source recovery and the finding reader. The source drawer checks and 15 source projection tests passed. Ego reopened the archived execution at 1440 and 390 px, read the original record and the missing-decision state, and returned keyboard focus on close. Standard premerge passed four direct and 18 selected checks.The hosted run passed all 87 distinct browser scenarios across three partitions using the same candidate artifact. Partition 3 passed source recovery and original finding readback. The artifact was built at GitHub's PR merge commit
843151338625fff47c67b8f93df3b4f784961c7c, whose second parent is the candidate head above. The hosted wheel SHA-256 is670bf9bd819dff033695de4163fc62e0a28fbdbb2ee311d6ccce105f9fa6810b.The same wheel also passed the retained research cases locally at desktop and 390 px. The saved Graph analysis preserved all 36 original judgments across six episodes. Switching to its older result kept unknown adoption evidence visible, and opening a missing citation showed its own unavailable state. The source records stayed unchanged and browsing made zero mutation requests.
The same packaged reader also opened the Codec evaluator response recovered from its archived submission output. The response and queued receipt match the same submission and archive identity. The desktop and 390 px views show all eight dataset results, retain the earlier interpretation, and reopen the exact source after a simulated citation failure. Cross-Goal citations were rejected and browsing issued no writes.
The new Pages build stopped on the relative runtime guide link in
docs/reference/protocols/turn-envelope-v0.md. Matching strict builds of the full PR base and merged tree each reproduced that sole warning.Dashboard shard and archive readback
Integration with main at
790f3a4The reviewed head and main at
790f3a4merged locally without conflicts. A fresh bundle from the resulting tree passed the finding reader and source recovery browser scenarios. The reader retained the selected finding and complete original record across reload and Back. The source recovery case preserved same-source history during an outage, waited for the new source after switching, and recovered after retry at both widths without posting mutations.The upstream Ubuntu job reached the 200-attached-row assertion and then failed at 184 visible rows during expansion in the uninstrumented pass. Its checkout has the same source tree as the reviewed head. On macOS with the same Chrome for Testing version, the integrated tree reached 200 visible rows both with and without coverage. A separate diagnostic on the hosted source tree observed five groups of 40 rows. All groups opened and all 200 rows remained visible after the groups reordered, with fourfold CPU throttling during expansion. The original Ubuntu result remains failed. Hosted assertion
Additional decision fields on desktop and mobile
The bundle built from the reviewed head served two synthetic archived revisions through the real read-only source backend. At 1440 px and 390 px, the page stayed within the viewport. Long original and nested field names wrapped and remained readable, with a few pixels of glyph overhang inside the page. The reader preserved the original values, including zero, false, and null, and reopened the complete record. At 390 px, switching versions showed each version's own fields, and reloading kept the selected earlier revision.
Integration with main at
f0018b1fb09887andf0018b1from Git tree50355db. This includes the task disclosure layout fix and grouped research record reading. #9132, #8973dashboard-browser (3)job forfb09887still records 184 visible tasks after 200 attached. The combined tree still requires hosted Ubuntu validation. Ubuntu jobLinux comparison for the 200-task disclosure
8431513. Reconstructing that commit's tree from its recorded parents gives the same tree asfb09887. The first, uninstrumented M2 pass reported 184 visible tasks after attaching 200. Hosted job202d7bdeach rendered all 200 tasks. The integrated tree's uninstrumented expansion measured 589 ms on Ubuntu 24.04 and 609 ms on Ubuntu 26.04. Both versions passed the focused scenario on 24.04. On 26.04, both exceeded the 1 s median for at least one loaded view switch, so the full M2 scenario failed in that environment.Integration with main at
a6ffb3bThe branch head
3f5d3c192bd01015763889c6a3cc9a272b612837now includes the tested main revision. The 11-file feature diff is unchanged from the prior head.Visual evidence
Synthetic archived decisions served by the real read-only runtime workspace backend. The desktop image shows the first viewport of the selected decision. The two 390 px images show the old and new expanded disclosure. The captures use packaged dashboard assets at
94f667efa2andcb84dd09b1on the same base.Remaining qualification
The independent review concluded APPROVE for the prior head
fb09887. It noted non-blocking wrapping of long field names in the additional fields section and the recent-history limit of the execution drawer. General Python CI remains separate from the completed release browser workflow. The earlier real retained case captures are linked from #9128. Official installed App readback, complete execution package and artifact access, and parent-level comparison remain open.