feat(FN-3056): merge fusion/fn-3056

This merge ships several feature and infrastructure improvements across the codebase. Task title validation is strengthened in triage with stricter rejection of malformed titles and preference for prompt-declared titles (FN-3056), while task creation now preserves priority settings (FN-3210). The Mi

Fusion-Task-Id: FN-3056
This commit is contained in:
Fusion
2026-05-02 11:37:15 -07:00
committed by gsxdsm
parent 9c45d2410b
commit 6b4f28a1fb
11 changed files with 205 additions and 11 deletions

View File

@@ -1967,6 +1967,11 @@ export class TriageProcessor {
taskUpdates.reviewLevel = parseInt(reviewMatch[1], 10);
}
const promptDeclaredTitle = extractPromptDeclaredTitle(written, task.id);
if (promptDeclaredTitle) {
taskUpdates.title = promptDeclaredTitle;
}
await this.store.updateTask(task.id, taskUpdates);
if (settings.requirePlanApproval) {
@@ -1996,6 +2001,23 @@ export class TriageProcessor {
}
}
function extractPromptDeclaredTitle(prompt: string, taskId: string): string | null {
const headingMatch = prompt.match(/^#\s+Task:\s+([A-Z]+-\d+)\s+-\s+(.+)$/m);
if (!headingMatch) return null;
const [, headingTaskId, rawTitle] = headingMatch;
if (headingTaskId !== taskId) return null;
const title = rawTitle.trim().replace(/[\s.!?,;:]+$/g, "");
if (!title) return null;
// Conservative guard: do not overwrite metadata with confirmation prose.
if (/^created\s+(?:task\s+)?(?:fn-\d+\b|\*\*\s*fn-\d+\s*\*\*)/i.test(title)) {
return null;
}
return title;
}
function hasLatestSpecReviewApproval(task: Task): boolean {
for (let i = task.log.length - 1; i >= 0; i--) {
const action = task.log[i]?.action ?? "";