How-toMulti-sourceSelected73°

OpenClaw deletes 400k lines of AI-generated test code

Why we picked it

Vague cleanup prompts make coding agents stop early, while hard numeric constraints push them to finish a real pruning pass. Teams using Claude, GPT or other agents for maintenance can apply the same coverage-window constraint to their own AI-swollen test suites. The metric-first prompting pattern transfers directly to refactoring tasks beyond tests.

OpenClaw removed around 400,000 lines of its own test code with almost no change in code coverage.

Body

Peter Steinberger attributed the bloat to modern coding models writing excessive unit tests, such as ten cases asserting constant strings.

His technique is to give agents an aggressive target, like deleting the least useful 20% of tests while keeping coverage fluctuation within 2%, instead of a vague instruction to clean up.

Original · Viking

和前几天的观点一样:OpenClaw 删掉了大约 40 万行自己的测试代码 代码覆盖率几乎没掉 原因是现在的模型特别爱写没用的单元测试了,为了测试而测试,写十个case 去判断常量里的字符串。 作者还说:假如只跟 agent 说 清理一下,它会很早就停了不改了 ,要给它一个更狠的目标,比如 删掉最没用的 20% 测试 同时覆盖率波动控制在 2% 以内 x.com/vikingmute/sta… Peter Steinberger 🦞 @steipete OpenClaw deleted around 400k LOC of its own tests without much change in code coverage. Modern models just love writing tests for every tiny change, even if they aren't useful. This skill helped. github.com/openclaw/openc… 🔗 View Quoted Tweet📊 1 ⚡

Industry Coordinates & Source Verification

This report is categorized under AITOP's "How-to" desk, focusing on US frontier AI labs and Silicon Valley technology leaders. Within our cross-regional analytical framework, it directly maps to AI developer toolchains, coding agents, and engineering workflows. Key entities and technical topics under continuous tracking include OpenClaw, coding assistants, prompt engineering, agents.

Source attribution: curated from Viking (@vikingmute). Cross-source corroboration: 4 independent sources have covered this development (including IT之家, AI Will, openclaw), confirming industry-wide signal strength.