Review saved execution traces in Release reviews

SI
5d ago
+793-0

Summary

Makes saved execution traces reviewable from the shipped /releases reviewer UI using only the already-deployed, read-only list_executions and read_execution operations (no api or database change). A new "Execution traces" panel under the current case lists the request's saved executions (policy version, created time, recorded/planned node counts) and opens one as a node table that joins the immutable plan with recorded outcomes and claims. Review state is the outcome status (saved/reused/failed/blocked), else unknown (claimed, needs reconciliation) for a claim without an outcome, else not_started, so uncertainty is never rendered as success or failure. Plan states are separated into template (not_implemented), implemented (ready_for_dispatch / reuse_candidate) and blocked by policy; dependencies, block reasons, failure stage, reasons, evidence result IDs and claim/outcome timestamps are shown; cost is always unknown (never zero) and each row names what was not recorded (prompts, cost, outcome). The hook mirrors useCompanyAssessment (generation counter, shared useReleaseCaseRequest with workspace organization_id on every call, 401 → sign-in message) and never retries or dispatches.

Refs recoupable/app#2146 (child of epic recoupable/app#2116).

Merge sequencing

docs → database → api → app:

  • docs: recoupable/docs#367 (documents list_executions / read_execution in context.json) — merge first.
  • database: none; read_context_execution and list_context_request_executions shipped in database PR77 and are deployed.
  • api: none; both actions are already on api main (lib/context/processContextOperation.ts). No dependency on open api#981/#983/#985 (this PR does not touch api).
  • app: this PR. The only edits to existing files are a 1-line import and a 6-line mount after <CompanyAssessment …/> in ReleaseCasesPage.tsx plus two typed actions in lib/releases/responseTypes.ts; everything else is new files, to stay conflict-light with sibling tickets mounting panels on the same page.

Verification

  • Ran: pnpm exec vitest run lib/releases/__tests__/buildExecutionNodeRows.test.ts components/Releases/__tests__/ReleaseExecutionTrace.test.tsx → 2 files, 7 tests passed, 0 failed, 0 skipped.
  • Ran: pnpm exec vitest run components/Releases hooks lib/releases → 59 files, 187 tests passed, 0 failed (baseline on origin/main before this change: 57 files, 180 passed).
  • Ran: pnpm exec tsc --noEmit → no errors in changed files. The only reported error is pre-existing and unrelated: components/VercelChat/tools/SpotifyDeepResearchResult.tsx(5,25) imports a .png and needs the gitignored, generated next-env.d.ts (absent in a fresh worktree); with that file generated, tsc reports zero errors.
  • Ran: pnpm exec eslint <9 changed files> → clean; pnpm exec prettier --check <9 changed files> → all files use Prettier code style.
  • Ran: grep -c 'read_execution' components/Releases/ReleaseExecutionTrace.tsx hooks/useExecutionTrace.ts → 1 and 1.
  • Red → green: both new test files failed before implementation (Cannot find module '../buildExecutionNodeRows' and '../ReleaseExecutionTrace'); after the first implementation 6/7 passed and ReleaseExecutionTrace.test.tsx failed on findByText("unknown (claimed, needs reconciliation)") matching both the table cell and the legend; the test was scoped to the node table via within(table) and all 7 pass.
  • Not verified: hosted deployment, live providers, production database, hosted UI display of a real trace (no real execution was read through the deployed /api/context proxy), MCP transport. State reached: implemented + fixture-tested.

Out of scope / known gaps

  • Per-node cost, duration and prompts are not recorded by the execution schema; the UI states this explicitly instead of inferring values.
  • Connected, fixture-tested and live-verified status per node is not derivable from a trace; the panel says it lives in implementation tickets. No links to schema/implementation tickets yet.
  • No retry, reconciliation or human-review-checkpoint actions; reads only. Evidence permissions rely on the server's workspace authorization and owner-scoped RPCs.
  • The private React Flow inspector and Business reference docs are out of scope per the ticket's ownership statement.
  • Added components/Releases/ReleaseExecutionNodes.tsx (table + legend + footer) beyond the plan's file list to keep one component per file.

🤖 Generated with Claude Code


Summary by cubic

Makes saved execution runs reviewable in Release reviews for the first time. A new "Execution traces" panel under the current case lists the request's saved executions and opens one as a node table joining the immutable plan with recorded outcomes and claims, using only the already-deployed read-only list_executions and read_execution operations. Opening a trace never retries work, dispatches a provider, or spends credits.

  • Review state is the recorded outcome status (saved/reused/failed/blocked), else unknown (claimed, needs reconciliation) for a claim with no outcome, else not_started, so uncertainty is never rendered as success or failure.
  • Plan states map to template (not_implemented), implemented (ready_for_dispatch / reuse_candidate), and blocked by policy; dependencies, block reasons, failure stage, reasons, evidence result IDs, and claim/outcome timestamps are shown.
  • Cost is always reported as unknown, never zero, and each row names what was not recorded: prompts, cost, and outcome.
  • The hook follows useCompanyAssessment behavior and shows a sign-in message on 401.
  • No API or database changes are needed; both operations are already merged and deployed, and edits to existing app files are limited to an import, a mount, and two typed actions.

Summary by CodeRabbit

  • New Features
    • Added an execution trace panel to release cases, where reviewers can view saved executions and their status.
    • Execution details show modules, implementation and review states, dependencies, timing, costs, and available evidence or failure information.
    • Added explanatory status guidance and notices when trace information is unavailable.