mirror of
https://github.com/stablyai/orca.git
synced 2026-10-13 00:02:54 +00:00
Reduce PR refresh queued indicator noise
Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
@@ -78,7 +78,7 @@ describe('pr-refresh-coordinator', () => {
|
||||
vi.useRealTimers()
|
||||
})
|
||||
|
||||
it('does not show a delayed visible follow-up as queued after a successful refresh', async () => {
|
||||
it('does not show visible background refreshes as queued', async () => {
|
||||
const { reportVisiblePRRefreshCandidates } = await import('./pr-refresh-coordinator')
|
||||
getPRForBranchOutcomeMock.mockResolvedValueOnce({
|
||||
kind: 'found',
|
||||
@@ -93,8 +93,7 @@ describe('pr-refresh-coordinator', () => {
|
||||
.map(([, event]) => event)
|
||||
.filter((event) => event.status === 'queued')
|
||||
|
||||
expect(queuedEvents).toHaveLength(1)
|
||||
expect(queuedEvents[0].reason).toBe('visible')
|
||||
expect(queuedEvents).toHaveLength(0)
|
||||
expect(getPRForBranchOutcomeMock).toHaveBeenCalledTimes(1)
|
||||
})
|
||||
|
||||
|
||||
@@ -127,7 +127,10 @@ function shouldSkipFresh(
|
||||
return Date.now() - candidate.cachedFetchedAt < refreshIntervalForCandidate(candidate)
|
||||
}
|
||||
|
||||
function shouldBroadcastQueued(dueAt: number): boolean {
|
||||
function shouldBroadcastQueued(reason: GitHubPRRefreshReason, dueAt: number): boolean {
|
||||
if (isBudgetedBackground(reason)) {
|
||||
return false
|
||||
}
|
||||
return dueAt - Date.now() <= 5_000
|
||||
}
|
||||
|
||||
@@ -399,9 +402,9 @@ export function enqueuePRRefresh(
|
||||
windowId
|
||||
})
|
||||
}
|
||||
// Why: freshness follow-ups can be scheduled minutes out. Only immediate
|
||||
// queueing should surface in the card UI as pending work.
|
||||
if (shouldBroadcastQueued(dueAt)) {
|
||||
// Why: visible/SWR refreshes are background maintenance and may sit behind
|
||||
// the budget queue. Only user/action-driven queueing should surface in UI.
|
||||
if (shouldBroadcastQueued(reason, dueAt)) {
|
||||
broadcast({ aliases: [alias], reason, status: 'queued' })
|
||||
}
|
||||
scheduleDrain()
|
||||
|
||||
Reference in New Issue
Block a user