Repository navigation
Skip Todo fold prefetch when baseline metering is unavailable - #9669
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-sol · OpenAI · runtime_reported · xhigh
Request changes conclusion (author-owned PR; GitHub blocks formal self-review)
[P2] 在启动观测前确认 tokenizer 计量来源可用。 提供基线与替换计数,但 tokenizer 元数据为空字典,或 encoding 与折叠要求不匹配。可选读取仍启动,随后 TypeScript 因计量不可用保留原文。 Python 以 tokenizer 映射是否存在放行进程。TypeScript 根据非空 name、encoding 和预期 encoding 确认计量来源。 当前头的已安装 Core CLI 在两个输入上都实际启动 1 次只读观测,最终回执仍为 token_estimation_unavailable。将 subprocess 前的计量准入绑定到同一份可验证 tokenizer 规则;保留已完成观测的读回,并加入空对象、编码不符与有效计数对照。 进程门控 TypeScript 计量规则
动机 / Motivation
启用 Todo 级上下文折叠的宿主,需要在工作结束后决定是否值得读下一段观测并替换原始上下文。 提供基线与替换计数,但 tokenizer 元数据为空字典,或 encoding 与折叠要求不匹配。可选读取仍启动,随后 TypeScript 因计量不可用保留原文。 隔离 Core wheel 使用真实 quota context-hook。缺基线或 tokenizer 整体缺席时,观测进程由 1 降为 0。空字典与编码冲突时两版均启动 1 次,新头仍回 KeepRaw。 本次覆盖隔离 Core CLI 的 hook 及 TypeScript 回执。原生 rollout-span 计量和实际模型收益仍随 #9503 验收。
改动思路 / Approach
先解析计量,再由 Python 现有观测入口决定是否启动进程。已有观测从原数据继续交给 TypeScript,最终 fold 的范围、回执身份、观察结果和收益仍由 TypeScript 判断。建议继续由该规则提供可用计量的判定,避免两层对 metadata 的要求分离。计量可用性先于可选观测。Python 以 tokenizer 映射是否存在放行进程。TypeScript 根据非空 name、encoding 和预期 encoding 确认计量来源。
具体改动 / Changes
精确头 0ac93d1c0239bfae6c770ff35a54934ff9ddbe53,基线 7b9cee5a2d1fdd8dfcf72177b6c8c213f40fd0de。对照 docs/architecture/rfcs/history-working-set-context-policy-v0.md 的 A13 与本 PR 的 No unmetered observation 交付条件。A13 要求保留原文直到安全、正收益替换成立,按原证据回读重放。PR 额外承诺在基线不可计量时跳过无收益读取。 基线 A13
_evaluate_semantic_unit_fold先取得基线计数和 tokenizer 元数据,再把准备条件传给_run_semantic_unit_obs_command。完全缺失时跳过实际进程,已有输出仍走原分支。 Python evaluatorbuildSemanticUnitFoldSwap仍检查 anchor、Todo、Turn、context epoch、原 prefix、回执摘要与来源、观测边界和净收益。空或不一致的 tokenizer 到这里才被清成不可用。 TypeScript 回执
对主干的风险 / Risks
两份隔离 Core wheel 都在无 tiktoken 条件运行同一 hook 证据,直接计数真实观测进程。有效给定计数的观测执行一次并 FoldToReceipt,重放同一回执不再执行。已执行观测在两版都直接使用。相等计数仍显示净差 0 并 KeepRaw。 错误的回执摘要保持 invalid_completion_sha256 和 KeepRaw;非静止边界和关闭路径均零观测。 省略及明确关闭均无 fold 回执、无观测进程,安装态 base/head 对照一致。 新头 44 项 Python 和 13 项 TypeScript 定向用例通过,配置的 mypy 与定向 Ruff 通过。词汇检查在基线和候选均报 54 项冲突定义超过 52 的上限。去掉 checkout 根路径后,两份完整词汇清单完全一致。 标准 premerge 把词汇项记为阻塞失败。另有一项既有 maintainability 告警,余下 8 项选定 smoke 及直接检查通过。
我的整体评价 / Verdict
请把计量来源判定提到进程前并保留同一 TypeScript owner,复验时同时读进程数与原回执。在隔离无 tiktoken 的 Core wheel 对同一绑定重放 quota context-hook,断言前两种观测进程数为零、有效计量只运行一次、保存的观测不重跑。 核对了 Core CLI hook、回执与两套测试,差分未改渲染界面。 原生宿主的真实模型上下文收益未在本次独立复验采样。
English verdict: REQUEST_CHANGES at 0ac93d1. Missing metering is skipped, but empty or mismatched tokenizer provenance still launches prefetch before the existing TypeScript gate rejects it.
|
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 |
Outcome
The opt-in Todo fold reads the next observation only when a measured baseline and tokenizer provenance are available. With the optional tokenizer missing, it keeps the original context and reports unavailable counts. An instrumented zero-token delta still appears as zero. The TypeScript receipt owner keeps the existing settlement, binding, and savings checks.
Verification
tiktokenabsent. The Todo still validated and settled exactly once. Omitted and disabled profiles emitted no fold receipt.The patch covers the shared fold evaluator. Native Codex rollout-span metering and benchmark outcome qualification stay tracked with the host integration in #9503.