Skip to content

trustsTerminal

trustsTerminal(prev, raw, marked, markedNumber): boolean

Defined in: src/pr-poller.ts:60

Whether a terminal (merged/closed) raw is this session’s genuine PR transition and should bypass guardStaleTerminal (which would mis-downgrade it to “none” when the merge train rebased/force-pushed the head out of the session’s worktree, so the ownership check can’t see it). Returns false immediately for any non-terminal rawguardStaleTerminal is a no-op off-terminal anyway, and this prevents a malformed {state:"none"} from ever being trusted. True (for a terminal raw) when either:

  • marked && markedNumber === raw.number — the session is merge-train-flagged AND its recorded observed PR number matches the terminal result: server-side reconcile only sets mergingSince when it observed the PR as state:"open" with that number, so this still holds for the cold-cache rebase/force-push case (same PR number, head moved). A different-number terminal (reused branch name) falls through to the prev-cache check rather than being blanket-trusted; or
  • prev already cached THIS PR (same number, non-”none” state) — a PR we already owned. When this returns false, raw may be a reused-branch-name collision and must run through guardStaleTerminal.

GitState | undefined

GitState

boolean

number | null

boolean