# Pending and Completed Task Endpoints

Endpoints for a session's resumable pending tasks and its completed task history.

| Method | Path | Description |
|---|---|---|
| `GET` | `/v1/session/:id/task` | List resumable pending (`ask_user` / confirm) tasks as `{pending:[{task_hash, objective, has_questions}]}`; the `background` count (v1.3.0) was Removed in v1.3.8, since a task no longer stays pending for background work. `?live=1` lists the pending tasks whose run is live instead. Tasks whose run is still live are excluded — a run refreshes `action:<session_id>:<task_hash>` in ToriiDB every 55 s with a 60 s TTL (v0.35.3), so a task left behind by a closed window or a killed process reappears here within a minute |
| `GET` | `/v1/session/:id/task/:task_hash/questions` | `{questions:[{question, detail?, options?, multi_select?, secret?}]}` of one pending task; 410 when the task was already resolved elsewhere |
| `POST` | `/v1/session/:id/task/:task_hash/resume` | `{answers?}`. Answers a pending task and resumes it, waiting up to 60 min for the run: `{session_id, text}`, or `{session_id, canceled:true}`; 410 when the task was already resolved elsewhere. Since v1.3.0 a resume without answers claims the task first and returns 409 `[Conflict] pending task: running` when a run already holds it |
| `DELETE` | `/v1/session/:id/task/:task_hash` | Discard a pending task without answering; 404 when there is no such pending task |
| `GET` | `/v1/session/:id/task/history` | **local** — completed tasks of this session, newest first: `{task_hash, end_at, objective, model, reasoning}` per row. `?keyword=` filters on the objective and the recorded action text |
| `GET` | `/v1/session/:id/task/:task_hash/history` | **local** — the full action record of one completed task, returned as a JSON string under `content`. 404 when that hash has no record |
