refactor(tokenless): drop the standalone toon binary - #2657
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9e67eeefb6
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
kongche-jbw
left a comment
There was a problem hiding this comment.
Review baseline: 52eeb520147b...9e67eeefb647
[P1] 仅清理 Tokenless 自己创建的 toon 链接
src/tokenless/Makefile:177 在全新执行 make install-helpers 时也会无条件删除
$(BINDIR)/toon。若用户此前独立安装了同名可执行文件,安装 Tokenless 会直接将其删除;
uninstall 的第 213 行也有同样风险。用普通文件作为现有 toon 可稳定复现删除。
Possible direction: 仅在该路径是指向旧版 Tokenless libexec helper 的符号链接时删除,
并补充“保留普通文件、删除旧版链接”的安装与卸载回归测试。
[P2] 把 CHANGELOG 条目留给发布提交
src/tokenless/CHANGELOG.md:14 和 CHANGELOG_zh.md:14 在非版本发布提交中写入
Unreleased,违反 specs/documentation-standard.md:272 的 release-only 规则。
请从本 PR 移除这两条,由下一次版本 bump 统一归档。
Forrest-ly
left a comment
There was a problem hiding this comment.
Overall evaluation
Clean, well-scoped removal of the standalone toon binary: TOON encoding has run in-process via the toon-format library since 0.3.2, and this PR strips the dead install-time dependency from every build/packaging channel, helper-binary fallback resolution, tests, and docs. I independently verified the removal is complete and that all upgrade paths shed the leftover executables (RPM drops the %files entries + keeps the %post stale cleanup; the anolisa CLI contract replay removes prior-manifest-owned files; Makefile install/uninstall clean up both paths).
Review conclusion
approve
Detailed findings
🔴 Must-fix (blocks merge)
None from my side. The two existing Codex review threads are not re-raised here; of those, I agree the unconditional rm -f cleanup one (Makefile install-helpers/uninstall) is worth resolving before merge — the suggested guard (only delete a symlink pointing at the legacy tokenless libexec path) is cheap and eliminates any chance of removing an unrelated user executable.
🟡 Suggested (non-blocking)
- [src/tokenless/docs/design/runtime-library.md:9 and runtime-library_zh.md:9] Stale reference to the removed binary: the doc still says Python applications do not require
tokenless,rtk, ortoononPATH. The PR swept the equivalent wording from both READMEs, the npm README, and the user manual, but missed this design doc. Suggest droppingtoonfrom the enumeration in both language versions. - [src/tokenless/tests/test-toon-full.sh:197-205] Scenario 1.7 never checks subprocess exit codes: if
tokenless compress-toonfails outright,p1.stdoutis empty,json.loads("")raises, the fallbackdecompress-toonon empty input also fails, and the uncaught exception surfaces as a raw traceback plus the generic "往返转换存在数据不一致" failure, masking the real cause. Suggest failing fast with a clear message whenp1.returncode != 0ortoon_outis empty (same forp2).
🟢 Worth noting
- The removal is genuinely complete: a repo-wide sweep for toon-binary usage (exec/spawn/
Command::new,resolve_binarycandidates,bin/toonlayout paths,cargo install toon-format) finds zero leftovers across adapters, hooks, crates, the Python runtime, packaging, CI, and build scripts;tool-ready-spec.jsonnever listed it. - The ported tests match the real CLI surface:
-f/--fileexists oncompress-toon/decompress-toon, and the round-trip test'sjson.loadsheuristic correctly tolerates the new no-savings JSON passthrough branch inmain.rs. make uninstallnow also removes$(BINDIR)/toon, fixing a pre-existing gap where the old uninstall deleted the libexec binary but left a dangling symlink in the bin dir.
9e67eee to
509489d
Compare
Forrest-ly
left a comment
There was a problem hiding this comment.
总体评价
新 head(509489d,squash 后的单 commit)完整落实了上一轮全部审查意见:clean-stale-toon 符号链接守卫 + 新增 tests/test-toon-cleanup.sh 回归测试解决了 Makefile 无条件删除 $(BINDIR)/toon 的 P1 问题;两处 CHANGELOG Unreleased 条目已从 PR 中移除(两文件的 Unreleased 段现为空);runtime-library.md/runtime-library_zh.md 中遗留的 toon 表述与 test-toon-full.sh 缺少子进程退出码检查的问题也一并修复。我在本地对新 head 做了独立验证:cleanup 回归测试、raw/npm 打包测试、cargo test -p tokenless-cli(257 passed)全部通过。
审查结论
approve
详细意见
🔴 必须修改(阻塞合并)
无。
🟡 建议修改(不阻塞但推荐)
- [PR description] PR 正文仍写着 "noted in the Unreleased changelog entry",但按上轮意见该 changelog 条目已从本 PR 移除(
src/tokenless/CHANGELOG.md/CHANGELOG_zh.md不再在 diff 中,Unreleased 段为空)。建议同步修订 PR 描述,避免发布时误导 release 流程;条目本身留给下一次版本 bump 归档即可。
🟢 值得肯定
clean-stale-toon的守卫实现正确:$(LIBEXECDIR)为 Tokenless 自有目录故无条件清理;$(BINDIR)/toon仅在 readlink 命中*/anolisa/tokenless/toon或*/anolisa/libexec/tokenless/toon时删除。我核对了全部历史安装布局(Makefile user/system、Anolisa CLI user/system 的 libexec 路径)均能命中这两个模式;普通文件与指向无关位置的符号链接被保留。本地运行tests/test-toon-cleanup.sh通过(install-helpers 与 uninstall 各 3 个场景),并手动验证了 Anolisa CLI user-mode 布局的匹配。test-toon-full.sh场景 1.7(原 1.8)现在对compress-toon/decompress-toon的返回码与空输出 fail fast,且json.loads(toon_out)的 try/except 正确处理了 no-savings JSON passthrough 分支(与main.rs中CompressToon的实际行为一致);-f/--file参数与 CLI 定义吻合。- 移除的完整性再次确认:全仓库 grep 无残留的 standalone toon 调用点(exec/spawn/
Command::new/resolve_binary/cargo install toon-format),tool-ready-spec.json从未包含 toon,env_check.rs的 fallback 收敛为binary == "rtk"且无调用方再传 "toon";spec 的%poststale cleanup 对 user-local 路径的覆盖保持不变。 - 升级路径完备:RPM
%files移除后升级自动清理打包文件;component contract 移除对应 layout 条目;Makefile install/uninstall 由新守卫兜底。
|
Code review of new head
Overall the removal is clean and well-tested; see the review for details. |
Forrest-ly
left a comment
There was a problem hiding this comment.
Re-review of the squashed head 509489d (first round reviewed 9e67eee before the force-push).
First-round feedback — all three items verified addressed
- [P1] Makefile cleanup scope (kongche-jbw / codex bot) — Fixed.
clean-stale-toon(src/tokenless/Makefile:170-183) always removes the Tokenless-owned$(LIBEXECDIR)/toonhelper but removes$(BINDIR)/toononly when it is a symlink whose target matches a Tokenless helper layout (*/anolisa/tokenless/toonor*/anolisa/libexec/tokenless/toon). Bothinstall-helpers(old line 177 risk) anduninstall(old line 213 risk) now use it. I verified the case patterns against system-mode (/usr/libexec/anolisa/tokenless/toon,/usr/local/libexec/...), user-mode (~/.local/lib/anolisa/libexec/tokenless/toon) and relative symlink targets; unrelated regular files and foreign symlinks are preserved. - [P1] Regression tests (kongche-jbw) — Added:
tests/test-toon-cleanup.sh(wired intomake test/.PHONY) covers preserve-regular-file / remove-legacy-symlink / preserve-foreign-symlink for bothinstall-helpersanduninstall. I ran it locally on this head: passes. - [P1→P2] Unreleased CHANGELOG entries — Fixed: this head no longer touches
CHANGELOG.md/CHANGELOG_zh.mdat all; the release note should be folded into whichever release section ships this change (perspecs/documentation-standard.mdrelease-only rule).
Additional verification on 509489d
- Full-tree grep: no leftover standalone-
toonbinary references —env_check.rsfallback paths,tool-ready-spec.json(never listed it), user-guide docs, adapters, npm packer/postinstall, raw packaging, RPM spec and CI smoke check are all clean; remaining "toon" mentions are legitimate TOON-format/library references. - All changed shell scripts pass
bash -n; both npm scripts passnode --check; the portedtest-toon-full.shround-trip logic correctly toleratescompress-toon's no-savings JSON passthrough (matchestokenless-clibehavior), andcompress-toon -fis a real flag. - RPM
%filesremoval + unchanged%postuser-local cleanup cover the RPM upgrade path as described.
Suggestions (non-blocking)
- P2 — anolisa catalog manifest now out of sync.
src/anolisa/manifests/components/tokenless/component.toml:54-58,65-68still declares the twotoonlayout entries (libexec executable +{bindir}/toonsymlink). This PR updates the tokenless-side contract (component.toml.in) but not the bundled catalog copy thatcatalog.rsdescribes as "real component contracts extracted from the OSS release artifacts". Installs stay correct (the install runner prefers the artifact-embedded contract), but nothing else will resync this file — version-bump commits only touch theversion =line. Recommend deleting those two entries in this PR. - P3 — root
AGENTS.md:76:make build # tokenless + RTK + TOON + OpenClaw pluginis now stale; TOON is no longer a built artifact (linked via the toon-format library). - P3 — new cleanup test is not exercised by CI. The tokenless CI job runs
cargo test,make test-integration, and the npm smoke test, but not the aggregatemake test, sotest-toon-cleanup.shonly runs locally. It is fast and self-contained (stubs rtk, DESTDIR-scoped) — consider addingmake -C src/tokenless test-toon-cleanupto the CI job.
(FYI, pre-existing on main and out of this PR's scope: NOTICE:75 still lists src/tokenless/third_party/toon/ as a git submodule, which hasn't existed since the crates.io migration.)
Verdict: COMMENT — all first-round blockers are resolved; the removal itself is clean, complete, and well-tested. The catalog-manifest sync (suggestion 1) is the one item I'd recommend addressing, ideally in this PR.
509489d to
233617e
Compare
|
@Forrest-ly 已请求 re-review。相对你上次批准的
验证:manifest TOML 解析通过; |
Forrest-ly
left a comment
There was a problem hiding this comment.
Re-review of the incremental delta 509489d → 233617e (new squashed head after rebase onto post-0.7.9 main).
Overall assessment
The increment is exactly three newly-touched files, each one resolving an open item from my last review; every other file's patch is byte-identical to the previously approved 509489d (verified by per-file patch-hash comparison of both commit trees), so the rebase introduced no content drift and all prior verification carries over.
Review conclusion
approve
Detailed findings
🔴 Must fix (blocking)
None.
🟡 Suggested (non-blocking)
None new. One carried-over note for traceability: the earlier P3 "consider wiring make test-toon-cleanup into the CI job" suggestion is still unaddressed in this head — remains a non-blocking consideration.
🟢 What was done well
- [P2 resolved] anolisa catalog manifest synced.
src/anolisa/manifests/components/tokenless/component.tomldrops both toon layout entries (thelibexec/anolisa/tokenless/toonexecutable and the{bindir}/toonsymlink) and nothing else. Verified at233617e: zero remainingtoonreferences in the file, the remaining layout is untouched, and the entry set now matches the tokenless-side contractsrc/tokenless/.anolisa/component.toml.inline-for-line. - [P3 resolved]
AGENTS.md:76comment updated tomake build # tokenless + RTK + OpenClaw plugin— accurate against the Makefilebuild:target (build-tokenless build-openclaw-plugin build-dsh-plugin, wherebuild-dsh-pluginis only a bundle-validation seam and predates this PR). - [NOTICE FYI resolved] The stale
third_party/toon/submodule entry is replaced by atoon-format (v0.5)entry under Rust Dependencies. Cross-checked: version matchessrc/tokenless/Cargo.lock(toon-format 0.5.0), the MIT license plus both copyright attributions are preserved, and the rewrite also fixes the old description ("lossless binary JSON codec" → "lossless JSON re-encoding", which is accurate — TOON is text). Placement afterclapis consistent with the section's existing append-style ordering.
Verification performed on this head
- Per-file patch-hash diff between
509489dand233617e: all 26 previously-reviewed files unchanged; onlyAGENTS.md,NOTICE, and the catalogcomponent.tomlare new. - Full-file greps confirm no leftover standalone-
toonbinary references in the two newly-edited contract/legal files;toon-format/TOON-format mentions that remain are the legitimate library references. - kongche-jbw's earlier P1 items (guarded
clean-stale-toonsymlink cleanup +tests/test-toon-cleanup.shregression coverage) and the CHANGELOG release-only rule remain intact since their patches are unchanged from the approved head.
|
CI 的 修复见 #2662(v1 冒烟环境显式安装 tqdm)。待其合入 main 后 re-run 本 PR 失败的 job 即可(pull_request 检出的是与 base 的 merge ref,会自动带上修复)。 |
db002c4 to
17e7761
Compare
Forrest-ly
left a comment
There was a problem hiding this comment.
增量审查(已批准 head 233617e → 新 head 17e7761):本次推送为纯 rebase 到最新 main(main...17e7761 = ahead 1 / behind 0,吸收 20 个主干 commit 后重新 squash)。逐文件核对:全部 29 个改动文件的增删行与已批准的 233617e 完全一致,无任何新增未审查改动。
复核要点:
- 首轮 P1 修复仍然在位:src/tokenless/Makefile 的 clean-stale-toon 仅在 $(BINDIR)/toon 是指向 Tokenless helper 布局(/anolisa/tokenless/toon、/anolisa/libexec/tokenless/toon)的 symlink 时才删除,与 LIBEXECDIR=$(PREFIX)/libexec/anolisa/tokenless 的实际布局匹配;用户独立安装的 toon 可执行文件不受影响。tests/test-toon-cleanup.sh 覆盖 regular/legacy/foreign × install-helpers/uninstall 共 6 个场景。
- CHANGELOG 未被改动,符合 release-only 规则(首轮 P2)。
- toon 独立二进制的移除在 Makefile、justfile、RPM spec、raw 打包、component 契约(两份副本同步)、npm 包(package.json/package-npm.js/postinstall.js)、hooks(hook_utils.py/tool_ready_hook.sh)、env_check.rs、测试与双语文档中保持一致;NOTICE 将 toon-format 正确移到 crates.io 依赖区(MIT,静态链接)。
- 新 head CI:Test tokenless ✅ (7m53s)、Test anolisa ✅、Source Build (Ubuntu 22.04) ✅、Check component versions ✅,其余 job 为不相关组件 skipping。
Code review 通过:与已批准内容完全一致,无新增问题。
TOON encoding has run in-process through the toon-format library since 0.3.2 (commit 7089ae0); every runtime path goes through `tokenless compress-toon` / `decompress-toon` and nothing executes a `toon` binary anymore. The standalone binary survived only as an install-time dependency in build, packaging, env-check path resolution, tests, and docs. - stop building/installing toon in Makefile, justfile, RPM spec, raw packaging, the component contract, and the npm packages - drop toon from helper-binary fallback paths in hook_utils.py, tool_ready_hook.sh, and env_check.rs - clean up toon artifacts left behind by older releases on make install/uninstall: the Tokenless-owned libexec helper is always removed, while $(BINDIR)/toon is removed only when it is a symlink into a Tokenless helper layout, so an unrelated user-installed toon executable is preserved (covered by the new tests/test-toon-cleanup.sh); RPM upgrades already remove the packaged files - delete the standalone toon CLI test; port test-toon-full.sh and run-all-tests.sh to tokenless compress-toon/decompress-toon - update packaging tests, CI npm smoke check, build-all.sh, READMEs, design docs, and the user manual Signed-off-by: 爱鲲 <jiawa.syx@alibaba-inc.com>
17e7761 to
787b74d
Compare
Synchronize the 14 Tokenless release surfaces for Gemini schema compression, Python statistics queries, AgentScope packaging, and standalone TOON binary cleanup. The bilingual notes describe final user-visible behavior from #2657, #2663, #2665, and #2666 instead of intermediate test-only fixes. This patch keeps TOON available through the supported tokenless subcommands; the version-only commit adds no runtime behavior. Artifact publication remains handled by the component Raw, npm, Python, and RPM workflows. Assisted-by: Codex:0.148.0-alpha.9 Signed-off-by: 爱鲲 <jiawa.syx@alibaba-inc.com>
Why
TOON encoding has run in-process through the
toon-formatlibrary since 0.3.2 (7089ae0): every runtime path goes throughtokenless compress-toon/tokenless decompress-toon, and nothing executes a standalonetoonbinary anymore. The binary survived only as an install-time dependency — built viacargo install toon-format(network access to crates.io at RPM build time, MSRV friction from its transitive deps) and shipped by every packaging channel without ever being invoked.Verified before removal: zero
exec/spawn/Command::new/resolve_binarycall sites reference atoonbinary across all adapters, hooks, crates, and the Python runtime;tool-ready-spec.jsonnever lists it.What
toonin the Makefile, justfile, RPM spec, raw packaging, the Anolisa component contract, and the npm packages (rootbinentry, postinstall, packer).toonpayload file and{bindir}/toonsymlink entries from the anolisa release manifest (src/anolisa/manifests/components/tokenless/component.toml), which the anolisa installer stages as the real component contract at install time.toonfrom helper-binary fallback path resolution inhook_utils.py,tool_ready_hook.sh, andenv_check.rs.toonartifacts left behind by older releases onmake install/make uninstall: the Tokenless-owned libexec helper is always removed, while$(BINDIR)/toonis removed only when it is a symlink pointing into a Tokenless helper layout, so an unrelated user-installedtoonexecutable is preserved (regression-tested by the newtests/test-toon-cleanup.sh). RPM upgrades already remove the packaged files via%files, and the existing%poststale cleanup keeps covering user-local paths.test-toon-full.shandrun-all-tests.shtotokenless compress-toon/decompress-toon(the round-trip test now tolerates the no-savings JSON passthrough).build-all.sh, both READMEs, the npm README, the user manual, and themake buildcomment inAGENTS.md.NOTICEentry that still pointed at the removedthird_party/toon/submodule:toon-formatis now listed under the Rust crate dependencies as a statically linked crates.io crate, keeping its MIT copyright attribution.CLI users keep the same functionality through
tokenless compress-toon/tokenless decompress-toon. The npm root package no longer exposes atoonbin and the RPM no longer provides/usr/bin/toon. Perspecs/documentation-standard.md, the changelog entry for this user-visible change is deferred to the next release version-bump PR.Testing
cargo test --workspace: 12 suites, all green; clippy shows no new warnings against my changes.tests/test-package-raw.sh,tests/test-package-npm-prebuilt.sh, and the newtests/test-toon-cleanup.sh(install-helpers/uninstall × preserve-regular-file / remove-legacy-symlink / preserve-foreign-symlink) pass.test_compress_response_hook,test_compress_toon_hook, codex/hermes thresholds, rewrite, resolve_agent_id);test-openclaw-toon-threshold.mjs4/4.scripts/check-component-versions.pyandtests/test-check-component-versions.shpass with the edited release manifest.PATHcontains notoon: tabular JSON encodes at 44% char savings,compress-toon → decompress-toonround-trips semantically identical JSON;compress_toon_hook.py(1845→825 chars) and the combinedcompress_response_hook.pypipeline (2437→745 chars, 69%) both produce correct hook output; stats recording works;make installinto a DESTDIR succeeds and removes a pre-seeded staletoonfrom an older layout.🤖 Generated with Claude Code