Repository navigation
docs(tokenless): consolidate compression triggers, saving-rate fields, and reference workload - #2600
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 82232111ee
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
本次仅发现 1 处文档行为描述与 Codex 特殊路径存在轻微偏差,已在英文用户手册对应位置留下建议性注释。未发现其他会影响压缩触发或阈值理解的具体问题。
🤖 Generated by Qoder • View workflow run
…ore/tokenless-doc-compress-rate-scenarios Bring in the user-manual anchor (#compression-trigger-conditions-and-thresholds) that measuring-savings references, so PR agentic-os-org#2601 passes the website link check before PR agentic-os-org#2600 is merged. Cross-PR dependency fix for CI.
dfe1cbe to
a5a9fa3
Compare
a5a9fa3 to
da92366
Compare
da92366 to
34d5f2b
Compare
|
感谢细致的 review!这条建议已采纳,在后续提交
YAML frontmatter 跳过的说明对三条路径共享,保留为第 4 条的收尾段落。中英文页面同步修改、结构一一对应;纯文档改动,无语义变化。 本地验证: |
|
PR number: #2600 评审结论未发现 blocking package/module/public API 组织问题。 本 PR 为 tokenless 用户文档的纯文档变更,改动范围全部在 检查要点(静态评审范围内均已核对)
剩余风险
验证情况
|
|
已解决与 冲突处理
合并后本 PR 对 超出纯冲突解决的两处修正(中/英同步)按本 PR 上一轮 merge 的做法,重新用合入的
第 4b 条无需修改: 数值复核(合入 main 后均未变化)
校验
|
|
PR number: #2600 Findings
未发现 blocking package/module/public API 组织问题。 剩余风险与验证当前 head 尚未落实维护者最新要求的 #2596/#2601 内容整合及单提交整理。输入显示 Docs Lint、链接检查和站点构建已通过;本评审未执行工具,也未独立复核源码阈值。 |
|
@Forrest-ly 这三项文档更新统一收敛到本 PR(#2600)继续处理,#2596 和 #2601 将关闭并指向这里。关闭表示合并跟踪入口,不代表两项原始需求已完成;请将其有效意图一并迁移到本 PR。 请保留并整合以下三部分,中英文同步:
请先重新对齐最新 main 的代码与已有文档,再整合内容。 本次查询 main 为 本轮审查需要在整合时处理的具体问题:
最终请将本 PR 相对最新 main 的全部文档改动整理为恰好 1 个 commit。 包含迁移内容和本轮修正,去掉重复章节、任务表行、交叉引用及旧的分支合并历史;要求 PR 分支本身只有这一个提交,而不是仅等待最终 squash merge。整理后请使用 请同步重写 PR 标题/描述,说明本 PR 承接 #2596、#2601 的意图、采用的基线 SHA、最终内容和验证范围;重跑 |
79d0fe6 to
186fe10
Compare
|
@Forrest-ly 已复审最新提交 已确认 #2596 / #2601 的文档意图迁入本 PR,共修改 8 个中英文文档文件,分支已压缩为 1 个提交。当前 base 比分支起点多出的两个提交仅涉及 agent-memory,没有 tokenless 代码漂移。此前指出的数组 head/tail 与 Record Reduction、OpenClaw/Hermes 信封处理差异、compare 饱和值与 diff 有符号比例等问题已修正,旧 Codex 阈值和 OpenClaw 配置说明也已清理。 本轮新增发现:1 项 P2[P2] OpenClaw 多块或非文本 toolResult 会直接跳过,不会进入 structured JSON 路径。 位置:英文 user-manual.md:107;中文 user-manual.md:103。 新增的 “any other object or array / 其余对象或数组整体作为结构化 JSON 传给 Core” 范围过大。实际 这会使用户错误预期多块/多模态工具结果也会压缩并产生统计。请在中英文两处明确这些 toolResult 原样跳过,并把 structured JSON 的兜底范围限定为非 toolResult 的其他对象或数组;不需要修改实现。本轮直接提取最新提交的实际函数运行了四种输入:stdout 信封走 structured、单 text block 走 tool_text、双 text block 和 image block 均返回 null。 尚需完成的整理PR 标题和正文仍是原来的阈值文档说明,正文还保留 Codex 500/4000、OpenClaw 配置覆盖等旧内容。请按最终合并后的三个文档意图重写标题和正文,说明 8 个文件的实际范围、参考基线、验证结果,以及与 #2596 / #2601 的关系。 请将上述文档修正 amend 到当前提交,继续保持 1 个 commit,完成后回复新的 head SHA。 验证: |
|
本轮意见已完成整合与修正,请复审。 新 head: 三部分内容整合:压缩触发条件与阈值(本 PR 原有)、节省率字段定义(承接 #2596 意图)、压缩率适用场景与标准测试负载(承接 #2601 意图,并与 main 已有「运行仓库参考负载」章节合并去重,未另立重复章节),均中英文同步。 四个技术问题逐项处理(均按基线源码重新核对,非照搬旧分支文本):
对齐最新 main 时额外发现并一并修正的两处过时文本:framework-integration 共享 Hook 路由表中「构建日志/搜索结果/表格等在领域 Compressor 接入前原样透传」一行(build-log 与 CSV/TSV 压缩器均已在 main 落地,与 user-manual 4a 的交叉引用矛盾);以及 user-manual 中已无法在源码中找到的 AgentScope「conservative/balanced/aggressive 模式阈值」说法(已按 sdk.md 与源码改为「阈值是 Core 行为、 压缩率数值复测:参考快照已在基线上用 验证记录: |
…rent source Carry the documentation intents of PRs agentic-os-org#2596 and agentic-os-org#2601 into this single change set and re-verify every claim against current source behavior: - user-manual: add compression trigger conditions and thresholds; describe OpenClaw input handling (string / single-text-block take the replaceable text path; other objects such as shell envelopes pass whole as structured JSON without text replacement) separately from Hermes (unwraps the shell envelope output field); correct array truncation to the head window plus 8-item tail window with a stashed middle segment, and document the 33-object record-reduction exception that bypasses the category caps - measuring-savings: add saving-rate field definitions, distinguishing the clamped summary/compare percentages (saturating subtraction, 0% on a zero denominator) from stats diff, which keeps negative values; add compression-rate applicability scenarios; refresh the reference workload snapshot to 0.8.2 measurements and add the stacking configurations - cli-reference, framework-integration: add cross-references and update the shared-hook routing table for the connected build-log, CSV/TSV, and search path sharing compressors Docs only; en/zh mirrored. Verified with scripts/docs-lint.sh, scripts/docs-link-check.py, the website build for both locales, and a re-run of the l1-compressor compression_rate report on the baseline.
186fe10 to
06cbf4b
Compare
|
08:11 复审意见已处理完毕,请再审。 新 head: 逐项处理
基线说明(新变化)复审后 main 又前进了三个提交,其中
merge-base 为 另:bot 审查此前备案的 2 条 [P2](数组头/尾窗口与 ≥33 对象数组 Record Reduction、OpenClaw/Hermes 分别描述)已随上一轮 head 本轮验证(真实执行)
|
kongche-jbw
left a comment
There was a problem hiding this comment.
LGTM. 已复审 06cbf4bd94e0e7b2ea7f72c197c0f2b8e431b98e,未发现阻塞合并的问题。
- 上轮 OpenClaw 多块、非文本及无效
toolResult的处理边界已在中英文文档中修正,与实际跳过 Core 的行为一致。 - #2596 / #2601 的有效文档意图已整合,当前仍为 1 个提交、8 个文档文件;此前数组保留规则、OpenClaw/Hermes 差异、节省率公式等修正均保留。
- 本轮新增的 Git Diff opt-in 裁剪说明已对照源码核对;也检查了 merge-base
a30575361到当前 main29124111a的差异,未发现与本 PR 文档冲突的行为变化。 git diff --check通过,最新 head 的所有实际执行 CI 检查均通过;代码测试按纯文档范围跳过。本轮未独立重跑 benchmark 或 E2E。
非阻塞整理:请将 PR 正文中的旧基线 cc988a6b1、+199/−14 和 OpenClaw 旧概括同步为本轮实际情况(基线 a30575361、+203/−14 及 toolResult 跳过例外);最新评论已记录正确说明。
改动说明
按审查意见,本 PR 作为三份 tokenless 文档需求的统一交付入口:承接 #2596(节省率字段定义)与 #2601(压缩率适用场景与标准测试负载)的有效意图(两者已关闭并指向这里),并与本 PR 原有的「压缩触发条件与阈值」整合。所有行为说明均在下方基线上按当前源码逐项重新核对,不是旧分支文本的直接搬运。
基线与提交形态:分支已重写为相对最新 main(
cc988a6b1,Tokenless 0.8.2)的单个提交(git rev-list --count cc988a6b1..HEAD= 1),旧的分支合并历史已去除;diff 仅含 8 个 tokenless 文档文件(+199/−14),中英文镜像。1. user-manual.md —「压缩触发条件与阈值」(本 PR 原有内容,按本轮意见修正)
stdout/stderr,至少 2,000 字符)先拆出送入文本槽位,压缩后回填同形状信封;{"stdout": ...}Shell 信封)整体作为结构化 JSON 传给 Core 且禁用文本替换(信封保持顶层结构,只适用 JSON 域压缩)——修正此前「OpenClaw 与 Hermes 都会拆出主文本字段」的错误合并描述;output字段送入 Core(允许替换),压缩后回填同一信封;其他工具结果直接传递。tokenless-compressors/src/json.rs与 CLI 参考):数组仅在长度超过「类别阈值 + 尾部窗口」时截断——头部窗口保留至阈值个元素、尾部窗口默认 8 项内联保留、丢弃的中间段启用 Stash 时可取回、两窗口间插入截断标记;至少 33 个 JSON Object 的对象数组不受表中 128 / 65,536 阈值控制,改走 Record Reduction(32 条基础预算:前 4 + 后 4 + 错误/异常信号记录 + 数值异常记录 + 其余稳定采样;完整原始数组写入 Stash;无 Stash 时保留全部记录)。表列名相应改为「数组截断阈值」。--array-tail-preserve);Codex 与 Qwen Code 在当前 PostToolUse 契约下不运行响应压缩与 TOON;OpenClaw 读取tool_categories.json映射内容来源(skip_tools/shell_tools已删除);TOON 独立触发(≥500 字符、槽位接受文本、严格变小才采用);删除过时的 AgentScope 模式阈值说法——SDK/AgentScope 层的压缩阈值、内容检测与 TOON 选择均为 Core 行为,TokenlessRuntime.compress_response可按次覆盖截断参数。2. measuring-savings.md — 迁移内容(中英同步)
chars_saved_percent/tokens_saved_percent/saved_percent(compare 与 diff 两种 Schema);公式边界已修正——summary 与 compare 的节省量经saturating_sub钳制为 0,diff 保留负值;分母为 0 时一律返回 0%;含 before=100 / after=150 → compare 0%、diff −50% 的示例;保留 prompt-cache 命中指标(savings_rate/cached_tokens)与 Tokenless 节省的区分说明。gen_fixtures.py确定性生成、run-benchmarks.sh --quick入口和「数字必须注明测量 commit」的提示;参考快照已在基线上复测更新(0.7.11 的 response 65.8% 已失效):canonical response 36.3% / schema 47.3% / TOON-only 17.0% 与 −2.3%,并新增叠加配置表(response_only 34.0%、schema_only 3.0%、schema_response 37.0%、response_toon 47.4%、toon_only 15.8%、full_stack 50.3%),注明叠加行以 5,551 估算 Token 的合并基线为分母、TOON 行为不做门控的度量且部署结果可能略有差异。3. cli-reference.md / framework-integration.md
测试情况(真实执行,已脱敏)
环境概要:Linux x86_64;cargo/rustc 1.96.0;Node v22.21.1 / npm 10.9.4;Python 3.8.17;pandoc 2.0.6。
bash scripts/docs-lint.shpython3 scripts/docs-link-check.pynpm ci --prefix website、npm run validate:locales --prefix website、npm run build --prefix websitesrc/tokenless/benchmark/l1-compressor执行cargo build --release --bin compression_rate与./target/release/compression_rate --json./run-benchmarks.sh --quickgit rev-list --count cc988a6b1..HEAD第 7 项核对清单(均在基线
cc988a6b1):tokenless-compressors/src/json.rs(头/尾窗口截断、33 项起 Record Reduction、Stash 依赖、CLI 默认 4096-32-8);tokenless-runtime/src/entry.rs(200 字符响应门禁、500 字符 TOON 门禁)与post_tool/pipeline.rs(JSON/构建日志/CSV-TSV/搜索路径共享的域路由、Grep 例外、FileContent 跳过)、post_tool/arbitration.rs(严格变小保护);taxonomy.rs+tool_categories.json(类别阈值与内置回退);tokenless-stats的query.rs(comparesaturating_sub、零分母 0%)、diff.rs(负值保留)、record.rs/recorder.rs(summary 钳制);openclaw/index.ts(contentSlot()三类槽位、结构化槽replaceWithText=false、无skip_tools/shell_tools、读取tool_categories.json带回退);hermes/__init__.py(Shell 信封output拆出/回填);compress_response_hook.py(stdout/stderr≥2,000 字符拆出、YAML frontmatter 跳过仅为避免启动子进程);codex adapter(无响应压缩/注入路径);sdk.md(阈值为 Core 行为、非 Python 配置)。未运行项:各 tokenless crate 的
cargo test—— 本次为纯文档变更,未触及任何 crate 源码;与文档数字直接相关的 l1-compressor 质量/对抗测试已通过第 5 项实际执行(97 passed / 0 failed)。基准复测说明:变基到
cc988a6b1前后各执行一次compression_rate,结果完全一致(两个基线之间仅测试/Makefile 变更,git diff 07fcd0b88..cc988a6b1 -- src/tokenless/crates src/tokenless/benchmark src/tokenless/adapters为空)。