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): a write no longer advances the incremental scan's since cursor

reviewd8306120b198
diff --git a/src/core/github/service.test.ts b/src/core/github/service.test.ts
index 96f9e956e..a69681354 100644
--- a/src/core/github/service.test.ts
+++ b/src/core/github/service.test.ts
@@ -401,6 +401,44 @@ describe('GitHubIssueService', () => {
expect(saved.lastComplete?.lastSuccessfulRefreshAt).toBe(1_000)
})
+ it('does not let one of our own writes advance the incremental watermark', async () => {
+ // Only a completed scan has looked at everything up to its start. Our write looked at ONE
+ // issue, so a third party's change landing between the last scan and our write must still be
+ // inside the next incremental `since` window, not deferred to the daily full pass.
+ const client = new FixtureClient([issue(1), issue(2)])
+ const sinces: Array<string | undefined> = []
+ client.listIssues = async (_repository, options: ListIssueOptions) => {
+ sinces.push(options.since)
+ return { items: [...client.issues.values()]
+ .filter((item) => !options.since || item.updatedAt >= options.since) }
+ }
+ let clock = Date.parse('2026-08-09T10:05:00Z')
+ const service = new GitHubIssueService({
+ cache: new GitHubIssueCache(userDataDir),
+ coordinator: new GitHubRequestCoordinator(),
+ contextForProject: async () => context(client),
+ now: () => clock
+ })
+ await service.refresh({ projectId: 'project-1', full: true })
+
+ // Someone else edits issue 2 after our scan...
+ client.issues.set(2, issue(2, { title: 'Renamed elsewhere', updatedAt: '2026-08-09T10:06:00Z' }))
+ // ...and only then do we move issue 1.
+ clock = Date.parse('2026-08-09T10:10:00Z')
+ expect((await service.moveIssue({
+ projectId: 'project-1', issueNumber: 1, toColumnId: 'doing',
+ expectedUpdatedAt: issue(1).updatedAt
+ })).status).toBe('confirmed')
+
+ clock = Date.parse('2026-08-09T12:00:00Z')
+ await service.refresh({ projectId: 'project-1' })
+ expect(sinces.at(-1)).toBe(new Date(Date.parse('2026-08-09T10:05:00Z') - 2_000).toISOString())
+ const shown = await service.query({ projectId: 'project-1', columnId: null, pageSize: 50 })
+ expect(shown.items.find((item) => item.number === 2)?.title).toBe('Renamed elsewhere')
+ // The page's "last refreshed" is the scan's, not the write's: nothing was re-read then.
+ expect(shown.lastSuccessfulRefreshAt).toBe(Date.parse('2026-08-09T12:00:00Z'))
+ })
+
it('refreshes and maps open, closed, unmatched, and conflicting issues', async () => {
const client = new FixtureClient([
issue(1, { labels: [{ id: 1, name: 'status:todo', color: '0a84ff' }] }),
diff --git a/src/core/github/service.ts b/src/core/github/service.ts
index 50598727e..051b181e0 100644
--- a/src/core/github/service.ts
+++ b/src/core/github/service.ts
@@ -541,13 +541,17 @@ export class GitHubIssueService {
if (!this.repositoryWriteAllowed(captured.repository, operationId, repositoryGeneration)) {
return { status: 'refresh-pending', issue: updated }
}
+ // The write folds ONE issue into the snapshot and leaves `lastSuccessfulRefreshAt` alone: that
+ // is the incremental scan's `since` cursor, and only a completed scan has looked at everything
+ // up to it. Advancing it here skipped any third party's change that landed between the last
+ // scan and this write until the next daily full reconciliation.
const snapshot = state.snapshot ?? {
- issues: [], etags: {}, lastSuccessfulRefreshAt: this.now(), lastFullReconciliationAt: 0
+ issues: [], etags: {}, lastSuccessfulRefreshAt: 0, lastFullReconciliationAt: 0
}
const issues = snapshot.issues.some((item) => item.number === updated.number)
? snapshot.issues.map((item) => item.number === updated.number ? updated : item)
: [...snapshot.issues, updated]
- state.snapshot = { ...snapshot, issues, lastSuccessfulRefreshAt: this.now() }
+ state.snapshot = { ...snapshot, issues }
state.partialIssues = undefined
try {
await this.options.cache.saveComplete(captured.userId, captured.repository, state.snapshot)
@@ -734,8 +738,8 @@ export class GitHubIssueService {
/**
* The one-time permission for the board to move `cardId` because every PR in `pulls` merged. The
* first ask wins across every window (two Server Edition tabs cannot both move it), and it is
- * remembered, so a card the user dragged back is not moved again for the same merges. It sends no
- * request and resolves no credential.
+ * remembered per PR, so a card the user dragged back is not moved again for the same merges — even
+ * after one of them ages off the pull board. It sends no request and resolves no credential.
*/
async claimPullAutoMove(request: { projectId: string; cardId: string; pulls: number[] }): Promise<boolean> {
const key = this.validPullCardRequest(request)