Skip to content

perf(runtime): remove redundant source probes and planning encoding - #7688

Merged
huangruiteng merged 3 commits into
mainfrom
codex/pr7616-existing-path-performance
Oct 30, 2026
Merged

huangruiteng merged 3 commits into
mainfrom
codex/pr7616-existing-path-performance

Conversation

@hhyykk

@hhyykk hhyykk commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

Follow-up to merged #7616. The complete large-Goal planning path is available, but repeated JSON work and duplicate source metadata probes add cost to the full quota should-run entrypoint. This removes that redundant host work while retaining complete facts and the existing private snapshot transport.

A source file's regular-file type, mtime, ctime and size now come from one stat. The source set, link/error policy, physical release/interpreter identity, full-byte hash and post-hash rescan remain. Unique normalized Todo IDs skip canonical JSON deduplication keys; repeated-ID groups still compare complete normalized records. Snapshot requests are encoded after attaching their response sink. No cache TTL, RPC mode, domain rule or size/permission limit is added.

Validation is bound to product head ecfdc2944d13c6b5a4581586dddb71a9ba17f016, integrating target main 33d9ecd9fd29bce4986da6c9e9a6b758a24f91b3.

  • 245 expanded Python checks passed; the final source error-policy adjustment was followed by 58 passing source lifecycle checks. These overlapping cohorts are not summed. They cover real File/SQLite 2,500-history complete CLI, identity fallbacks, result/source isolation, source churn, namespace ownership, request scope and publication.
  • Changed-path Ruff and Python mypy with silent imported dependencies passed. Standard premerge passed all 18 selected checks.
  • Final fresh File and SQLite probes each returned should_run=true, normal_run, all 2,500 completed records and the selected tail task, with canonical facts/narrative unchanged and no business run created.
  • A fitting 1.8 MB planning request yielding a 2.4 MB response retains the complete pending payload. Response-snapshot support is preserved even when the request fits inline.
  • All eight complete-CLI performance cases passed the unchanged control precision, regression and equivalence rules against valid pre-fix(control-plane): bound large quota planning requests #7616 baseline 8505069601a5a722c11eccf5302f72ffb9276fed. Python 3.13.12, Node 24.21.0, SQLite 3.53.4; cold means cold daemon with warm disk cache.
Backend/history Mode AA/AB pairs p50 ms, base → head p95 ms, base → head
file-0 cold-daemon 160/320 902.72 → 888.47 928.08 → 917.84
file-0 warm 1600/640 466.84 → 454.39 641.93 → 587.22
file-500 cold-daemon 160/320 1736.98 → 1715.05 1808.37 → 1787.15
file-500 warm 1600/640 1074.73 → 1055.23 1118.26 → 1099.95
sqlite-0 cold-daemon 160/320 987.39 → 972.60 1031.78 → 1017.14
sqlite-0 warm 160/320 590.72 → 578.53 692.07 → 671.03
sqlite-500 cold-daemon 160/320 1679.01 → 1659.30 1718.72 → 1696.03
sqlite-500 warm 2400/640 906.62 → 894.09 954.34 → 940.03

Independent same-code daemons calibrate A/A; separate frozen source arms run alternating A/B. Controls must resolve both p50 and p95 within 25 ms and 5%, with paired-bootstrap upper bounds inside the measured resolution and no detected regression. All 16 metrics passed; qualified cohorts contain 19,840 command executions, including controls. Larger-control repeats resolve only previously unqualified warm measurements; original rows and failures remain retained, and rows from different cohorts are not pooled.

Evidence: original eight-case cohort, File warm small-input precision, warm-history precision. Complete outputs match byte for byte within every pair; actual o200k_base and cl100k_base counts are equal in every case. These deterministic reads introduce no model dispatch; this is not a long-horizon generative-model billing claim.

The formerly failing 2,500-history inputs qualify functionality rather than using failed baseline latency/empty output as a performance or token reference. The temporary qualification workflow and private experiment material are excluded from this product branch. Current-main overlap is rechecked separately before publication; the numbers above remain explicitly pinned to the tested head and baseline.

中文:续接已合并的 #7616,合并源码文件类型与版本元数据读取,删除重复 JSON 编码。完整事实、原 v1 格式、输入/结果隔离、响应快照与全部安全上限保持。真实 File/SQLite 大历史完整入口、相关回归和标准检查通过;原性能门的八格全部通过,完整输出与真实分词 Token 相等。旧失败/精度不足数据保留,未混合或重写为通过;不声称完成安装态 App 或长程生成计费验证。

Signed-off-by: aihop <4408344+hhyykk@users.noreply.github.com>
(cherry picked from commit ef661aa)
Signed-off-by: aihop <4408344+hhyykk@users.noreply.github.com>
(cherry picked from commit 5d580f6312329971f4eb4ef4c5905bd537bffea7)
Signed-off-by: aihop <4408344+hhyykk@users.noreply.github.com>

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent; gpt-6.1-sol; OpenAI; runtime_reported; reasoning_effort=max

动机 / Motivation

历史 Todo 较多、需要继续下一项工作的用户和 Agent,会反复调用 quota should-run 读取完整规划。原先每次读取会重复查询源码元数据、重复编码完整规划请求,并为唯一任务 ID 编码不必要的去重键。现在保留同一份完整规范化事实和决策,只减少这些重复操作。可验证交付是完整大历史读取保持成功和原有决策,同时减少实际源码 stat 调用和规划 JSON 编码次数。本 PR 只优化已有 Python 宿主观察和编码;不改变 TS 决策、预算、权限、配置、持久化格式或任何大小上限。

验收依据为已合并任务 #7616 ,修订 eda29472f2cc69ca99161651d463415491f8ea20。逐项核对:完整规范化记录表 保持完整规范化事实;TS 保留唯一的诊断、选择和截止时间 owner 保持原决策 owner;2 MiB inline 或 64 MiB snapshot/响应展开上限 保持原限制。源码身份同时对照基线 local-delegation 合同,继续检查物理源码根、解释器、完整字节与哈希后复查。

改动思路 / Approach

源码元数据属于现有运行时身份 owner,记录编码属于现有规划 codec;将这些重复工作在原 owner 合并,比增加 TTL、裁剪事实或加入第二个 Python 选择器更合适。本 PR 只优化已有 Python 宿主观察和编码;不改变 TS 决策、预算、权限、配置、持久化格式或任何大小上限。正向路径是 File/SQLite 的完整 quota should-run 在普通、500 条逆序历史和2500条大历史中选中正确尾部任务,两个 scoped 请求仍由同一个 Node PID 处理。 反向路径是 被排除的 Agent 不获得任务,peer 任务不越界;实际 CLI 请求若故意缺失任务文本会以 blocked_health 拒绝,恢复正常源码后同一夹具回到可继续状态。 这两条真实 caller 路径用于判断保持了哪些行为;单个 helper 的相等断言不能替代安装或完整规划结果。

具体改动 / Changes

审阅 head:ecfdc2944d13c6b5a4581586dddb71a9ba17f016;不可变比较基线:33d9ecd9fd29bce4986da6c9e9a6b758a24f91b3。已逐行读取全 PR,范围是 6 个路径、+122/-46。关键符号如下:

6 个相关模块 207 passed、1 个 Linux-only skip。File/SQLite 八组成对真实 CLI 保留完整规范化请求及所有非时间输出;仅在验证观测时钟、事件 ID 派生与来源年龄计算后归一化这些时间信息,fresh/stale、诊断和权限字段全部比较。2500 条历史的请求约 2.87 MB,仍返回全部记录和正确尾部任务,canonical 事实与正文未改。

同一普通夹具中,Python os.stat 调用从1532降为766,规划 envelope 编码从4降为2;2500历史的去重键编码从5008降为6。这里计数的是 Python 调用与编码,未据此声称 OS syscall、p95 或模型成本收益。故意删除实际请求文本会让 CLI 拒绝运行;恢复同一夹具后重新读到完整文本与正常结果。

对主干的风险 / Risks

主要风险是 唯一 ID 快路误合并冲突记录、合并 stat 后漏掉源码变化,或单次编码漏掉响应快照。完整事实冲突、源码变更/错误/链接、1.8 MB 输入与2.4 MB响应等真实 transport 用例均由当前相关测试覆盖;没有 TTL、字段白名单、第二个选择器或安全上限增长。

精确 scope 的 change-quality 回执有效,Ruff、编译、diff 与 RFC 双语检查通过。当前标准 premerge 通过:最终完整 standard premerge 的6项直接检查和18项选中检查全部通过;首轮同 head 的词表检查在120秒超时,基线96.63秒、受控head109.85秒通过,最终完整复核亦通过。全部原件保留,未改变时限,也未声称已归因或解决所有负载下的稳定性。 首轮失败和当前复核分开记录;不查询或等待远端 CI。私有比较器的早期 scope/exit 和时间字段假设错误已保留,修正后回读全部原始成对观测;故意缺失文本的拒绝结果不作为 PR 失败。

我的整体评价 / Verdict

未发现 diff 引入的可执行阻塞问题,当前完整标准检查通过,可以批准这一有界重构;本结论不授予合并权限。源码元数据属于现有运行时身份 owner,记录编码属于现有规划 codec;将这些重复工作在原 owner 合并,比增加 TTL、裁剪事实或加入第二个 Python 选择器更合适。本 PR 只优化已有 Python 宿主观察和编码;不改变 TS 决策、预算、权限、配置、持久化格式或任何大小上限。长程工作与用户操作路径在本次范围内保持:保留原权限、停止、恢复和结果读回,不增加确认轮次;没有把一次成功读回或测试数当成长程模型收益。已检查全部变更及其 quota CLI/runtime 调用方,没有渲染页面变化;任务操作仍使用同一现有 CLI。本次没有重新资格化作者的整套 p50/p95、分词 Token、安装态 App 或长程模型效果;历史超时保留,未将当前通过扩展为所有负载下的资格。

English verdict: APPROVE the bounded refactor; current required checks pass, earlier timeout retained, no merge authority granted.

@huangruiteng
huangruiteng merged commit 7466230 into main Oct 30, 2026
32 of 41 checks passed
@huangruiteng
huangruiteng deleted the codex/pr7616-existing-path-performance branch October 30, 2026 03:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants