fix(FN-2384): schedule triage and todo tasks by priority-aware FIFO

- Sort eligible todo tasks in Scheduler by priority first, then createdAt/id for stable FIFO ordering within each tier
- Sort eligible triage tasks using the same priority-aware ordering while preserving existing pause/status/recovery gating
- Add regression tests for scheduler and triage ordering, including blocked/paused/recovery-gated edge cases
- Update architecture docs to describe priority-first task dispatch behavior
This commit is contained in:
Fusion
2026-04-24 04:08:17 -07:00
committed by gsxdsm
parent 86b427c126
commit 9d77185079
5 changed files with 219 additions and 6 deletions

View File

@@ -1,4 +1,13 @@
import { getCurrentRepo, resolveDependencyOrder, type TaskStore, type Task, type MissionStore, type MissionFeature, type PrInfo } from "@fusion/core";
import {
getCurrentRepo,
resolveDependencyOrder,
sortTasksByPriorityThenAgeAndId,
type TaskStore,
type Task,
type MissionStore,
type MissionFeature,
type PrInfo,
} from "@fusion/core";
import { existsSync } from "node:fs";
import { readFile } from "node:fs/promises";
import { join } from "node:path";
@@ -563,6 +572,8 @@ export class Scheduler {
if (todo.length === 0) return;
todo = sortTasksByPriorityThenAgeAndId(todo);
/**
* Pre-compute file scopes for all currently active tasks (in-progress
* AND in-review with unmerged worktrees) so that todo tasks are never