Fix stale issue live-run state

This commit is contained in:
Dotta 2026-04-12 20:41:31 -05:00
parent 2172476e84
commit ab5eeca94e
3 changed files with 65 additions and 2 deletions

View file

@ -0,0 +1,15 @@
import type { Issue } from "@paperclipai/shared";
import type { ActiveRunForIssue } from "../api/heartbeats";
export function shouldTrackIssueActiveRun(
issue: Pick<Issue, "status" | "executionRunId"> | null | undefined,
): boolean {
return Boolean(issue && (issue.status === "in_progress" || issue.executionRunId));
}
export function resolveIssueActiveRun(
issue: Pick<Issue, "status" | "executionRunId"> | null | undefined,
activeRun: ActiveRunForIssue | null | undefined,
): ActiveRunForIssue | null {
return shouldTrackIssueActiveRun(issue) ? (activeRun ?? null) : null;
}