跪拜 Guibai
← All articles
Frontend · Trae · Uni-app

AI Automation Broke Down on a 90-Component Migration Until the Verification Loop Got a 12x Rewrite

By 前端梦工厂 ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

AI coding agents are only as fast as their feedback loops. A verification step built around visual inspection and cold restarts can multiply token costs and wall-clock time by an order of magnitude, making automation economically irrational. Swapping screenshots for scripted assertions turns a grinding bottleneck into a fast, auditable pipeline that makes large-scale migration actually feasible.

Summary

Migrating a 90-component cross-platform UI library to uni-app x means rewriting every file in UTS, UCSS, and uvue—a repetitive engineering grind that looked like a perfect job for an AI agent. The initial workflow had the agent restart a dev server, take screenshots, and visually inspect output after every change, a stateless loop that burned tokens and turned a single component fix into an afternoon affair. At that pace, the full migration risked stretching past a month, with credit consumption spiking dozens of times higher than expected. The bottleneck was not model intelligence but a verification step designed for human eyes. Replacing restarts with a persistent service, screenshots with a script that asserts layout properties and interface completeness, and manual records with the script's own output collapsed a ~240-second cycle into a stable ~19 seconds. The same seven-round troubleshooting session that once took 28 minutes now finishes in just over two, and the speed gain changed what tasks felt safe to delegate.

Takeaways
An AI agent performing screenshot-based visual verification on every code change consumed up to 240 seconds per round, making a 90-component migration project infeasibly slow.
Replacing cold server restarts with a persistent service eliminated the heaviest startup cost in the verification loop.
A custom assertion script that checks layout properties, interface completeness, and text alignment replaced human visual inspection, removing the need for screenshots entirely.
The script's output doubles as the audit record, so traceability no longer requires a separate, slow logging step.
After the rewrite, one verification round dropped from ~240 seconds to ~19 seconds, a 12x improvement that held stable across multiple runs.
A seven-round troubleshooting session that previously took 28 minutes of pure verification now completes in about 2.2 minutes, with fewer trial-and-error cycles because the script pinpoints failures immediately.
Token consumption on the Trae Work platform had been spiking dozens of times higher than expected under the old loop; the faster pipeline brought costs back under control.
The speed gain shifted delegation behavior: tasks previously considered too risky or slow to hand off became practical to assign to the agent.
Conclusions

AI agent workflows that look automated on paper often hide a manual bottleneck in the verification step—visual inspection by screenshot is slow, expensive, and stateless by default.

The difference between a usable AI pipeline and a cost sink is rarely the model; it is whether the feedback loop is designed for a machine or a human.

Persistent state and scripted assertions are force multipliers for AI coding agents, turning a loop that burns tokens into one that produces auditable, repeatable results.

Speed changes risk tolerance: when verification takes seconds instead of minutes, developers delegate harder problems to the agent rather than hoarding safe, trivial tasks.

Concepts & terms
uni-app x
A DCloud framework that compiles a single codebase into native apps, mini programs, and H5, using its own UTS, UCSS, and uvue languages instead of standard TypeScript, CSS, and Vue.
UTS / UCSS / uvue
Proprietary variants of TypeScript, CSS, and Vue single-file components used by uni-app x. They differ in syntax, restrictions, and compilation rules from their standard counterparts, which limits AI code generation due to scarce training data.
Trae Work
An AI-powered coding assistant platform that consumes credits (tokens) per operation. Inefficient agent loops can cause credit consumption to spike dramatically, making workflow optimization a direct cost concern.
From the discussion
Featured comments
冉冉同学

The official ecosystem is just too poor. uni-agent is a toy. Look at the deveco-cli released by HarmonyOS next door. For many things AI doesn't know, it can verify directly through deveco-cli, and then AI can follow the specifications.

前端梦工厂

uniappx has been out for so many years and it's still like this. Too few users, too many pitfalls. It feels like the uts language has deviated significantly from standard writing, with too few references. AI can't figure it out either, and multi-platform compatibility is just too hard to do.

See top comments, translated →
Source: juejin.cn ↗ Google Translate ↗ Backup ↗