feat(FN-990): add task spec rebuild endpoint and UI
- Add POST /tasks/:id/spec/rebuild API endpoint to regenerate task specifications - Add rebuildTaskSpec client function in dashboard API layer - Add respecify button to task detail modal for triggering spec rebuilds - Add comprehensive tests for the spec/rebuild endpoint covering success, error, and edge cases
This commit is contained in:
@@ -4,7 +4,7 @@ import ReactMarkdown from "react-markdown";
|
||||
import remarkGfm from "remark-gfm";
|
||||
import type { Task, TaskDetail, TaskAttachment, Column, MergeResult, PrInfo, Settings, AgentLogEntry } from "@fusion/core";
|
||||
import { COLUMN_LABELS, VALID_TRANSITIONS } from "@fusion/core";
|
||||
import { uploadAttachment, deleteAttachment, updateTask, pauseTask, unpauseTask, fetchTaskDetail, fetchSettings, requestSpecRevision, approvePlan, rejectPlan, refineTask, fetchWorkflowResults } from "../api";
|
||||
import { uploadAttachment, deleteAttachment, updateTask, pauseTask, unpauseTask, fetchTaskDetail, fetchSettings, requestSpecRevision, rebuildTaskSpec, approvePlan, rejectPlan, refineTask, fetchWorkflowResults } from "../api";
|
||||
import type { WorkflowStepResult } from "@fusion/core";
|
||||
import type { ToastType } from "../hooks/useToast";
|
||||
import { useAgentLogs } from "../hooks/useAgentLogs";
|
||||
@@ -524,6 +524,17 @@ export function TaskDetailModal({
|
||||
}
|
||||
}, [task.id, onClose, addToast]);
|
||||
|
||||
const handleRespecify = useCallback(async () => {
|
||||
if (!confirm("Rebuild the specification for this task? The task will move to triage for re-specification.")) return;
|
||||
try {
|
||||
await rebuildTaskSpec(task.id, projectId);
|
||||
onClose();
|
||||
addToast(`Respecifying ${task.id}...`, "info");
|
||||
} catch (err: any) {
|
||||
addToast(err.message, "error");
|
||||
}
|
||||
}, [task.id, projectId, onClose, addToast]);
|
||||
|
||||
const handleOpenRefineModal = useCallback(() => {
|
||||
setShowRefineModal(true);
|
||||
setRefineFeedback("");
|
||||
@@ -1245,6 +1256,11 @@ export function TaskDetailModal({
|
||||
Refine
|
||||
</button>
|
||||
)}
|
||||
{task.column !== "triage" && (
|
||||
<button className="btn btn-sm" onClick={handleRespecify}>
|
||||
Respecify
|
||||
</button>
|
||||
)}
|
||||
{(task.status === "failed" || task.status === "stuck-killed") && onRetryTask && (
|
||||
<button className="btn btn-warning btn-sm" onClick={handleRetry}>
|
||||
Retry
|
||||
|
||||
Reference in New Issue
Block a user