Skip to content
← Public packages

@kentcdodds/sentry-triage

Sentry triage wakes Cole (Grok Bot) per issue: one active wake per repo (lease + queue), loop-safe Discord. Cole may spawn Cursor for isolated repo work.

src/reconcile.d.ts

37 lines · 1.2 KB · TypeScript
export type ReconcileInput = {
	/** How far back to look for missed issues (hours, 1–72; default 30). */
	lookbackHours?: number
}

export type ReconcileAction = {
	project: string
	issueId?: string
	shortId?: string | null
	/** Why this issue was re-delivered. */
	reason?: 'missing-record' | 'awaiting-seer-stale' | 'spawn-failed-stale'
	/** Result of the re-delivered webhook handler call. */
	delivery?: unknown
	error?: string
}

export type ReconcileResult = {
	ok: true
	lookbackHours: number
	reconciled: number
	actions: ReconcileAction[]
}

/**
 * Webhook-loss backstop: re-deliver recently-first-seen unresolved Sentry
 * issues that triage never recorded (or that are stuck awaiting a Seer RCA
 * past the grace window) through the normal webhook handler. Runs daily
 * from a scheduled job; quiet-period Seer waits are also swept every 15
 * minutes by `./sweep-stale-awaiting`. Safe to invoke manually for an
 * immediate backfill.
 *
 * @example
 * import reconcile from 'kody:@kentcdodds/sentry-triage/reconcile'
 * const result = await reconcile({ lookbackHours: 24 })
 * // => { ok: true, reconciled: 2, actions: [{ issueId: '...', reason: 'missing-record' }] }
 */
export default function reconcile(input?: ReconcileInput): Promise<ReconcileResult>