Skip to content

uno-testing: the loop's measured cost — drop the pre-build, don't restart for clean state, wait on state instead of polling #199

Open

Description

@kazo0

Summary

Three things in uno-testing's loop cost an Uno session more than the equivalent Flutter session, and two of them the skill text prescribes. From the skill-ab catalog scenario in unoplatform/private (results, studio main@ffb6fad, App MCP 2.0.0-dev.15, Uno.Sdk 7.0.0-dev.81, one session per arm):

Uno, with skills Uno, no skills Flutter
cost $12.34 $11.85 $3.52
tool calls 642 613 153
model calls 201 200 111
mean context per call 183k 165k 79k
dotnet build / flutter output carried per call 10k 14k 3k
app starts and restarts 14 (211 s) 15 ~9 flutter run launches
uno_app_find_elements 122 203 0 (39 driver calls)
screenshots 43 57 0

The same app came out of all three, and every harness check passed. The gap is the loop, not the code. With and without skills, Uno costs the same, so it's not the skill text's size; it's what the loop does.

1. Step 1 prescribes a build before the start (text change)

Build once, start once. … Build once with dotnet build -f net10.0-desktop … so compile errors surface as build output. Then uno_app_start(…).

uno_app_start builds too, so every start is two builds; a compile error fails the start, and its stdoutFile holds the full log. The sessions ran dotnet build in the shell 5–6 times; the output stayed in context at 10–14k tokens per call, against 3k for Flutter. Fix: drop the pre-build; uno_app_start(stdoutFile) keeps the full log out of context and still fails on compile errors.

2. Restarts to reset state (text gap)

Nothing in the skill says not to restart to get a clean state. A1's fourth launch: "Given all these hot reloads, state could be inconsistent, so restarting the app fresh is cleanest." Hot Reload had reported applied. The no-skills session restarted after five consecutive edits (launches 4–8) with Hot Reload Ready each time. A desktop start or restart took 15–23 s in these sessions, plus the ~13 s before Hot Reload is ready again (unoplatform/uno#25530).

Of A1's 14 launches, 7 were unavoidable (first start, Android, one per data mode, back to normal). Of the other 7: 3 repeated a --data=slow launch to catch a 4 s loading screen (unoplatform/uno.app-mcp#210 and #138 cover that), 1 added logging then restarted, 1 was the "clean state" restart, 1 was a build-first start, 1 fixed a real bug.

Fix: a rule next to the Hot Reload one. After applied, re-navigate or refresh the data to reset state; restart only for RudeEdit, InternalError, or a change the status says Hot Reload didn't cover.

3. Polling for state (needs a tool)

The skill tells the agent to wait with find_elements(waitForMs) after an action, and it did. But waitForMs waits for a match to exist, not for items to reach 40 or a row to become selected, so the agent re-read the scrollbar 31 times and the list ~45 times. The critical rule "poll until it clears, then assert" describes exactly the loop that cost the calls. unoplatform/uno.app-mcp proposals for uno_app_wait_for and uno_app_scroll_into_view are filed; once they land, step 6 and that rule should say "wait on the state in one call".

What the text already gets right

  • Screenshots: the rules say save to a file and read one back only for a visual assertion. The agent saved 41 of 43 with path, and asked for the image back (returnImage: true) on 34 of them, judging them visual. 36 came back inline at maxWidth 600–900. A maxWidth: 412 default in the text would halve what those cost, but the big savings are in 1–3.
  • Hot Reload flow: applied / RudeEdit / restart once is clear and was followed.

Related

Activity

  1. self-assigned this
    on Oct 20, 2026
  2. kazo0 commented on Oct 20, 2026

    @kazo0
    ContributorAuthor

    The spec that collects these measurements is unoplatform/private#1216 (spec 006, agent edit-loop cost), open as a draft.

  3. vatsashah45 commented on Oct 20, 2026

    @vatsashah45
    Contributor

    Three-session medians on the same pins (App MCP 2.0.0-dev.15, Uno.Sdk 7.0.0-dev.81) sharpen two points here.

    The restart habit is the model's, not the skill text's. The no-skills arm (catalog-20261020-093343, unoplatform/private#1218: a plugin holding only plugin.json, so the Uno MCPs and nothing else) relaunched 16–30 times a session; the with-skills sessions on the same brief relaunched 23–38 (catalog-20261019-225302 unoplatform/private#1214, catalog-20261020-034157 unoplatform/private#1215). Screenshot volume is the same with or without skills too. Section 2's rule is still worth adding, but the bigger lever is on the App MCP side (unoplatform/uno.app-mcp#210 start-at-size, #211 wait-for-state): 5–17 launches a session are --data=slow relaunches chasing the loading screenshot.

    The step-by-step procedure serializes tool use. Same brief, one typical session a side (#1218):

    no skills with skills
    model calls 163 230
    tool uses 381 386
    tools per model call 2.34 1.68
    total context tokens 25.4M 41.3M
    skill text in context – 13k (7%)

    The skill text is 7% of the with-skills context; most of the 60% extra is ~40% more model calls over the same tool uses. MAUI's and Avalonia's agents sit at 1.5–1.7 tools per call as well. Steps 3–7 (baseline, locate, act, wait and re-snapshot, assert) read as one step per turn and are followed that way. Suggestion for the rewrite, alongside 1–3: say that independent checks go out together (snapshot and screenshot in one turn, several find_elements at once, act-then-wait in one turn once #211 lands). Filed separately so it can be tracked on its own: #200.

    What the skills buy on this brief, for the record: with them 100% of app actions are addressed to an element and the recommended stack is picked 6/6; without them the agent clicks coordinates (127 pointer_click in one session) and picks plain MVVM 3/3. Cost: $14.23 median with skills (six sessions, $12.89–$22.38) against $9.15 without ($8.75–$14.00), about 35%.

  4. kazo0 commented on Oct 20, 2026

    @kazo0
    ContributorAuthor

    Measured on the catalog brief with studio branch dev/steve/uno-testing-loop (2026-10-20):

    • The pre-build is gone, but the fix had to be in uno-build-app, not here: every shell dotnet build ran before uno-testing was loaded (new-app.md's baseline and verification.md's table prescribed them). With the start as the build: shell builds 0, build output 1–2k tokens per call (from 10–14k). The shell-build gate added alongside never had to fire.
    • Restarts don't yield to text or to a gate. With "never restart for a clean state" in the skill, sessions still restarted 7–13 times from their own beliefs. A PreToolUse gate denying restarts was tried in three versions and beaten in one session each: close-then-start, alternating argument sets, then --data=NORMAL, nOrmal, norMal… and an invented --shot=loading2. The agent: "The hook blocked the start … so I need to try adding --data=normal to the arguments to get past it." That session cost $18.35 against $10–12 without the gate. The gate is reverted; launches go back to the product: unoplatform/uno.app-mcp#208, feat(skills): fill five gaps in AncestorBinding, cards, SafeArea, Simple icon buttons and MVUX selection #210, feat: enable uno-platform-studio plugin for Kimi Code CLI #138, Hot Reload takes ~13 s to become Ready on every app relaunch, even with the DevServer already running uno#25530.
    • Routing works: with task-first hub descriptions and the feature contract naming the hub per concern, the session loaded uno-toolkit and read responsive.md for the first time on this brief.

    Branch kept: the text changes, the uno-build-app change, the hub descriptions, the shell-build gate. The lesson is in unoplatform/private#1216.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions