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:
@@ -0,0 +1,38 @@
|
||||
"""Add nullable per-assignment progress snapshot columns to scheduled_tasks."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
revision = "0008_task_progress_columns"
|
||||
down_revision = "0007_llm_provider_management"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.add_column(
|
||||
"scheduled_tasks",
|
||||
sa.Column("progress_step_index", sa.Integer(), nullable=True),
|
||||
)
|
||||
op.add_column(
|
||||
"scheduled_tasks",
|
||||
sa.Column("progress_step_status", sa.String(), nullable=True),
|
||||
)
|
||||
op.add_column(
|
||||
"scheduled_tasks",
|
||||
sa.Column("progress_summary", sa.String(), nullable=True),
|
||||
)
|
||||
op.add_column(
|
||||
"scheduled_tasks",
|
||||
sa.Column("progress_updated_at", sa.String(), nullable=True),
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_column("scheduled_tasks", "progress_updated_at")
|
||||
op.drop_column("scheduled_tasks", "progress_summary")
|
||||
op.drop_column("scheduled_tasks", "progress_step_status")
|
||||
op.drop_column("scheduled_tasks", "progress_step_index")
|
||||
@@ -0,0 +1,49 @@
|
||||
"""Add planner_decision_log table for D7/D8 full LLM interaction history."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
revision = "0009_planner_decision_log"
|
||||
down_revision = "0008_task_progress_columns"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.create_table(
|
||||
"planner_decision_log",
|
||||
sa.Column("id", sa.String(), primary_key=True),
|
||||
sa.Column("host_id", sa.String(), nullable=False),
|
||||
sa.Column("task_id", sa.String(), nullable=False),
|
||||
sa.Column("attempt", sa.Integer(), nullable=False),
|
||||
sa.Column("step_index", sa.Integer(), nullable=False),
|
||||
sa.Column("system_prompt", sa.Text(), nullable=False),
|
||||
sa.Column("user_prompt", sa.Text(), nullable=False),
|
||||
sa.Column("tool_name", sa.String(), nullable=False),
|
||||
sa.Column("arguments_json", sa.Text(), nullable=False),
|
||||
sa.Column("created_at", sa.String(), nullable=False),
|
||||
)
|
||||
op.create_index(
|
||||
"ix_planner_decision_log_task_attempt",
|
||||
"planner_decision_log",
|
||||
["task_id", "attempt", "step_index"],
|
||||
unique=True,
|
||||
)
|
||||
op.create_index(
|
||||
"ix_planner_decision_log_host_created",
|
||||
"planner_decision_log",
|
||||
["host_id", "created_at"],
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_index(
|
||||
"ix_planner_decision_log_host_created", table_name="planner_decision_log"
|
||||
)
|
||||
op.drop_index(
|
||||
"ix_planner_decision_log_task_attempt", table_name="planner_decision_log"
|
||||
)
|
||||
op.drop_table("planner_decision_log")
|
||||
Reference in New Issue
Block a user