Custom tool demo — set_sleep_time

One natural-language line sets both bedtime and wake-up via a composite tool-call — the interaction-mode authoring records it as a menu-tree edge, and the same test replays as a generated on-device regression that asserts the value. Samsung Health · SM-S928N (test rig, dummy data).
on-device regression: 1/1 PASS · bedtime 9:30 3-family review: unanimous SAFE (3 rounds, 11 findings fixed)

The pipeline — one authored test, three uses

① NL RUN

"set the sleep bedtime to 9:30 PM and the wake-up time to 11:20 AM" → the model emits set_sleep_time(bedtime 9:30, wakeup 11:20) — one line, both fields.

② INTERACTION TC

The authoring walk records the tool-call as a menu-tree edge (action.class = set_sleep_time + args), then :verify value "9:30" bakes a deterministic value proof.

③ REGRESSION

--from-feature sleep code-gens Kotlin: SleepTimeHelper.setSleepTime(...) + assertNotNull(...text("9:30"))connectedAndroidTest passes on-device.

② Interaction mode — the device walkthrough (authored golden SH-SLEEP-0012)

1 · open Samsung Health
1 · open Samsung HealthCold-launched Home dashboard.
2 · tap Quick add
2 · tap Quick addThe Quick add sheet.
3 · tap Sleep time
3 · tap Sleep timeSleep clock-face editor — default 11:00 PM / 7:00 AM.
4 · set_sleep_time  ← the one-line tool-call
4 · set_sleep_time ← the one-line tool-callONE NL line set BOTH: bedtime committed 9:30 PM (wake-up stays clock-derived — app policy).
5 · :verify value "9:30"
5 · :verify value "9:30"Deterministic value proof — 9:30 present.
6 · tap Save
6 · tap SaveSleep record saved.

③ Generated regression (a pure function of the authored capture-log)

@Test fun sh_sleep_0012() {
    // ... launch → Quick add → Sleep time ...
    SleepTimeHelper.setSleepTime(device, 9, 30, "pm", 11, 20, "am")   // ← the composite tool
    // value proof (:verify value "9:30")
    val found = device.wait(Until.findObject(
        By.res(PKG, "sleep_top_center_duration_bedtime").text("9:30")), NAV)
    assertNotNull(found)                                              // ← asserts bedtime 9:30
    device.findObject(By.text("Save")).click()
}

The composite tool code-gens to a hand-written SleepTimeHelper (UiAutomator mirror of the runtime tool). The value proof rides on the paired :verify — a CI gate now enforces that every set_sleep_time step ships with a time-shaped value-verify (no vacuous-green).

Why the value verify is deterministic (not an AI judgment)

The first live replay set 9:00, not 9:30 — the byhand helper committed the hour but not the reflowed minute (fixed by typing digits as key events). The deterministic :verify caught it; an AI arrival judgment would have hallucinated past it. That is the point: interaction-mode authoring is 100% reliability-critical, the regression run is allowed to fail — but it must fail loud on a real value miss.

Wake-up = app policy, not a defect

The SH sleep editor derives wake-up from the current time; a numeric edit re-reads but Done keeps the clock value. The one-line tool still sets both (the impact); only bedtime is the settable/assertable value proof.

Generated by gen_sleep_demo_report.py from the committed blackboard + screen sidecars (device screenshots embedded; test rig with dummy data).