Know which layer you’re in
The task-level
error object (holding error.control_type and error.prompt) is part of the task status payload - distinct from the JSON-RPC envelope.
A move for every terminal
Retry discipline
- Retry the task, not blindly.
timeout,agent_error, anddevice_offlineare worth one retry after addressing the cause. Retryingiteration_limitwithout splitting, orqueue_wait_exceededwithout checking the device, just repeats the failure. - Never construct task IDs. Use exactly what
phone_run_taskreturned; after a handoff, monitor thecontinuation_task_id, not the original.task_not_foundusually means an expired or wrong-session ID - start a replacement task. - Cancellation races are benign. A cancel that arrives after completion
returns
already_completed: true; act on the task’s realterminal. - Repeating the same answer to a
needs_user_controltask is safe; sending a different second answer is rejected.
Design failure into the workflow
- Split workflows into per-errand tasks so a failure only costs one step - see Task design.
- Ask prompts to report “not found” explicitly, so an empty
resultis never ambiguous. - Treat
monitor_timed_out: trueas keep waiting, never as failure.
Related
Task lifecycle
Where each terminal comes from
Troubleshooting
Symptom-based debugging