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

This commit is contained in:
gsxdsm
2026-05-18 16:23:06 -07:00
parent 0bf89e7813
commit 0046fc92e2
11 changed files with 564 additions and 10 deletions

View File

@@ -28,6 +28,18 @@ Dashboard `POST /tasks` now performs a pre-create duplicate gate using token-ove
- Override creates emit activity type `task:duplicate-warning-overridden` with acknowledged IDs and scored candidate metadata.
- Duplicate lineage is persisted on the task row via canonical source fields (`sourceType: "task_duplicate"`, `sourceParentTaskId`) plus `sourceMetadata.duplicateOfTaskIds` when available, so `fn task show <id>` and Task Detail views can render duplicate-of linkage directly from task provenance.
#### Deterministic duplicate guard (FN-4918)
`POST /tasks` also applies a deterministic guard for exact normalized content matches (title + description fingerprint) within a 60s window.
- If an existing same-fingerprint task is found in-window, create returns `409` with `{ error: "duplicate_candidates", details: { matches: [{ ..., score: 1, deterministic: true }] } }`.
- If two creates race across processes and both reach persistence, post-create reconciliation can return `200` with the canonical older task and auto-archive the newer sibling.
- New rows stamp `task.source.sourceMetadata.contentFingerprint` for deterministic matching.
- Reconciled losers stamp `task.source.sourceMetadata.deterministicDuplicateOf = <canonicalTaskId>` and are archived (not deleted).
- Reconciliation archives record activity event `task:auto-archived-deterministic-duplicate`.
This deterministic layer complements (does not replace) the FN-4829 similarity warning gate. `bypassDuplicateCheck: true` on `POST /tasks` disables both gates. FN-4892 remains a separate engine-side same-agent intake heuristic at triage finalize.
### Intake auto-archive (ghost-bug preflight + same-agent duplicate)
Fusion applies two conservative intake heuristics that may auto-archive newly filed tasks before execution starts: