From 6498d028f2d7909296f34840a4ecc877f71c9386 Mon Sep 17 00:00:00 2001 From: gsxdsm Date: Sat, 4 Jul 2026 16:48:34 -0700 Subject: [PATCH] FN-7517: add task detail oversight quick-controls (level change, manual nudge, stop, explain-current-action) Adds task detail modal controls that let an operator quickly change a task's oversight level, nudge the planner with a manual instruction, stop oversight entirely, and request an explanation of the overseer's current action, backed by new dashboard API routes and engine/core plumbing. - Add oversight quick-controls UI (level change, manual nudge, stop oversight, explain-current-action) to TaskDetailModal with supporting styles in TaskDetailModal.css and TaskCard.css - Add dashboard legacy API + task-workflow routes to handle the new oversight actions (register-task-workflow-routes.ts, api/legacy.ts) - Extend planner-overseer-state and planner-overseer-runtime-snapshot to track/report manual nudge and stop-oversight state - Extend PlannerRecoveryController and project-engine to apply manual oversight actions (level change, nudge, stop, explain) end-to-end - Add tests: TaskDetailModal.oversight-controls.test.tsx, tasks-overseer-controls.test.ts, planner-recovery-controller-manual-action.test.ts, plus updates to planner-overseer-runtime-snapshot.test.ts and test-helpers - Update docs/dashboard-guide.md and docs/settings-reference.md Files changed: docs/dashboard-guide.md | 2 + docs/settings-reference.md | 2 +- packages/core/src/planner-overseer-state.ts | 18 + packages/dashboard/app/api/legacy.ts | 33 ++ packages/dashboard/app/components/TaskCard.css | 13 + packages/dashboard/app/components/TaskDetailModal.css | 122 +++++++ packages/dashboard/app/components/TaskDetailModal.tsx | 374 ++++++++++++++++++++- packages/dashboard/app/components/__tests__/TaskDetailModal.oversight-controls.test.tsx | 290 ++++++++++++++++ packages/dashboard/app/components/__tests__/TaskDetailModal.test-helpers.ts | 11 + packages/dashboard/src/routes/__tests__/tasks-overseer-controls.test.ts | 191 +++++++++++ packages/dashboard/src/routes/register-task-workflow-routes.ts | 68 ++++ packages/engine/src/__tests__/planner-overseer-runtime-snapshot.test.ts | 24 +- packages/engine/src/__tests__/planner-recovery-controller-manual-action.test.ts | 84 +++++ packages/engine/src/planner-overseer-runtime-snapshot.ts | 11 + packages/engine/src/planner-recovery-controller.ts | 40 +++ packages/engine/src/project-engine.ts | 102 ++++++ 16 files changed, 1380 insertions(+), 5 deletions(-) Fusion-Task-Id: FN-7517 Fusion-Task-Lineage: eded7ff5-d126-429d-acbb-9f4bfff5ae2a Co-authored-by: Fusion (runfusion.ai) --- docs/dashboard-guide.md | 2 + docs/settings-reference.md | 2 +- packages/core/src/planner-overseer-state.ts | 18 + packages/dashboard/app/api/legacy.ts | 33 ++ .../dashboard/app/components/TaskCard.css | 13 + .../app/components/TaskDetailModal.css | 122 ++++++ .../app/components/TaskDetailModal.tsx | 374 +++++++++++++++++- ...askDetailModal.oversight-controls.test.tsx | 290 ++++++++++++++ .../__tests__/TaskDetailModal.test-helpers.ts | 11 + .../__tests__/tasks-overseer-controls.test.ts | 191 +++++++++ .../routes/register-task-workflow-routes.ts | 68 ++++ .../planner-overseer-runtime-snapshot.test.ts | 24 +- ...-recovery-controller-manual-action.test.ts | 84 ++++ .../src/planner-overseer-runtime-snapshot.ts | 11 + .../engine/src/planner-recovery-controller.ts | 40 ++ packages/engine/src/project-engine.ts | 102 +++++ 16 files changed, 1380 insertions(+), 5 deletions(-) create mode 100644 packages/dashboard/app/components/__tests__/TaskDetailModal.oversight-controls.test.tsx create mode 100644 packages/dashboard/src/routes/__tests__/tasks-overseer-controls.test.ts create mode 100644 packages/engine/src/__tests__/planner-recovery-controller-manual-action.test.ts diff --git a/docs/dashboard-guide.md b/docs/dashboard-guide.md index 025a6cfe84..2d04d7d127 100644 --- a/docs/dashboard-guide.md +++ b/docs/dashboard-guide.md @@ -185,6 +185,8 @@ Features: - Task cards show a read-only **oversight-level badge** (`Observe`, `Steer`, or `Auto-recovery`) in the meta-badges cluster reflecting the effective planner-oversight level (a task's explicit override wins and renders immediately; otherwise the card resolves the task's workflow-configured effective `plannerOversightLevel` when the board supplies a `workflowBadge`, falling back to the schema default `Auto-recovery` only when neither tier resolves) (`data-testid="card-oversight-badge"`); the badge is absent (no empty shell) when the effective level is explicitly "off", **and** while an inherited (no per-task-override) workflow tier is still being resolved (in flight or not yet fetched) — it never shows a guessed default during that window. - Task cards also show a read-only **active-overseer-state indicator** (`.card-overseer-state-badge`, `data-testid="card-overseer-state-badge"`) — "Executor", "Reviewer", "Merger", "Pull request", or "Workflow gate" — while the task is in a monitorable stage (in-progress/in-review, or paused on a workflow input/approval gate) and the effective oversight level is not "off" (and is known, per the same resolution gate as the oversight badge above). The indicator is suppressed (no empty shell) when the task is user-paused, agent-paused off a workflow gate, `done`, or `archived`. + +- The task detail modal's inline meta-controls cluster (next to Priority/Execution mode) adds four planner-overseer controls: a **quick oversight-level select** (`data-testid="detail-oversight-level-select"`) that writes the per-task `plannerOversightLevel` override (Off/Observe/Steer/Autonomous recovery) or clears it back to the inherited workflow/project default via an "Inherit" option; a **manual nudge** button (`data-testid="detail-overseer-nudge"`) that asks the overseer to inject one guidance-only steering comment into the currently watched stage right now (never a merge/PR/destructive action), disabled when the overseer is off/inactive or the task is user-paused/done/archived/`autoMerge:false` in-review; a **stop oversight** button (`data-testid="detail-overseer-stop"`) that disables active oversight for the task (confirmation-gated), hidden once oversight is already off; and an **explain current action** button (`data-testid="detail-overseer-explain"`) that toggles a small read-only panel (`data-testid="detail-overseer-explain-panel"`) showing the overseer's watched stage, reason, last action, and attempt count/limit, with a non-empty-shell inactive state when the overseer is not currently watching. All three action controls call the `POST /tasks/:id/overseer/nudge`, `POST /tasks/:id/overseer/stop`, and `GET /tasks/:id/overseer/explain` routes. - Task detail surfaces show the selected/effective workflow identity near the task's workflow controls so individual cards remain understandable when Board is in **All workflows** or another aggregate/mixed context. - Board task cards support a context menu from right-click, keyboard context menu / Shift+F10, or touch long-press for detail-aligned lifecycle actions without changing normal card clicks. The menu opens as an independent overlay so it stays visible beyond the card or column edge while remaining clamped to the viewport. On mobile, long-press opens that menu without selecting card text or showing native copy/paste callouts. Selecting an action applies that exact action once and dismisses the menu. Completed card context menus include **Refine**, which opens the existing task-detail refinement feedback modal for the same task.