Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

fix(github): tell the board when a sync hold lifts

review8e0439a8c8d4
diff --git a/src/core/github/service.test.ts b/src/core/github/service.test.ts
index b2570ebdf..2cf5125cb 100644
--- a/src/core/github/service.test.ts
+++ b/src/core/github/service.test.ts
@@ -1318,3 +1318,35 @@ describe('GitHubIssueService mapping approval', () => {
expect(client.updates).toHaveLength(1)
})
})
+
+describe('GitHubIssueService throttle lift', () => {
+ it('prompts subscribers again when the hold lifts, so the board stops saying it is paused', async () => {
+ let clock = 1_000_000
+ const client = new FixtureClient([issue(1)])
+ const coordinator = new GitHubRequestCoordinator({ now: () => clock })
+ const timers: Array<() => Promise<void>> = []
+ const deltas: number[][] = []
+ const service = new GitHubIssueService({
+ cache: new GitHubIssueCache(userDataDir), coordinator,
+ contextForProject: async () => context(client), now: () => clock,
+ setInterval: (fn) => { timers.push(fn as () => Promise<void>); return timers.length },
+ onDelta: (_uiId, _projectId, numbers) => deltas.push(numbers)
+ })
+ await service.subscribe(1, { projectId: 'project-1' })
+ coordinator.noteRateSample('user-1', { resource: 'core', limit: 5_000, remaining: 12, resetAt: 2_000_000 })
+ await timers[0]()
+ const held = deltas.length
+
+ // The window resets. Nothing changed upstream, so the heartbeat answers 304 and the scan is
+ // skipped — the only thing that changed is that sync is no longer held.
+ clock = 2_000_000
+ await timers[0]()
+
+ expect(deltas.slice(held)).toEqual([[]])
+ expect((await service.query({ projectId: 'project-1', columnId: null, pageSize: 50 })).throttle)
+ .toBeUndefined()
+ // Said once, not on every later minute.
+ await timers[0]()
+ expect(deltas.slice(held)).toEqual([[]])
+ })
+})
diff --git a/src/core/github/service.ts b/src/core/github/service.ts
index 4f0729c1d..fba8ace88 100644
--- a/src/core/github/service.ts
+++ b/src/core/github/service.ts
@@ -915,6 +915,7 @@ export class GitHubIssueService {
// It IS a background refresh, though, so the rate budget may hold it.
const throttle = await this.refreshWithinFloor({ projectId }, undefined, true)
if (throttle) this.announceThrottle(state, throttle.until)
+ else this.announceThrottleLifted(state)
return
} catch (error) {
const failure = classifyGitHubFailure(error)
@@ -934,6 +935,14 @@ export class GitHubIssueService {
this.emitDelta(state, [], true)
}
+ /** The poll ran again. A 304 heartbeat emits nothing, so without this the board would keep
+ * saying "paused until HH:MM" long after that time — prompt a re-read once when the hold ends. */
+ private announceThrottleLifted(state: RepositoryState): void {
+ if (state.announcedThrottleUntil === undefined) return
+ delete state.announcedThrottleUntil
+ this.emitDelta(state, [], true)
+ }
+
private migrateProjectState(projectId: string, key: string, target: RepositoryState): void {
const previousKey = this.projectKeys.get(projectId)
if (!previousKey || previousKey === key) return