ubiquitous-invention/plans/Plan-agent-coordination/Epic-task-as-runnable-unit/Task-workflow-prompt-task-detail-ui.md
Randall Stillwell 6581f6a482 wip: agent-coordination iteration (runs+backlog+plans UI + 2 task plans + db-drift SQL)
In-flight work from 2026-06-05 that was sitting uncommitted on
feat/agent-pipeline-bridge for 10 days. Moved here to a clean branch
off main so the bridge branch can stay at its committed state (the
DEFERRED Phase 2a snapshot, see stwl-labs/ubiquitous-invention#3).

Touched areas:

- apps/web/app/(app)/[workspaceSlug]/settings/runs/page.tsx — runs page UI iteration
- apps/web/server/routers/{backlog,runs}.ts — router updates
- apps/web/app/(app)/[workspaceSlug]/plans/[planSlug]/[epicSlug]/[taskSlug]/page.tsx — new deep-link route
- apps/web/components/backlog/workflow-prompt-section.tsx — new component
- config/CursorSync.md — coordination doc tweak
- docs/operations/README.md + 2026-06-05-db-drift-reconcile-oauth-tables.sql — operations ops note + reconcile script
- plans/Plan-agent-coordination/Epic-task-as-runnable-unit/Task-{workflow-prompt-task-detail-ui,deep-link-runs-to-task-detail}.md — 2 task specs

This is a working-tree snapshot, not a finished PR. Rebase, split, or
amend as needed when picking it back up.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-15 15:35:39 -05:00

3.7 KiB

kind slug title plan_slug epic_slug status priority tenant_id owner cursor_todo_id updated_at
task workflow-prompt-task-detail-ui Backlog-item detail panel — render and edit workflow_prompt agent-coordination task-as-runnable-unit done P2 global unassigned null 2026-06-03

Task summary

The data layer for per-item workflow prompts shipped in Task-add-workflow-prompt-to-backlog-items. This task adds the UI surface that uses it.

Deferred from the parent task because apps/web does not yet have a backlog-item detail panel — apps/web/components/panels/object-detail.tsx is for the objects table, not markdown_backlog_items. Adding a new panel surface (state, edit affordance, draft handling) is a substantive UI task on its own.

Description

Add a "Workflow prompt" section to wherever a single backlog item is rendered for read/edit. Likely surfaces:

  1. A dedicated route like /[workspaceSlug]/plans/[planSlug]/[epicSlug]/[taskSlug] if a Plans browser ever exists.
  2. A drawer or sheet opened from the Plans tree (if/when that ships).
  3. The agent runs view (/settings/runs) — click a run to expand task context including the effective prompt.

For v1 of THIS task, pick the smallest surface that lets an operator actually use the data:

  • Effective prompt — read-only display from api.backlog.getWorkflowPrompt({ backlogItemId }). Show the source level as a small badge ("From this task" / "Inherited from epic: X" / "Inherited from plan: Y" / "Built-in default").
  • Override — a textarea bound to ownOverride. Empty = inherit. Save calls api.backlog.updateWorkflowPrompt.

Subtasks

  • Decide on the rendering surface (see options above).
  • Build the section component with effective-prompt preview + override textarea.
  • Owner/admin gate matches the procedure (the procedure refuses non-managers, but the UI should hide the save button rather than let the click fail).
  • Show "clear override" affordance when an override is set.

Acceptance criteria

  • Saving an override flips the source badge to "From this task."
  • Clearing an override re-shows the inherited source.
  • Non-managers see the prompt but cannot edit it.

Implementation notes

  • Surface picked: dedicated route at /[workspaceSlug]/plans/[planSlug]/[epicSlug]/[taskSlug]. There's no plans-tree browser yet — this lets an operator land on a task by typing the URL (or future deep-link from /settings/runs) without first shipping a tree view.
  • New tRPC procedure: backlog.getTaskByPath({ planSlug, epicSlug, taskSlug }) — returns task row, parent epic + plan titles (for inheritance badge), and callerRole so the UI can pre-hide edit affordances in a single roundtrip. Slugs are re-validated against the importer's [a-z0-9-] shape at the procedure boundary.
  • New component: components/backlog/workflow-prompt-section.tsx. Source badge derives its label from (source, sourceContext); preview is read-only <pre>; textarea is the editable knob bound to ownOverride. Save calls backlog.updateWorkflowPrompt; Clear sends workflowPrompt: null. Both invalidate getWorkflowPrompt rather than optimistic-mutate, because clearing a task override can re-expose an epic/plan inheritance the client doesn't know about ahead of time.
  • Server still gates writes via ctx.workspace.role; the UI hide is convenience, not security.

Follow-ups

  • Linking from /settings/runs rows to the task detail page (needs planSlug/epicSlug/slug on runs.listRecent).
  • Plans tree browser at /[workspaceSlug]/plans (currently only the leaf route exists).
  • Parent: ./Task-add-workflow-prompt-to-backlog-items.md
  • Epic: ./Epic-task-as-runnable-unit.md