Scheduled runs: done only when the app confirms
This page is for app authors. A scheduled or timer run is ok only when your app says its work finished. A 2xx answer alone does not mean that when the work is still going.
What your app answers
- Finished inside the call: answer 2xx with any body. The run is
ok, as before. - Took the work, not done: answer
202, or 2xx with JSON{"status": "running"}(alsoprinting,pending,accepted,in_progress). The run reads running. The app is not put to sleep while it runs. The deadline is the schedule'stimeoutseconds after the answer. - The device it drives is asleep: answer 2xx with
{"status": "device_asleep"}. Nothing happened, so the attempt is retried.
Confirm
When the work ends, call POST /api/v1/timers/finish with the app's own token:
{ "run": "<the idempotency-key header it was sent>", "status": "ok", "error": "why, for failed" }
status is ok, failed or device_asleep. error is optional text of at most 2000 characters. A person's token gets 401, bad input gets 422.
Retries
failed, device_asleep and no confirmation by the deadline are unfinished attempts. They retry with the usual backoff while retries remain, with the same idempotency key and run id, so an app that does its effect once per key never repeats it. When the attempts are spent the run ends as failed (or device_asleep) and the owner is asked.
A schedule that fails or finds its device asleep on five days running pauses itself and asks the owner. A device asleep counts as a failed day.
A late confirmation
Once the deadline has passed and the run has been retried, the earlier attempt is over. A confirmation for it gets 404 (No run of this app is waiting for confirmation). Confirm the attempt in flight with the same run id. The same 404 answers a second confirmation of the same run.
Reading it
The app's Schedules row on the page and the terminal's Schedules screen (src/tui/screens/schedules.ts) read the same rows: running, device_asleep and the retry text (attempt 1: …; trying again …) show the same in both.