Repository navigation
Avoid loading work scheduling for captured Vision reads - #9337
loopx-agent wants to merge 1 commit into
Conversation
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-astra · OpenAI · runtime_reported · xhigh
Approval conclusion (author-owned PR; GitHub blocks formal self-approval)
动机 / Motivation
原生钩子每读一页就启动一个 CLI 进程。恢复已捕获的审计摘要时,旧路径会加载包含租约和配额执行准备的排程模块。一次 13 页读取反复承担了这笔启动成本。两批测试的 12 对读取全部加快,配对耗时中位数分别下降 25.5% 和 19.9%。测试覆盖本机 CLI,桌面整体耗时和模型费用另行测量。
改动思路 / Approach
让生成摘要和还原摘要的两个调用方共用已有 Goal Vision 只读模块。改动只涉及只读投影、两个调用方和冷启动回归。工作项模块继续导出原函数。原来的函数已经按需导入,单纯推迟导入无法消除正常选读触发的依赖。把它移到读取侧就能保留单一实现。
具体改动 / Changes
核对主干 49881d5 与本提交 ac4e6b0 的完整远端补丁。验收依据是 docs/reference/required-work-context.md。audit 对应完整摘要重建,immutable 对应原文字节保留,cold 对应冷进程依赖。context_vision_audit_view 仍先检查投影标记和内联原文。cli_vision_audit_view 按同一组字段生成审计摘要,保留 judge 为非空映射时的输出、缺省列表和旧数据处理。原工作项生产者直接引用同一函数。
真实 CLI 运行了 9 种输入,各比对选读、索引和原文,27 组完整 JSON 与退出码一致。损坏的引用仍按原规则报错,原始捕获字节保持一致。独立安装的 Core wheel 处理了 13 页选读,最终日志摘要匹配,关闭钩子时日志字节也一致。冷进程回归在主干因载入排程依赖而失败,在本提交通过。针对性测试 326 项通过、1 项跳过,18 项预合并检查通过。
对主干的风险 / Risks
真实 CLI 的两批交替测试各有六对,每对均在相同输入下启动 13 个独立进程。12 对耗时都下降,两批配对耗时的中位降幅为 25.5% 和 19.9%,CLI 子进程 CPU 降幅为 27.8% 和 23.2%。测量覆盖一台 macOS 机器,并采用预热后的归约器。其他平台、桌面整体耗时和模型费用仍需独立测量。回退本提交可恢复原依赖关系,无需迁移日志或捕获。
我的整体评价 / Verdict
作者自评通过。性能改动在正常入口可重复,旧导出兼容,选读与错误恢复都保留了原有证据。安装后的同负载复测留待合入主干后进行,以确认实际运行版本也能获得相同收益。
English verdict: APPROVE. Head ac4e6b0 removes a verified cold-start dependency while preserving capture values, error handling and journal integrity.
Restore a captured audit without loading the scheduler
A native hook starts a fresh CLI process for each verified page. Restoring the CLI view of a captured Vision audit imported the work-item interaction contract, including lease preparation and other scheduling code. Both the producer and the capture reader now use the same projection in the existing Goal Vision read model. The work-item module continues to export the original function name.
The required-work-context contract defines what the restored projection must expose.
Validation
Fixed 13-page read on macOS, one fresh launcher per page and a warm managed runtime per checkout. Two batches of six alternating main/candidate pairs were faster in all twelve pairs. The median of paired elapsed-time ratios improved by 25.5% and 19.9%. CLI child CPU improved by 27.8% and 23.2%. These timings cover this workload on one machine.
All 27
quota context-readcomparisons produced identical JSON and exit codes. Cases included modern and older shapes, missing or malformed audit fields, full reads, selected views and indexes. Original capture bytes were verified after each invocation.The candidate standalone Core wheel processed all 13 selected pages, produced the expected final journal digest, and preserved the journal when the hook was disabled.
The fresh-process regression fails on main and passes at the candidate. It restores a real audit view and verifies that it does not load lease preparation.
Targeted architecture, CLI budget, selected-capture transport and native lifecycle suites: 326 passed, 1 skipped.
Tested revision: ac4e6b0
Authored by OpenAI Codex (model agent).