feat: surface task execution progress across Host Agent and Cloud

Host Agent now persists step-level execution detail locally (via a real
TaskMetadataStore/Timeline wired into TaskRunner) and reports a bounded
in-progress snapshot piggybacked on lease renewal. Cloud persists that
snapshot per active assignment and exposes it through the existing task
list/detail query path; Cloud Console renders it as a live badge. Host
Agent's local console gains authenticated, read-only task list and
detail/timeline pages (same-origin, server-rendered) with inlined
screenshots.

Also fixes a pre-existing gap in the shared Timeline: the actual
per-step LLM prompt is now recorded instead of the task goal, benefiting
both Runtime and Host Agent consoles. When a host uses the cloud planner
transport, each decide call's prompt and resulting tool decision are
durably logged in a new planner_decision_log table (with bounded
retention) and browsable from Cloud Console; direct-transport hosts
explicitly surface a "not reported" state.

Includes Alembic migrations 0008 (progress columns on scheduled_tasks)
and 0009 (planner_decision_log), bounded Host-Agent-local retention,
dual-backend repository parity, and Vitest + pytest coverage. Task 6.5
(manual end-to-end device verification) remains.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-07-14 12:47:49 +08:00
co-authored by Claude Opus 4.6
parent c049c3c1b1
commit ec261d57c2
59 changed files with 3801 additions and 122 deletions
@@ -0,0 +1,34 @@
## ADDED Requirements
### Requirement: Cloud Control Plane persists each resolved planner decision for later retrieval
The Cloud Control Plane's planner-decision endpoint SHALL, for each request it successfully resolves to a tool-call decision, persist the request's system prompt, user prompt, the resolved tool name and arguments, and an assigned step index (scoped to the request's `task_id`/`attempt`) to a durable, bounded-retention store, in addition to returning the decision to the requesting Host Agent. The Cloud Control Plane SHALL NOT persist screenshot bytes from these requests.
#### Scenario: A planner-decision request resolves successfully
- **WHEN** the Cloud Control Plane resolves a planner-decision request to a tool-call decision
- **THEN** it persists the request's system prompt, user prompt, the resolved tool name and arguments, and a step index for that `task_id`/`attempt`, before returning the decision to the Host Agent
#### Scenario: A planner-decision request fails
- **WHEN** the configured provider call fails and the endpoint returns a structured failure response
- **THEN** no row is persisted for that request
#### Scenario: A screenshot was included in the request
- **WHEN** a planner-decision request includes a screenshot
- **THEN** the screenshot bytes are used only to call the LLM provider and are not written to the persisted decision log
### Requirement: Persisted planner decisions are retained within a bounded window
The Cloud Control Plane SHALL prune persisted planner decisions once their owning task has been in a terminal state for longer than a configurable retention window, so that indefinite operation does not cause unbounded growth of the decision log.
#### Scenario: A task's retention window has elapsed since reaching a terminal state
- **WHEN** a task reached a terminal state more than the configured retention window ago
- **THEN** the Cloud Control Plane removes that task's persisted planner decisions
#### Scenario: A task is still active or within its retention window
- **WHEN** a task is still active, or reached a terminal state less than the configured retention window ago
- **THEN** its persisted planner decisions remain available for query
### Requirement: Cloud-side planner decision history is scoped to hosts using the cloud-proxy transport
The Cloud Control Plane's persisted planner decision log SHALL only ever contain entries for hosts whose planner calls were routed through the cloud-proxy transport; it SHALL NOT contain entries, synthesized or otherwise, for hosts using the direct-to-provider transport.
#### Scenario: A host uses the direct-to-provider transport
- **WHEN** a Host Agent configured for the direct-to-provider transport executes an assignment
- **THEN** no planner decision entries for that assignment appear in the Cloud Control Plane's persisted decision log