Skip to content

feat(api,ui): showcase pipeline agent ops final polish (PRP-41) #321

@w7-mgfcode

Description

@w7-mgfcode

Execute PRP-41 — the fourth and FINAL slice of the /showcase upgrade epic (PRP-38..41).

What ships

Two new pipeline phases on scenario="showcase_rich":

  • agents phaseagent_hitl_flow step: drives the experiment agent through save_scenario (already in agent_require_approval), exercising the HITL approval round-trip end-to-end via the existing POST /agents/sessions, /chat, /approve, DELETE /agents/sessions/{id} endpoints.
  • ops phaseops_snapshot step: snapshots /ops/summary + /ops/retraining-candidates + /ops/model-health into a small KPI grid in its step card.

Plus cross-cutting /showcase UI polish:

  • Top KPI strip + Inspect-Artifacts post-run panel + localStorage-backed run history strip (capped at 5, keyed forecastlab.showcase.runs.v1).
  • Stop button that releases the pipeline lock.
  • One-click Approve button on the HITL step card.
  • DemoPhasePanel onValueChange fix → closes issue fix(ui): unlock showcase phase accordion after completion #311.

Hard invariants (load-bearing)

  • Backend contracts are read-only. Zero new endpoints, zero new schemas. Every new payload key rides inside StepEvent.data: dict[str, Any].
  • Vertical-slice rule. app/features/demo/ MUST NOT import from app/features/{agents,ops,registry,scenarios,rag}/. Both new steps drive their slices over httpx.ASGITransport.
  • Phase table uses RELATIVE ANCHORS — swap agent → agent_hitl_flow at the same position (after verify, before cleanup); insert ops_snapshot immediately after agents, before cleanup. Never "at row index N".
  • No new tables, no Alembic migrations.
  • Skip gracefully on missing LLM keystep_agent_hitl_flow calls _llm_key_present() first and emits skip when False.

Prerequisites (ALL on dev)

Task 1 is the gate

Contract probe (PRPs/ai_docs/prp-41-contract-probe-report.md) MUST verify every cited backend field-for-field. Several keys in INITIAL-41 drifted on dev:

  • ModelHealthEntry.drift_direction (NOT drift_verdict)
  • Approval body field is action_id (NOT tool_call_id)
  • Chat response surfaces approval via pending_approval: bool + pending_action: PendingAction (NOT an approval_required event — that event fires only on the WS streaming /agents/stream path)

STOP and patch the PRP if any cite drifts.

Out of scope

Listed explicitly in PRP-41 § "Out of Scope" (lines 273-299). No new backend endpoints, no new tables, no migrations, no scope creep into PRP-42.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions