fix(FN-4217): export stall signal types and align helper contract

Fusion-Task-Id: FN-4217
Fusion-Task-Lineage: f5434e90-ad0c-41c5-bee9-1244cb69622b
This commit is contained in:
Fusion
2026-05-13 01:59:36 -07:00
committed by gsxdsm
parent e45223d920
commit 152def32b6
4 changed files with 17 additions and 2 deletions

View File

@@ -59,6 +59,10 @@ describe("getInReviewStallReason", () => {
expect(getInReviewStallReason({ ...baseTask, status: "awaiting-user-review" }, { now: NOW })).toBeUndefined();
});
it("returns undefined for awaiting-approval", () => {
expect(getInReviewStallReason({ ...baseTask, status: "awaiting-approval" }, { now: NOW })).toBeUndefined();
});
it("returns undefined for paused tasks", () => {
expect(getInReviewStallReason({ ...baseTask, paused: true }, { now: NOW })).toBeUndefined();
});

View File

@@ -36,7 +36,7 @@ export const DEFAULT_MAX_AUTO_MERGE_RETRIES = 3;
const TRANSIENT_MERGE_STATUSES = new Set(["merging", "merging-pr", "merging-fix"]);
export function getInReviewStallReason(
task: Pick<Task, "id" | "column" | "paused" | "status" | "error" | "steps" | "workflowStepResults" | "worktree" | "mergeDetails" | "mergeRetries" | "updatedAt">,
task: Pick<Task, "column" | "paused" | "status" | "error" | "steps" | "workflowStepResults" | "worktree" | "mergeDetails" | "mergeRetries" | "updatedAt"> & { id?: string },
context: InReviewStallContext = {},
): InReviewStallSignal | undefined {
if (task.column !== "in-review" || task.paused === true) {
@@ -52,7 +52,7 @@ export function getInReviewStallReason(
return undefined;
}
if (context.activeMergeTaskId === task.id || context.executingTaskIds?.has(task.id)) {
if (task.id && (context.activeMergeTaskId === task.id || context.executingTaskIds?.has(task.id))) {
return undefined;
}

View File

@@ -131,6 +131,12 @@ export {
type MergeTargetResolution,
type MergeTargetResolverOptions,
} from "./task-merge.js";
export {
getInReviewStallReason,
DEFAULT_STALE_MERGING_MIN_AGE_MS,
DEFAULT_MAX_AUTO_MERGE_RETRIES,
} from "./in-review-stall.js";
export type { InReviewStallSignal, InReviewStallCode } from "./in-review-stall.js";
export {
isGhAvailable,
isGhAuthenticated,

View File

@@ -1,4 +1,6 @@
import type { InReviewStallSignal } from "./in-review-stall.js";
/** Valid thinking effort levels for AI agent sessions, controlling the cost/quality tradeoff of reasoning. */
export const THINKING_LEVELS = ["off", "minimal", "low", "medium", "high"] as const;
export type ThinkingLevel = (typeof THINKING_LEVELS)[number];
@@ -1196,6 +1198,9 @@ export interface Task {
* this on the fly from `log`, so this field is only populated by the slim
* list path and may be omitted on the full-detail object. */
timedExecutionMs?: number;
/** Server-computed in-review stall signal. Undefined when no stall rule matches.
* Diagnostic-only: must not be used as an auto-completion signal. */
inReviewStall?: InReviewStallSignal;
/** Durable aggregate token usage totals for the task. Undefined when no usage has been recorded yet. */
tokenUsage?: TaskTokenUsage;
size?: "S" | "M" | "L";