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.
TypeScript adhdagent-orchestrationai-agentscanvasclaude-codecodexcoding-agentsdeveloper-toolselectrongeminilinuxmacosmultiplexeropencodeparallel-agentsterminalterminal-emulatorterminal-multiplexertmuxworkspace-manager
feat(kanban): pull request cards, read-only
Artemdddefb63ecd6
diff --git a/CLAUDE.md b/CLAUDE.mdindex b03bac958..33a342fea 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -2130,8 +2130,32 @@ the Settings section and ShortcutsPanel start disagreeing about what a chord mea`agentStatus` store (click = back to canvas + `focusNodeById`); GITHUB cards are the repo'sissues (`GitHubIssueCardView` via `state/githubIssues.ts`, opened through`GitHubIssueSummaryModal`, a column move that closes/reopens the issue confirms first). A- **source filter** (`KanbanSourceFilter`: All / GitHub / Sessions) and a transient per-board- **label filter** narrow what shows.+ **source filter** (`KanbanSourceFilter`: All / Issues / Pull requests / Sessions) and a transient+ per-board **label filter** narrow what shows.+ **PULL REQUEST cards are harvested from the issue poll, not fetched** (2026-09-01, read-only):+ `/repos/{repo}/issues` returns pull requests too — `client.listIssues` used to `continue` past+ them — so keeping them costs ZERO extra requests and inherits the incremental `since` watermark,+ the ETags, the 60 s poll and the cache snapshot the issue lane already has. The alternative was+ measured and rejected: **`/repos/{repo}/pulls` IGNORES `since`** (a day-old `since` returned the+ same 100 items as none), each item is ~25 KB against ~7 KB, and it would be a second+ ETag/paging/cache lineage — for `head`/`base` and nothing else (mergeable, reviews and checks are+ per-PR legs either way). The harvest's fields are `draft` and `pull_request.merged_at` (**the only+ thing separating merged from closed** — both report `state: 'closed'`), plus the labels/assignees+ the issue shape already carries. There is **no `head`** in that payload: `GitHubPullMeta.head`+ stays undefined until something asks per branch (`/repos/{repo}/pulls?head=owner:branch`), which+ is one request per question rather than a field on every poll.+ Three rules the harvest brought with it: **(1)** one snapshot now holds both kinds, so+ `GitHubIssueQuery.kind` (absent = `'issue'`) is what keeps the issue lane's items and counts+ byte-identical to before — and `moveIssue` refuses a PR by number (`invalid-target`) because the+ two share a number space and its membership check alone would hand one to a write path that+ cannot serve it. **(2)** `MAX_ISSUES` / the 64 MB bound are shared, so an overflow **evicts pull+ requests first, oldest-updated first** (`evictPullsToFit`) and marks the snapshot+ `pullsTruncated`; the existing `incomplete` read-only path fires only if the issues ALONE still+ miss the bound. A repository large enough to overflow degrades in the new half, never in the+ board it already had. An incremental pass carries the flag forward — it never re-fetches what it+ dropped, so only a full reconciliation may clear it. **(3)** the `pulls` source is `readOnly` in+ the registry: no drag, no move control, and its page reports `readOnly: true` on the wire rather+ than trusting every consumer to remember.**Where a card comes from is a registry, not a branch per call site** (`renderer/lib/kanbanSources.ts`,2026-08-30 — the same membership-plus-one-leaf discipline `AGENT_CONFIG` uses): each entry declaresits filter `label`, its `placement` (`assignment` = the board's own persisted assignments,diff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex 7c33edf20..f01966247 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -67,10 +67,18 @@ need it too, and wire it in the same change.A board card's **source** is a registry entry, not a branch you add at a call site(`renderer/lib/kanbanSources.ts`). Declare the source once — filter label, `placement`(`assignment` = the board's own persisted assignments, `provider` = the provider owns the column),-in-column `lane` order, whether it is `configured` for a board — and give it its one leaf (a card-component and the list path feeding it). Columns take lanes and name no source; the drag path-branches on `placement`. If you find yourself writing `=== 'github'` outside the registry, the-registry is missing a field.+in-column `lane` order, whether it is `configured` for a board, whether it is `readOnly` (the+board never writes it: no drag, no move control) — and give it its one leaf (a card component and+the list path feeding it). Columns take lanes and name no source; the drag path branches on+`placement`. If you find yourself writing `=== 'github'` outside the registry, the registry is+missing a field.++Before adding a GitHub read, check what the existing poll already fetches. Pull request cards+needed no new request at all: `/repos/{repo}/issues` returns pull requests, and the client used to+discard them. `/repos/{repo}/pulls` looks like the obvious endpoint and is the expensive one — it+**ignores `since`**, so it can reuse none of the incremental machinery, and its items are ~3.5× the+bytes. CLAUDE.md's kanban section has the measurements and the eviction rule that keeps the issue+lane unaffected.## House rulesdiff --git a/src/core/github/cache.test.ts b/src/core/github/cache.test.tsindex d4ae73751..bcab4d45a 100644--- a/src/core/github/cache.test.ts+++ b/src/core/github/cache.test.ts@@ -190,6 +190,29 @@ describe('GitHubIssueCache atomic write', () => {expect(await tmpsLeft()).toEqual([])})+ it('round-trips a pull request harvest and its truncation flag', async () => {+ const cache = new GitHubIssueCache(userDataDir)+ const pull: GitHubIssue = { ...issue(9), pull: { draft: true, mergedAt: null } }+ await cache.saveComplete('user-1', 'o/r', { ...complete([issue(1), pull]), pullsTruncated: true })++ const document = await cache.load('user-1', 'o/r')+ expect(document.lastComplete?.pullsTruncated).toBe(true)+ expect(document.lastComplete?.issues[1].pull).toEqual({ draft: true, mergedAt: null })+ })++ it('drops a cached document whose pull metadata is malformed', async () => {+ const cache = new GitHubIssueCache(userDataDir)+ await cache.saveComplete('user-1', 'o/r', complete([issue(1)]))+ const file = (await fs.readdir(path.join(userDataDir, 'github-issues-cache')))[0]+ const target = path.join(userDataDir, 'github-issues-cache', file)+ const document = JSON.parse(await fs.readFile(target, 'utf-8')) as GitHubCacheDocument+ // Cache content is hostile input: a hand-edited `pull` must not reach the board as a card.+ ;(document.lastComplete!.issues[0] as GitHubIssue).pull = { draft: 'yes' } as never+ await fs.writeFile(target, JSON.stringify(document))++ expect(await cache.load('user-1', 'o/r')).toEqual({ version: 1 })+ })+it('a failed rename removes its own temp, rejects, and leaves the previous snapshot', async () => {const cache = new GitHubIssueCache(userDataDir)await cache.saveComplete('user-1', 'o/r', complete([issue(1)]))diff --git a/src/core/github/cache.ts b/src/core/github/cache.tsindex ebdd70de5..64a9f52ef 100644--- a/src/core/github/cache.ts+++ b/src/core/github/cache.ts@@ -14,6 +14,10 @@ export interface GitHubCompleteSnapshot {etags: Record<string, string>lastSuccessfulRefreshAt: numberlastFullReconciliationAt: number+ /** Pull requests were dropped to stay inside the issue/byte bounds, so the pull lane is a+ * subset. Issues are never dropped for a pull request — see the eviction order in+ * `service.refreshRepository`. */+ pullsTruncated?: boolean}export interface GitHubIncompleteAttempt {@@ -38,10 +42,19 @@ function safeInteger(value: unknown): value is number {return typeof value === 'number' && Number.isSafeInteger(value) && value >= 0}+function validPull(value: unknown): boolean {+ if (value === undefined) return true+ if (!value || typeof value !== 'object') return false+ const pull = value as NonNullable<GitHubIssue['pull']>+ return typeof pull.draft === 'boolean' &&+ (pull.mergedAt === null || typeof pull.mergedAt === 'string') &&+ (pull.head === undefined || typeof pull.head === 'string')+}+function validIssue(value: unknown): value is GitHubIssue {if (!value || typeof value !== 'object') return falseconst issue = value as GitHubIssue- return safeInteger(issue.id) && issue.id > 0 && safeInteger(issue.number) && issue.number > 0 &&+ return validPull(issue.pull) && safeInteger(issue.id) && issue.id > 0 && safeInteger(issue.number) && issue.number > 0 &&typeof issue.title === 'string' && typeof issue.body === 'string' &&(issue.state === 'open' || issue.state === 'closed') &&typeof issue.htmlUrl === 'string' && typeof issue.apiUrl === 'string' &&@@ -57,7 +70,8 @@ function validComplete(value: unknown): value is GitHubCompleteSnapshot {snapshot.issues.every(validIssue) &&snapshot.etags !== null && typeof snapshot.etags === 'object' && !Array.isArray(snapshot.etags) &&Object.entries(snapshot.etags).every(([key, etag]) => key.length <= 2_048 && typeof etag === 'string' && etag.length <= 512) &&- safeInteger(snapshot.lastSuccessfulRefreshAt) && safeInteger(snapshot.lastFullReconciliationAt)+ safeInteger(snapshot.lastSuccessfulRefreshAt) && safeInteger(snapshot.lastFullReconciliationAt) &&+ (snapshot.pullsTruncated === undefined || typeof snapshot.pullsTruncated === 'boolean')}function validAttempt(value: unknown): value is GitHubIncompleteAttempt {diff --git a/src/core/github/client.test.ts b/src/core/github/client.test.tsindex c9e4f2a49..6071ad0e1 100644--- a/src/core/github/client.test.ts+++ b/src/core/github/client.test.ts@@ -51,13 +51,46 @@ describe('GitHubIssuesClient', () => {expect(new Headers(calls[0].init.headers).get('authorization')).toBe('Bearer secret')})- it('filters pull requests before returning validated issues', async () => {+ it('harvests pull requests alongside issues, marking only the pull requests', async () => {const client = new GitHubIssuesClient({token: 'secret',- fetch: async () => response([issue(1, { pull_request: { url: 'x' } }), issue(2)])+ fetch: async () => response([+ issue(1, {+ draft: true,+ pull_request: { url: 'https://api.github.com/repos/nodeterm/nodeterm/pulls/1', merged_at: null }+ }),+ issue(2)+ ])})const page = await client.listIssues('nodeterm/nodeterm', { state: 'all', page: 1, perPage: 50 })- expect(page.items.map((item) => item.number)).toEqual([2])+ expect(page.items.map((item) => item.number)).toEqual([1, 2])+ expect(page.items[0].pull).toEqual({ draft: true, mergedAt: null })+ expect(page.items[1].pull).toBeUndefined()+ })++ it('reads a merged pull request from merged_at, which is what separates it from closed', async () => {+ const client = new GitHubIssuesClient({+ token: 'secret',+ fetch: async () => response([+ issue(3, {+ state: 'closed',+ pull_request: { url: 'x', merged_at: '2026-08-30T20:35:03Z' }+ }),+ issue(4, { state: 'closed', pull_request: { url: 'x', merged_at: null } })+ ])+ })+ const page = await client.listIssues('nodeterm/nodeterm', { state: 'all', page: 1, perPage: 50 })+ expect(page.items[0].pull).toEqual({ draft: false, mergedAt: '2026-08-30T20:35:03Z' })+ expect(page.items[1].pull).toEqual({ draft: false, mergedAt: null })+ })++ it('rejects a malformed pull request payload instead of downgrading it to an issue', async () => {+ const client = new GitHubIssuesClient({+ token: 'secret',+ fetch: async () => response([issue(5, { pull_request: { url: 'x', merged_at: 'not-a-date' } })])+ })+ await expect(client.listIssues('nodeterm/nodeterm', { state: 'all', page: 1, perPage: 50 }))+ .rejects.toMatchObject({ code: 'malformed-response' })})it('rejects a pull request returned by the single issue endpoint', async () => {diff --git a/src/core/github/client.ts b/src/core/github/client.tsindex 90c9ce4f1..25d5e82ab 100644--- a/src/core/github/client.ts+++ b/src/core/github/client.ts@@ -2,6 +2,7 @@ import type {GitHubIssue,GitHubIssueLabel,GitHubIssueUser,+ GitHubPullMeta,GitHubRepositoryLabel,IssuePageResult,LabelPageResult,@@ -75,6 +76,19 @@ function issueUser(value: unknown): GitHubIssueUser | null {return { id: Number(item.id), login: item.login, avatarUrl: avatar.toString() }}+/** Decodes the pull-request half of an issues-endpoint item. Returns `undefined` for an issue+ * (no `pull_request` object) and `null` for a malformed one, which the caller must reject —+ * the two answers are different facts. */+function pullFrom(item: Record<string, unknown>): GitHubPullMeta | null | undefined {+ const pull = object(item.pull_request)+ if (item.pull_request === undefined) return undefined+ if (!pull) return null+ const mergedAt = pull.merged_at+ if (!(mergedAt === null || mergedAt === undefined || isoDate(mergedAt))) return null+ if (!(item.draft === undefined || typeof item.draft === 'boolean')) return null+ return { draft: item.draft === true, mergedAt: (mergedAt ?? null) as string | null }+}+function issueFrom(value: unknown): GitHubIssue | null {const item = object(value)if (!item || !positiveInteger(Number(item.id), Number.MAX_SAFE_INTEGER) ||@@ -89,6 +103,8 @@ function issueFrom(value: unknown): GitHubIssue | null {!Array.isArray(item.assignees) || item.assignees.length > 100 ||!isoDate(item.created_at) || !isoDate(item.updated_at) ||typeof item.locked !== 'boolean') return null+ const pull = pullFrom(item)+ if (pull === null) return nullconst labels = item.labels.map(issueLabel)const assignees = item.assignees.map(issueUser)if (labels.some((entry) => !entry) || assignees.some((entry) => !entry)) return null@@ -115,7 +131,8 @@ function issueFrom(value: unknown): GitHubIssue | null {assignees: assignees as GitHubIssueUser[],createdAt: item.created_at,updatedAt: item.updated_at,- locked: item.locked+ locked: item.locked,+ ...(pull ? { pull } : {})}}@@ -211,8 +228,11 @@ export class GitHubIssuesClient {const value = await this.json(response)if (!Array.isArray(value) || value.length > 100) throw new GitHubClientError('malformed-response')const items: GitHubIssue[] = []+ // Pull requests arrive on this endpoint too, and they are kept: their bytes are already+ // fetched, and harvesting them here is what gives the board's pull lane the incremental+ // `since` watermark, ETags and cache the issue lane has. `/repos/{repo}/pulls` ignores+ // `since` entirely, so a separate scan could not reuse any of it.for (const candidate of value) {- if (object(candidate)?.pull_request !== undefined) continueconst decoded = issueFrom(candidate)if (!decoded) throw new GitHubClientError('malformed-response')items.push(decoded)diff --git a/src/core/github/service.test.ts b/src/core/github/service.test.tsindex 0b5c2e35e..9445a59c8 100644--- a/src/core/github/service.test.ts+++ b/src/core/github/service.test.ts@@ -4,6 +4,7 @@ import os from 'node:os'import path from 'node:path'import { GitHubIssueCache } from './cache'import {+ evictPullsToFit,FULL_REFRESH_MIN_INTERVAL_MS,GitHubIssueService,REFRESH_MIN_INTERVAL_MS,@@ -117,6 +118,28 @@ afterEach(async () => {await fs.rm(userDataDir, { recursive: true, force: true })})+describe('evictPullsToFit', () => {+ const pull = (number: number): GitHubIssue =>+ issue(number, { pull: { draft: false, mergedAt: null } })++ it('leaves a harvest that already fits untouched', () => {+ const items = [issue(1), pull(2)]+ expect(evictPullsToFit(items, () => true)).toEqual({ items, pullsTruncated: false })+ })++ it('drops the oldest pull requests and keeps every issue', () => {+ const items = [issue(1), issue(2), pull(3), pull(4), pull(5)]+ const trimmed = evictPullsToFit(items, (candidate) => candidate.length <= 3)+ expect(trimmed?.pullsTruncated).toBe(true)+ expect(trimmed?.items.map((item) => item.number).sort()).toEqual([1, 2, 5])+ })++ it('refuses when the issues alone miss the bound, leaving the incomplete path to answer', () => {+ expect(evictPullsToFit([issue(1), issue(2), pull(3)], (candidate) => candidate.length <= 1))+ .toBeNull()+ })+})+describe('GitHubIssueService', () => {it('renders a cached snapshot immediately and refreshes it in the background', async () => {const client = new FixtureClient([issue(2)])@@ -841,4 +864,75 @@ describe('GitHubIssueService', () => {await service.refresh({ projectId: 'project-1', full: true })expect(fullPages).toHaveLength(2)})++ it('pages issues and pull requests as separate kinds, counting each on its own', async () => {+ const pull = issue(7, {+ pull: { draft: true, mergedAt: null },+ labels: [{ id: 1, name: 'status:doing', color: 'ffd60a' }]+ })+ const client = new FixtureClient([issue(1), pull])+ const service = new GitHubIssueService({+ cache: new GitHubIssueCache(userDataDir),+ coordinator: new GitHubRequestCoordinator(),+ contextForProject: async () => context(client)+ })+ await service.subscribe(1, { projectId: 'project-1' })++ // No kind means issues: the page a caller that predates pull requests still asks for.+ const issues = await service.query({ projectId: 'project-1', columnId: null, pageSize: 50 })+ expect(issues.items.map((item) => item.number)).toEqual([1])+ expect(issues.counts).toEqual({ ungrouped: 1 })++ const pulls = await service.query({+ projectId: 'project-1', columnId: 'doing', pageSize: 50, kind: 'pull'+ })+ expect(pulls.items.map((item) => item.number)).toEqual([7])+ expect(pulls.items[0].pull).toEqual({ draft: true, mergedAt: null })+ expect(pulls.counts).toEqual({ doing: 1 })+ // The board never writes a pull request, and the page says so rather than trusting callers.+ expect(pulls.readOnly).toBe(true)+ })++ it('reports the pull lane as partial when pull requests were evicted to fit', async () => {+ const client = new FixtureClient([])+ const cache = new GitHubIssueCache(userDataDir)+ await cache.bind('local-1', 'project-1', 'o/r', 'user-1')+ await cache.saveComplete('user-1', 'o/r', {+ issues: [issue(1), issue(2, { pull: { draft: false, mergedAt: null } })],+ etags: {},+ lastSuccessfulRefreshAt: 1,+ lastFullReconciliationAt: 1,+ pullsTruncated: true+ })+ const service = new GitHubIssueService({+ cache,+ coordinator: new GitHubRequestCoordinator(),+ contextForProject: async () => context(client)+ })++ const pulls = await service.query({+ projectId: 'project-1', columnId: null, pageSize: 50, kind: 'pull'+ })+ const issues = await service.query({ projectId: 'project-1', columnId: null, pageSize: 50 })+ expect(pulls.partial).toBe(true)+ expect(issues.partial).toBe(false)+ })++ it('refuses to move a pull request, which shares the issue number space', async () => {+ const client = new FixtureClient([issue(5, { pull: { draft: false, mergedAt: null } })])+ const service = new GitHubIssueService({+ cache: new GitHubIssueCache(userDataDir),+ coordinator: new GitHubRequestCoordinator(),+ contextForProject: async () => context(client)+ })+ await service.subscribe(1, { projectId: 'project-1' })++ expect(await service.moveIssue({+ projectId: 'project-1',+ issueNumber: 5,+ toColumnId: 'done',+ expectedUpdatedAt: '2026-08-09T10:05Z'+ })).toEqual({ status: 'invalid-target' })+ expect(client.updates).toEqual([])+ })})diff --git a/src/core/github/service.ts b/src/core/github/service.tsindex 3edd06456..ddc3a3e59 100644--- a/src/core/github/service.ts+++ b/src/core/github/service.ts@@ -131,6 +131,33 @@ function mapping(issue: GitHubIssue, config: NormalisedProjectKanbanGitHub): {return { columnId: matches[0]?.columnId ?? null, conflict: null }}+/** Trims a harvest to a bound by dropping PULL REQUESTS first, oldest-updated first.+ * Issues are never dropped to make room for a pull request: the issue lane shipped first and+ * a repository big enough to overflow must degrade in the new half, not turn the board it+ * already had read only. Returns null when the issues ALONE still miss the bound — that is the+ * caller's existing incomplete path, unchanged. `fits` is a predicate so the same order serves+ * the item count and the byte ceiling. */+export function evictPullsToFit(+ items: GitHubIssue[],+ fits: (candidate: GitHubIssue[]) => boolean+): { items: GitHubIssue[]; pullsTruncated: boolean } | null {+ if (fits(items)) return { items, pullsTruncated: false }+ const issues = items.filter((item) => !item.pull)+ if (!fits(issues)) return null+ const pulls = items.filter((item) => item.pull)+ .sort((a, b) => b.updatedAt.localeCompare(a.updatedAt) || b.number - a.number)+ // Binary search the largest surviving prefix: `fits` may stringify the whole harvest, so+ // dropping one at a time would be O(n²) on a repository near the ceiling.+ let low = 0+ let high = pulls.length - 1+ while (low < high) {+ const middle = Math.ceil((low + high) / 2)+ if (fits([...issues, ...pulls.slice(0, middle)])) low = middle+ else high = middle - 1+ }+ return { items: [...issues, ...pulls.slice(0, low)], pullsTruncated: true }+}+function mutationChain<T>(chains: Map<string, Promise<void>>,key: string,@@ -275,7 +302,12 @@ export class GitHubIssueService {}const context = await this.cacheContext(request.projectId)const { state } = await this.cachedState(context)- const source = state.snapshot?.issues ?? state.partialIssues ?? []+ // One snapshot holds both kinds (they arrive on the same endpoint), so the kind filter is+ // what keeps the issue lane's items and counts exactly what they were before pull requests+ // were harvested. An absent kind means issues.+ const wantPull = request.kind === 'pull'+ const source = (state.snapshot?.issues ?? state.partialIssues ?? [])+ .filter((item) => !!item.pull === wantPull)const mapped = source.map((issue): GitHubIssueCardView => ({ ...issue, ...mapping(issue, context.config) }))const search = request.search?.trim().toLocaleLowerCase('en-US') ?? ''const filters = new Set((request.labelFilter ?? []).map((item) =>@@ -307,8 +339,12 @@ export class GitHubIssueService {items: page,counts,...(offset + page.length < visible.length ? { nextCursor: String(offset + page.length) } : {}),- partial: !state.snapshot && !!state.partialIssues,- readOnly: state.incomplete || !state.snapshot || !context.config.completionColumnId,+ partial: (!state.snapshot && !!state.partialIssues) ||+ (wantPull && !!state.snapshot?.pullsTruncated),+ // The board never writes a pull request, so its page says so on the wire rather than+ // relying on every consumer to remember.+ readOnly: wantPull ||+ state.incomplete || !state.snapshot || !context.config.completionColumnId,...(state.snapshot ? {lastSuccessfulRefreshAt: state.snapshot.lastSuccessfulRefreshAt,lastFullReconciliationAt: state.snapshot.lastFullReconciliationAt@@ -338,9 +374,10 @@ export class GitHubIssueService {if (state.incomplete || !state.snapshot || !captured.config.completionColumnId) {return { status: 'read-only' }}- if (!state.snapshot.issues.some((item) => item.number === request.issueNumber)) {- return { status: 'invalid-target' }- }+ const target = state.snapshot.issues.find((item) => item.number === request.issueNumber)+ // A pull request shares the issue number space and now lives in the same snapshot, so the+ // membership check alone would let one through to a write path that cannot serve it.+ if (!target || target.pull) return { status: 'invalid-target' }if (capturedEpoch !== epoch(await this.options.contextForProject(request.projectId))) {return { status: 'configuration-changed' }}@@ -704,6 +741,10 @@ export class GitHubIssueService {this.now() - state.snapshot.lastFullReconciliationAt >= FULL_REFRESH_AGEconst previous = state.snapshotconst byNumber = new Map((full ? [] : previous?.issues ?? []).map((issue) => [issue.number, issue]))+ // An incremental pass starts from a set a previous eviction may already have thinned, and it+ // never re-fetches what was dropped — so the claim survives until a full reconciliation+ // re-reads the repository and can honestly clear it.+ let pullsTruncated = !full && !!previous?.pullsTruncatedlet page = 1const etags: Record<string, string> = {}while (true) {@@ -726,22 +767,37 @@ export class GitHubIssueService {}}if (byNumber.size > MAX_ISSUES) {- await this.incomplete(- captured, state, 'issue-limit', [...byNumber.values()].slice(0, MAX_ISSUES),- cacheGeneration, operationId, repositoryGeneration+ const trimmed = evictPullsToFit(+ [...byNumber.values()], (candidate) => candidate.length <= MAX_ISSUES)- return+ if (!trimmed) {+ await this.incomplete(+ captured, state, 'issue-limit', [...byNumber.values()].slice(0, MAX_ISSUES),+ cacheGeneration, operationId, repositoryGeneration+ )+ return+ }+ // Paging continues on the trimmed set: each firing drops at least one item, so the scan+ // stays bounded, and a later page's issue still displaces a pull request rather than the+ // scan giving up.+ byNumber.clear()+ for (const item of trimmed.items) byNumber.set(item.number, item)+ pullsTruncated = pullsTruncated || trimmed.pullsTruncated}if (!result.nextPage) breakpage = result.nextPage}- const issues = [...byNumber.values()]- if (Buffer.byteLength(JSON.stringify(issues), 'utf-8') > MAX_CACHE_BYTES) {+ const harvest = [...byNumber.values()]+ const withinBytes = evictPullsToFit(harvest, (candidate) =>+ Buffer.byteLength(JSON.stringify(candidate), 'utf-8') <= MAX_CACHE_BYTES)+ if (!withinBytes) {await this.incomplete(- captured, state, 'byte-limit', issues, cacheGeneration, operationId, repositoryGeneration+ captured, state, 'byte-limit', harvest, cacheGeneration, operationId, repositoryGeneration)return}+ const issues = withinBytes.items+ pullsTruncated = pullsTruncated || withinBytes.pullsTruncatedif (!this.repositoryWriteAllowed(captured.repository, operationId, repositoryGeneration) ||cacheGeneration !== state.cacheGeneration ||epoch(captured) !== epoch(await this.options.contextForProject(captured.projectId))) return@@ -751,7 +807,8 @@ export class GitHubIssueService {lastSuccessfulRefreshAt: refreshStartedAt,lastFullReconciliationAt: full? refreshStartedAt- : previous?.lastFullReconciliationAt ?? refreshStartedAt+ : previous?.lastFullReconciliationAt ?? refreshStartedAt,+ ...(pullsTruncated ? { pullsTruncated: true } : {})}if (!this.repositoryWriteAllowed(captured.repository, operationId, repositoryGeneration)) returnawait this.options.cache.saveComplete(captured.userId, captured.repository, snapshot)diff --git a/src/renderer/components/kanban/GitHubIssueCard.tsx b/src/renderer/components/kanban/GitHubIssueCard.tsxindex f304591eb..01f031df4 100644--- a/src/renderer/components/kanban/GitHubIssueCard.tsx+++ b/src/renderer/components/kanban/GitHubIssueCard.tsx@@ -1,17 +1,7 @@import { memo, useState } from 'react'import type { GitHubIssueCardView } from '@shared/github-issues'import type { KanbanColumn } from '@shared/types'--function relativeTime(value: string): string {- const milliseconds = Date.now() - Date.parse(value)- if (!Number.isFinite(milliseconds) || milliseconds < 0) return 'updated recently'- const minutes = Math.floor(milliseconds / 60_000)- if (minutes < 1) return 'updated now'- if (minutes < 60) return `updated ${minutes}m ago`- const hours = Math.floor(minutes / 60)- if (hours < 24) return `updated ${hours}h ago`- return `updated ${Math.floor(hours / 24)}d ago`-}+import { updatedRelative } from '../../lib/relativeTime'export const GitHubIssueCard = memo(function GitHubIssueCard({issue,@@ -80,7 +70,7 @@ export const GitHubIssueCard = memo(function GitHubIssueCard({</div>)}<div className="github-issue-card__footer">- <span>{moving ? 'Syncing…' : relativeTime(issue.updatedAt)}</span>+ <span>{moving ? 'Syncing…' : updatedRelative(issue.updatedAt)}</span>{issue.conflict && <span className="github-issue-conflict">Needs a column</span>}{issue.assignees.length > 0 && (<span className="kanban-card__avatars">diff --git a/src/renderer/components/kanban/GitHubIssueSummaryModal.tsx b/src/renderer/components/kanban/GitHubIssueSummaryModal.tsxindex 20608fec4..5ac85b2da 100644--- a/src/renderer/components/kanban/GitHubIssueSummaryModal.tsx+++ b/src/renderer/components/kanban/GitHubIssueSummaryModal.tsx@@ -11,6 +11,7 @@ export function GitHubIssueSummaryModal({moving,readOnly,status,+ kind = 'issue',onMove,onClose}: {@@ -19,9 +20,13 @@ export function GitHubIssueSummaryModal({moving: booleanreadOnly: booleanstatus?: string+ /** A pull request is read-only on the board, so its variant drops the Move control and the+ * conflict hint — both name a write only an issue has. */+ kind?: 'issue' | 'pull'onMove: (columnId: string | null) => voidonClose: () => void}): React.JSX.Element {+ const isPull = kind === 'pull'const { api } = useSession()const close = useRef<HTMLButtonElement>(null)const dialog = useRef<HTMLElement>(null)@@ -64,27 +69,31 @@ export function GitHubIssueSummaryModal({><header className="github-issue-modal__header"><div>- <div className="github-issue-modal__eyebrow">GitHub issue #{issue.number}</div>+ <div className="github-issue-modal__eyebrow">+ GitHub {isPull ? 'pull request' : 'issue'} #{issue.number}+ </div><h2 id="github-issue-modal-title">{issue.title}</h2></div><button ref={close} className="github-issue-modal__close" onClick={onClose} aria-label="Close">×</button></header><div className="github-issue-modal__actions">- <label>- <span>Move to</span>- <Select- aria-label={`Move issue #${issue.number}`}- value={issue.columnId ?? ''}- disabled={moving || readOnly}- onChange={(event) => onMove(event.target.value || null)}- >- <option value="">Ungrouped</option>- {columns.map((column) => <option key={column.id} value={column.id}>{column.title}</option>)}- </Select>- </label>+ {!isPull && (+ <label>+ <span>Move to</span>+ <Select+ aria-label={`Move issue #${issue.number}`}+ value={issue.columnId ?? ''}+ disabled={moving || readOnly}+ onChange={(event) => onMove(event.target.value || null)}+ >+ <option value="">Ungrouped</option>+ {columns.map((column) => <option key={column.id} value={column.id}>{column.title}</option>)}+ </Select>+ </label>+ )}<Button onClick={() => void api.shell.openExternal(issue.htmlUrl)}>Open on GitHub</Button></div>- {issue.conflict && (+ {!isPull && issue.conflict && (<p className="github-issue-modal__warning">This issue has conflicting mapped labels. Choose a column to replace them with one exact label.</p>diff --git a/src/renderer/components/kanban/GitHubPullCard.test.tsx b/src/renderer/components/kanban/GitHubPullCard.test.tsxnew file mode 100644index 000000000..1a777c056--- /dev/null+++ b/src/renderer/components/kanban/GitHubPullCard.test.tsx@@ -0,0 +1,52 @@+// @vitest-environment jsdom+import { act } from 'react'+import { createRoot } from 'react-dom/client'+import { describe, expect, it, vi } from 'vitest'+import type { GitHubIssueCardView } from '@shared/github-issues'+import { GitHubPullCard } from './GitHubPullCard'++;(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true++const pull = (over: Partial<GitHubIssueCardView> = {}): GitHubIssueCardView => ({+ id: 7, number: 7, title: 'Harvest pull requests', body: '', state: 'open', stateReason: null,+ htmlUrl: 'https://github.com/o/r/pull/7', apiUrl: 'https://api.github.com/repos/o/r/issues/7',+ labels: [{ id: 1, name: 'kanban', color: 'ff0000' }], assignees: [],+ createdAt: '2026-08-09T00:00:00Z', updatedAt: '2026-08-09T00:00:00Z', locked: false,+ columnId: 'todo', conflict: null, pull: { draft: false, mergedAt: null },+ ...over+})++function render(item: GitHubIssueCardView, onOpen = vi.fn()): { host: HTMLElement; onOpen: typeof onOpen } {+ const host = document.createElement('div')+ act(() => createRoot(host).render(<GitHubPullCard pull={item} onOpen={onOpen} />))+ return { host, onOpen }+}++describe('GitHubPullCard', () => {+ it('names the state a reader is looking for, merged included', () => {+ expect(render(pull()).host.textContent).toContain('Open')+ expect(render(pull({ pull: { draft: true, mergedAt: null } })).host.textContent).toContain('Draft')+ expect(render(pull({+ state: 'closed', pull: { draft: false, mergedAt: '2026-08-30T20:35:03Z' }+ })).host.textContent).toContain('Merged')+ expect(render(pull({ state: 'closed', pull: { draft: false, mergedAt: null } })).host.textContent)+ .toContain('Closed')+ })++ it('carries no write affordance: no drag, no move control', () => {+ const { host } = render(pull())+ const card = host.querySelector<HTMLElement>('[role="button"]')!+ expect(card.draggable).toBe(false)+ expect(host.querySelector('select')).toBeNull()+ })++ it('opens on click and on Enter', () => {+ const item = pull()+ const { host, onOpen } = render(item)+ const card = host.querySelector<HTMLElement>('[role="button"]')!+ act(() => card.dispatchEvent(new MouseEvent('click', { bubbles: true })))+ act(() => card.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter', bubbles: true })))+ expect(onOpen).toHaveBeenCalledTimes(2)+ expect(onOpen).toHaveBeenCalledWith(item)+ })+})diff --git a/src/renderer/components/kanban/GitHubPullCard.tsx b/src/renderer/components/kanban/GitHubPullCard.tsxnew file mode 100644index 000000000..a63e88959--- /dev/null+++ b/src/renderer/components/kanban/GitHubPullCard.tsx@@ -0,0 +1,76 @@+import { memo } from 'react'+import type { GitHubIssueCardView } from '@shared/github-issues'+import { PULL_STATE_LABEL, pullCardState } from '../../lib/githubPull'+import { updatedRelative } from '../../lib/relativeTime'++/** A pull request on the board. The `pulls` source is `readOnly`, so this card carries no drag+ * and no move control — its column is derived from the PR's own labels and state, and there is+ * nothing here the board could write back. */+export const GitHubPullCard = memo(function GitHubPullCard({+ pull,+ onOpen+}: {+ pull: GitHubIssueCardView+ onOpen: (pull: GitHubIssueCardView) => void+}): React.JSX.Element {+ const state = pullCardState(pull)+ return (+ <article+ className="kanban-card kanban-card--github kanban-card--pull"+ role="button"+ tabIndex={0}+ aria-label={`Open pull request #${pull.number}: ${pull.title}`}+ onClick={() => onOpen(pull)}+ onKeyDown={(event) => {+ if (event.key !== 'Enter' && event.key !== ' ') return+ event.preventDefault()+ onOpen(pull)+ }}+ >+ <div className="kanban-card__row">+ <span className={`github-pull-state github-pull-state--${state}`} aria-hidden="true" />+ <span className="kanban-card__title">{pull.title}</span>+ <span className="github-issue-source" title="GitHub pull request">PR</span>+ </div>+ <div className="github-issue-card__number">+ #{pull.number}+ <span className={`github-pull-badge github-pull-badge--${state}`}>{PULL_STATE_LABEL[state]}</span>+ </div>+ {pull.labels.length > 0 && (+ <div className="github-issue-card__labels">+ {pull.labels.slice(0, 5).map((label) => (+ <span+ key={label.id}+ className="github-issue-label"+ style={{ borderColor: `#${label.color}`, color: `#${label.color}` }}+ >+ {label.name}+ </span>+ ))}+ {pull.labels.length > 5 && <span className="github-issue-label">+{pull.labels.length - 5}</span>}+ </div>+ )}+ <div className="github-issue-card__footer">+ <span>{updatedRelative(pull.updatedAt)}</span>+ {pull.assignees.length > 0 && (+ <span className="kanban-card__avatars">+ {pull.assignees.slice(0, 3).map((assignee) => {+ const avatar = pull.avatarDataUrls?.[String(assignee.id)]+ return avatar ? (+ <img key={assignee.id} className="github-issue-avatar" src={avatar} alt={assignee.login} />+ ) : (+ <span+ key={assignee.id}+ className="github-issue-avatar github-issue-avatar--initial"+ title={assignee.login}+ >+ {(assignee.login[0] ?? '?').toUpperCase()}+ </span>+ )+ })}+ </span>+ )}+ </div>+ </article>+ )+})diff --git a/src/renderer/components/kanban/KanbanSourceFilter.test.tsx b/src/renderer/components/kanban/KanbanSourceFilter.test.tsxindex 26fade1cd..78f155941 100644--- a/src/renderer/components/kanban/KanbanSourceFilter.test.tsx+++ b/src/renderer/components/kanban/KanbanSourceFilter.test.tsx@@ -7,13 +7,13 @@ import { KanbanSourceFilter } from './KanbanSourceFilter';(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = truedescribe('KanbanSourceFilter', () => {- it('offers All, GitHub, and Sessions without changing board data', () => {+ it('offers All, Issues, Pull requests, and Sessions without changing board data', () => {const host = document.createElement('div')const root = createRoot(host)const onChange = vi.fn()act(() => root.render(<KanbanSourceFilter value="all" onChange={onChange} />))expect([...host.querySelectorAll('button')].map((button) => button.textContent))- .toEqual(['All', 'GitHub', 'Sessions'])+ .toEqual(['All', 'Issues', 'Pull requests', 'Sessions'])act(() => host.querySelectorAll('button')[1].click())expect(onChange).toHaveBeenCalledWith('github')act(() => root.unmount())diff --git a/src/renderer/components/kanban/KanbanView.tsx b/src/renderer/components/kanban/KanbanView.tsxindex 39fbaf599..9ea6987a1 100644--- a/src/renderer/components/kanban/KanbanView.tsx+++ b/src/renderer/components/kanban/KanbanView.tsx@@ -14,6 +14,7 @@ import { CardModal } from './CardModal'import { KanbanColumn, type KanbanLane } from './KanbanColumn'import { SessionCard } from './SessionCard'import { GitHubIssueCard } from './GitHubIssueCard'+import { GitHubPullCard } from './GitHubPullCard'import { kanbanSource, sourceVisible } from '../../lib/kanbanSources'import type { ModalSpawn } from './ModalTerminal'import { ContextMenu, type MenuItem } from '../ContextMenu'@@ -129,7 +130,10 @@ export const KanbanView = memo(function KanbanView({const [labelFilter, setLabelFilter] = useState<string[]>([])const [filterOpen, setFilterOpen] = useState(false)const [source, setSource] = useState<KanbanSource>('all')- const [modalIssue, setModalIssue] = useState<GitHubIssueCardView | null>(null)+ // One GitHub summary modal for both kinds; the kind decides whether it offers a move.+ const [modalIssue, setModalIssue] = useState<+ { item: GitHubIssueCardView; kind: 'issue' | 'pull' } | null+ >(null)const [githubRetry, setGitHubRetry] = useState(0)// A move that would close or reopen the issue on GitHub waits here for an explicit confirmation.const [pendingGitHubMove, setPendingGitHubMove] = useState<@@ -141,6 +145,9 @@ export const KanbanView = memo(function KanbanView({const projectColor = useProjects((s) => s.projects.find((p) => p.id === s.activeProjectId)?.color)const github = useGitHubIssues((state) => state.projects[projectId])const githubReadOnly = Object.values(github?.pages ?? {}).some((page) => page.readOnly)+ // Pull requests are evicted first when a repository outgrows the cache bounds, so the lane can+ // legitimately be a subset. Say so — a silently short list reads as "this repo has few PRs".+ const pullsTruncated = Object.values(github?.pullPages ?? {}).some((page) => page.partial)const connectGitHub = useGitHubIssues((state) => state.connect)const moveGitHubState = useGitHubIssues((state) => state.move)const loadMoreGitHub = useGitHubIssues((state) => state.loadMore)@@ -148,7 +155,10 @@ export const KanbanView = memo(function KanbanView({const paletteLabels = useMemo(() => boardLabels(board), [board])const githubLabels = useMemo(() => {const labels = new Map<string, { name: string; color: string }>()- for (const page of Object.values(github?.pages ?? {})) {+ for (const page of [+ ...Object.values(github?.pages ?? {}),+ ...Object.values(github?.pullPages ?? {})+ ]) {for (const issue of page.items) {for (const label of issue.labels) {const key = label.name.normalize('NFKC').toLocaleLowerCase('en-US')@@ -157,7 +167,7 @@ export const KanbanView = memo(function KanbanView({}}return [...labels.values()].sort((a, b) => a.name.localeCompare(b.name))- }, [github?.pages])+ }, [github?.pages, github?.pullPages])const localFilterKeys = useMemo(() => new Set(paletteLabels.map((label) => `local:${label.id}`)), [paletteLabels])const activeFilter = useMemo(() => labelFilter.filter((id) => localFilterKeys.has(id) || id.startsWith('github:')),@@ -214,10 +224,13 @@ export const KanbanView = memo(function KanbanView({}, [projectId])useEffect(() => {if (!modalIssue || !github) return- const latest = Object.values(github.pages)+ const source = modalIssue.kind === 'pull' ? github.pullPages : github.pages+ const latest = Object.values(source).flatMap((page) => page.items)- .find((issue) => issue.number === modalIssue.number)- if (latest && latest.updatedAt !== modalIssue.updatedAt) setModalIssue(latest)+ .find((item) => item.number === modalIssue.item.number)+ if (latest && latest.updatedAt !== modalIssue.item.updatedAt) {+ setModalIssue({ item: latest, kind: modalIssue.kind })+ }}, [github, modalIssue])const customAgents = useSettings((s) => s.settings.customAgents)const disabledAgents = useSettings((s) => s.settings.disabledAgents)@@ -384,6 +397,12 @@ export const KanbanView = memo(function KanbanView({const handleMoveGitHub = requestGitHubMoveconst githubPage = useCallback((columnId: string | null) =>github?.pages[columnId ?? 'ungrouped'], [github])+ const githubPullPage = useCallback((columnId: string | null) =>+ github?.pullPages[columnId ?? 'ungrouped'], [github])+ const openIssueModal = useCallback(+ (item: GitHubIssueCardView) => setModalIssue({ item, kind: 'issue' }), [])+ const openPullModal = useCallback(+ (item: GitHubIssueCardView) => setModalIssue({ item, kind: 'pull' }), [])// One bound card-drop handler per column, cached by column id: SessionCard is memoized on its// props, so a fresh closure per render would defeat it. (The column used to bind this itself,@@ -443,7 +462,7 @@ export const KanbanView = memo(function KanbanView({moving={!!github?.moving[issue.number]}readOnly={githubReadOnly}status={github?.issueStatus[issue.number]}- onOpen={setModalIssue}+ onOpen={openIssueModal}onMove={handleMoveGitHub}onDragStart={handleGitHubDragStart}onDragEnd={handleDragEnd}@@ -453,7 +472,7 @@ export const KanbanView = memo(function KanbanView({? (<buttonclassName="kanban-github-more"- onClick={() => void loadMoreGitHub(api.githubIssues, projectId, columnId)}+ onClick={() => void loadMoreGitHub(api.githubIssues, projectId, columnId, 'issue')}>Show more issues</button>@@ -461,6 +480,26 @@ export const KanbanView = memo(function KanbanView({: undefined})}+ if (sourceVisible(source, 'pulls') && kanbanSource('pulls').configured(board)) {+ const page = githubPullPage(columnId)+ lanes.push({+ sourceId: 'pulls',+ count: (columnId === null ? page?.counts.ungrouped : page?.counts[columnId]) ?? 0,+ cards: (page?.items ?? []).map((pull) => (+ <GitHubPullCard key={`pull:${pull.id}`} pull={pull} onOpen={openPullModal} />+ )),+ footer: page?.nextCursor+ ? (+ <button+ className="kanban-github-more"+ onClick={() => void loadMoreGitHub(api.githubIssues, projectId, columnId, 'pull')}+ >+ Show more pull requests+ </button>+ )+ : undefined+ })+ }return lanes}@@ -511,6 +550,11 @@ export const KanbanView = memo(function KanbanView({GitHub issues are read only until configuration and refresh are complete.</span>)}+ {board.github && pullsTruncated && (+ <span className="kanban-github-status">+ Showing the most recently updated pull requests only.+ </span>+ )}{(paletteLabels.length > 0 || githubLabels.length > 0 || activeFilter.length > 0) && (<div className="kanban-header__filter"><button@@ -623,12 +667,13 @@ export const KanbanView = memo(function KanbanView({)}{modalIssue && (<GitHubIssueSummaryModal- issue={modalIssue}+ issue={modalIssue.item}+ kind={modalIssue.kind}columns={board.columns}- moving={!!github?.moving[modalIssue.number]}+ moving={!!github?.moving[modalIssue.item.number]}readOnly={githubReadOnly}- status={github?.issueStatus[modalIssue.number]}- onMove={(columnId) => handleMoveGitHub(modalIssue, columnId)}+ status={github?.issueStatus[modalIssue.item.number]}+ onMove={(columnId) => handleMoveGitHub(modalIssue.item, columnId)}onClose={() => setModalIssue(null)}/>)}diff --git a/src/renderer/lib/githubPull.test.ts b/src/renderer/lib/githubPull.test.tsnew file mode 100644index 000000000..4dcd1dbf8--- /dev/null+++ b/src/renderer/lib/githubPull.test.ts@@ -0,0 +1,20 @@+import { describe, expect, it } from 'vitest'+import { pullCardState } from './githubPull'++describe('pullCardState', () => {+ it('separates merged from closed, which arrive as the same state', () => {+ expect(pullCardState({ state: 'closed', pull: { draft: false, mergedAt: '2026-08-30T20:35:03Z' } }))+ .toBe('merged')+ expect(pullCardState({ state: 'closed', pull: { draft: false, mergedAt: null } })).toBe('closed')+ })++ it('reports a draft as a draft, not as open', () => {+ expect(pullCardState({ state: 'open', pull: { draft: true, mergedAt: null } })).toBe('draft')+ expect(pullCardState({ state: 'open', pull: { draft: false, mergedAt: null } })).toBe('open')+ })++ it('degrades to the plain state when the pull metadata is missing', () => {+ expect(pullCardState({ state: 'open' })).toBe('open')+ expect(pullCardState({ state: 'closed' })).toBe('closed')+ })+})diff --git a/src/renderer/lib/githubPull.ts b/src/renderer/lib/githubPull.tsnew file mode 100644index 000000000..9e9001292--- /dev/null+++ b/src/renderer/lib/githubPull.ts@@ -0,0 +1,18 @@+import type { GitHubIssue } from '@shared/github-issues'++/** What a pull request card says it is. `merged` and `closed` both arrive as `state: 'closed'`,+ * and only `mergedAt` separates them; `draft` outranks `open` because that is the distinction a+ * reader is looking for. */+export type PullCardState = 'draft' | 'open' | 'merged' | 'closed'++export function pullCardState(item: Pick<GitHubIssue, 'state' | 'pull'>): PullCardState {+ if (item.state === 'closed') return item.pull?.mergedAt ? 'merged' : 'closed'+ return item.pull?.draft ? 'draft' : 'open'+}++export const PULL_STATE_LABEL: Record<PullCardState, string> = {+ draft: 'Draft',+ open: 'Open',+ merged: 'Merged',+ closed: 'Closed'+}diff --git a/src/renderer/lib/kanbanSources.test.ts b/src/renderer/lib/kanbanSources.test.tsindex cc9aa81fe..6533572bd 100644--- a/src/renderer/lib/kanbanSources.test.ts+++ b/src/renderer/lib/kanbanSources.test.ts@@ -14,18 +14,31 @@ describe('kanban source registry', () => {})it('stacks sessions above provider-placed cards in a column', () => {- const ordered = byLane([{ sourceId: 'github' as const }, { sourceId: 'sessions' as const }])- expect(ordered.map((lane) => lane.sourceId)).toEqual(['sessions', 'github'])+ const ordered = byLane([+ { sourceId: 'pulls' as const },+ { sourceId: 'github' as const },+ { sourceId: 'sessions' as const }+ ])+ expect(ordered.map((lane) => lane.sourceId)).toEqual(['sessions', 'github', 'pulls'])+ })++ it('marks only the sources the board can never write', () => {+ expect(kanbanSource('pulls').readOnly).toBe(true)+ expect(kanbanSource('github').readOnly).toBeFalsy()+ expect(kanbanSource('sessions').readOnly).toBeFalsy()})it('keeps the board out of a provider-placed card’s column', () => {expect(kanbanSource('github').placement).toBe('provider')+ expect(kanbanSource('pulls').placement).toBe('provider')expect(kanbanSource('sessions').placement).toBe('assignment')})- it('offers GitHub only on a board configured for it; sessions always', () => {+ it('offers the GitHub sources only on a board configured for them; sessions always', () => {expect(kanbanSource('github').configured(board())).toBe(false)+ expect(kanbanSource('pulls').configured(board())).toBe(false)expect(kanbanSource('github').configured(board({ repository: 'owner/repo', columnMappings: [] }))).toBe(true)+ expect(kanbanSource('pulls').configured(board({ repository: 'owner/repo', columnMappings: [] }))).toBe(true)expect(kanbanSource('sessions').configured(board())).toBe(true)})@@ -35,6 +48,8 @@ describe('kanban source registry', () => {expect(sourceVisible('sessions', 'github')).toBe(false)expect(sourceVisible('github', 'sessions')).toBe(false)expect(sourceVisible('github', 'github')).toBe(true)+ expect(sourceVisible('github', 'pulls')).toBe(false)+ expect(sourceVisible('pulls', 'pulls')).toBe(true)})it('rejects an unknown source id rather than answering for it', () => {diff --git a/src/renderer/lib/kanbanSources.ts b/src/renderer/lib/kanbanSources.tsindex acb433fb5..78f689816 100644--- a/src/renderer/lib/kanbanSources.ts+++ b/src/renderer/lib/kanbanSources.ts@@ -3,7 +3,7 @@ import type { ProjectKanban } from '@shared/types'/** Where a board card can come from. Sources are a membership list plus one concrete leaf each* (the card component and the list path that feeds it) — the same discipline `AGENT_CONFIG`* uses for agents, so no consumer spells a source id to decide how a card behaves. */-export type KanbanSourceId = 'github' | 'sessions'+export type KanbanSourceId = 'github' | 'pulls' | 'sessions'/** The board's source filter: everything, or exactly one source. */export type KanbanSourceFilter = 'all' | KanbanSourceId@@ -20,22 +20,34 @@ export interface KanbanSourceDef {placement: 'assignment' | 'provider'/** In-column stacking order, low first. */lane: number+ /** The board never writes this source: its cards do not drag and carry no move control.+ * Distinct from `placement: 'provider'`, which only says who OWNS the column — a provider+ * source can still be writable (an issue drag closes it on GitHub). */+ readOnly?: boolean/** Whether this source can contribute cards to a given board at all. */configured: (board: ProjectKanban) => boolean}/** Declaration order IS the source filter's button order; `lane` is the in-column stacking* order. The two genuinely differ on the board today (the filter reads All · GitHub · Sessions- * while a column stacks its sessions above its issues), and pinning both here is what keeps- * either of them from being re-spelled at a call site. */+ * while a column stacks its sessions above its issues and its issues above its pull requests),+ * and pinning both here is what keeps either of them from being re-spelled at a call site. */export const KANBAN_SOURCES: readonly KanbanSourceDef[] = [{id: 'github',- label: 'GitHub',+ label: 'Issues',placement: 'provider',lane: 1,configured: (board) => !!board.github},+ {+ id: 'pulls',+ label: 'Pull requests',+ placement: 'provider',+ lane: 2,+ readOnly: true,+ configured: (board) => !!board.github+ },{id: 'sessions',label: 'Sessions',diff --git a/src/renderer/lib/relativeTime.ts b/src/renderer/lib/relativeTime.tsindex 51b6d311d..fb5ef23fa 100644--- a/src/renderer/lib/relativeTime.ts+++ b/src/renderer/lib/relativeTime.ts@@ -8,3 +8,11 @@ export function relativeTime(ms: number, nowMs: number): string {if (hr < 24) return `${hr}h ago`return `${Math.floor(hr / 24)}d ago`}++/** The GitHub cards' footer phrasing over an ISO stamp. An unparseable or future stamp (this+ * machine's clock behind GitHub's) reads as "recently" rather than a negative age. */+export function updatedRelative(iso: string, nowMs: number = Date.now()): string {+ const at = Date.parse(iso)+ if (!Number.isFinite(at) || at > nowMs) return 'updated recently'+ return `updated ${relativeTime(at, nowMs)}`+}diff --git a/src/renderer/state/githubIssues.test.ts b/src/renderer/state/githubIssues.test.tsindex 10dee26ec..8092ec840 100644--- a/src/renderer/state/githubIssues.test.ts+++ b/src/renderer/state/githubIssues.test.ts@@ -16,11 +16,18 @@ const page = (number: number, columnId: string | null, nextCursor?: string) => (...(nextCursor ? { nextCursor } : {})})+const pullPage = (number: number, columnId: string | null, nextCursor?: string) => {+ const base = page(number, columnId, nextCursor)+ return { ...base, items: [{ ...base.items[0], pull: { draft: false, mergedAt: null } }] }+}+function api(): GitHubIssuesApi {return {subscribe: vi.fn(async () => page(1, null)),unsubscribe: vi.fn(async () => {}),- query: vi.fn(async (request) => page(request.columnId === 'todo' ? 2 : 3, request.columnId)),+ query: vi.fn(async (request) => request.kind === 'pull'+ ? pullPage(request.columnId === 'todo' ? 200 : 300, request.columnId)+ : page(request.columnId === 'todo' ? 2 : 3, request.columnId)),refresh: vi.fn(async () => {}),moveIssue: vi.fn(async () => ({ status: 'configuration-changed' as const })),createMissingLabels: vi.fn(async () => ({ status: 'confirmed' as const, created: [], remaining: [] })),@@ -116,19 +123,37 @@ describe('GitHub issue renderer state', () => {disconnect()})- it('subscribes once and loads every visible column', async () => {+ it('subscribes once and loads every visible column, in both kinds', async () => {const client = api()const disconnect = await useGitHubIssues.getState().connect(client, 'p1', ['todo', 'done'], ['github:bug'])expect(client.subscribe).toHaveBeenCalledWith('p1')- expect(client.query).toHaveBeenCalledTimes(3)+ // Three columns × two kinds. Both are served from the one cached snapshot in core, so the+ // pull pass is a read of data the refresh already fetched.+ expect(client.query).toHaveBeenCalledTimes(6)expect(client.query).toHaveBeenCalledWith(expect.objectContaining({ labelFilter: ['github:bug'] }))expect(useGitHubIssues.getState().projects.p1.pages.todo.items[0].number).toBe(2)+ expect(useGitHubIssues.getState().projects.p1.pullPages.todo.items[0].number).toBe(200)disconnect()expect(client.unsubscribe).toHaveBeenCalledWith('p1')})+ it('pages more of the kind it was asked for, leaving the other lane alone', async () => {+ const client = api()+ vi.mocked(client.query).mockImplementation(async (request) => request.kind === 'pull'+ ? pullPage(request.cursor ? 201 : 200, request.columnId, request.cursor ? undefined : '1')+ : page(2, request.columnId))+ const disconnect = await useGitHubIssues.getState().connect(client, 'p1', ['todo'])++ await useGitHubIssues.getState().loadMore(client, 'p1', 'todo', 'pull')+ expect(useGitHubIssues.getState().projects.p1.pullPages.todo.items.map((item) => item.number))+ .toEqual([200, 201])+ expect(useGitHubIssues.getState().projects.p1.pages.todo.items.map((item) => item.number))+ .toEqual([2])+ disconnect()+ })+it('marks only the issue being moved and exposes an actionable non-confirmed status', async () => {const client = api()const disconnect = await useGitHubIssues.getState().connect(client, 'p1', ['todo'])diff --git a/src/renderer/state/githubIssues.ts b/src/renderer/state/githubIssues.tsindex d39715608..bb283f966 100644--- a/src/renderer/state/githubIssues.ts+++ b/src/renderer/state/githubIssues.ts@@ -1,12 +1,16 @@import { create } from 'zustand'import type {GitHubIssuePage,+ GitHubIssueQuery,GitHubIssuesApi,GitHubMutationResult} from '@shared/github-issues'export interface GitHubProjectPages {pages: Record<string, GitHubIssuePage>+ /** The same columns paged for the other kind. Pull requests ride the issue snapshot, so this+ * costs no extra network refresh — one query per column against what is already cached. */+ pullPages: Record<string, GitHubIssuePage>columns: string[]moving: Record<number, true>loading: boolean@@ -21,7 +25,12 @@ interface GitHubIssuesState {projects: Record<string, GitHubProjectPages>connect(api: GitHubIssuesApi, projectId: string, columns: string[], labelFilter?: string[]): Promise<() => void>reload(api: GitHubIssuesApi, projectId: string): Promise<void>- loadMore(api: GitHubIssuesApi, projectId: string, columnId: string | null): Promise<void>+ loadMore(+ api: GitHubIssuesApi,+ projectId: string,+ columnId: string | null,+ kind?: GitHubIssueQuery['kind']+ ): Promise<void>move(api: GitHubIssuesApi,projectId: string,@@ -32,6 +41,22 @@ interface GitHubIssuesState {}const keyFor = (columnId: string | null): string => columnId ?? 'ungrouped'++/** Pages every column for one kind. Both kinds are served from the one cached snapshot in core,+ * so the second pass is a read of data already fetched, not a second refresh. */+async function pageColumns(+ api: GitHubIssuesApi,+ projectId: string,+ columns: (string | null)[],+ labelFilter: string[],+ kind: GitHubIssueQuery['kind']+): Promise<Record<string, GitHubIssuePage>> {+ const pages = await Promise.all(columns.map(async (columnId) => [+ keyFor(columnId),+ await api.query({ projectId, columnId, pageSize: 50, labelFilter, ...(kind ? { kind } : {}) })+ ] as const))+ return Object.fromEntries(pages)+}let nextConnectionGeneration = 0type HostSubscription = {@@ -101,8 +126,8 @@ export const useGitHubIssues = create<GitHubIssuesState>((set, get) => ({projects: {...state.projects,[projectId]: {- pages: {}, columns, moving: {}, loading: true, labelFilter, issueStatus: {},- generation, loadGeneration: 0+ pages: {}, pullPages: {}, columns, moving: {}, loading: true, labelFilter,+ issueStatus: {}, generation, loadGeneration: 0}}}))@@ -133,16 +158,17 @@ export const useGitHubIssues = create<GitHubIssuesState>((set, get) => ({return () => undefined}const loadGeneration = get().projects[projectId]?.loadGeneration ?? 0- const columnPages = await Promise.all([null, ...columns].map(async (columnId) => [- keyFor(columnId),- await api.query({ projectId, columnId, pageSize: 50, labelFilter })- ] as const))+ const [columnPages, columnPullPages] = await Promise.all([+ pageColumns(api, projectId, [null, ...columns], labelFilter, 'issue'),+ pageColumns(api, projectId, [null, ...columns], labelFilter, 'pull')+ ])set((state) => state.projects[projectId]?.generation === generation &&state.projects[projectId]?.loadGeneration === loadGeneration ? ({projects: {...state.projects,[projectId]: {- pages: Object.fromEntries(columnPages),+ pages: columnPages,+ pullPages: columnPullPages,columns,moving: state.projects[projectId]?.moving ?? {},issueStatus: state.projects[projectId]?.issueStatus ?? {},@@ -158,7 +184,8 @@ export const useGitHubIssues = create<GitHubIssuesState>((set, get) => ({projects: {...state.projects,[projectId]: {- pages: {}, columns, moving: {}, loading: false, labelFilter, issueStatus: {},+ pages: {}, pullPages: {}, columns, moving: {}, loading: false, labelFilter,+ issueStatus: {},error: error instanceof Error ? error.message : 'GitHub issues are unavailable',generation,loadGeneration: state.projects[projectId]?.loadGeneration ?? 0@@ -190,17 +217,17 @@ export const useGitHubIssues = create<GitHubIssuesState>((set, get) => ({} : state})try {- const pages = await Promise.all([null, ...current.columns].map(async (columnId) => [- keyFor(columnId),- await api.query({ projectId, columnId, pageSize: 50, labelFilter: current.labelFilter })- ] as const))+ const [pages, pullPages] = await Promise.all([+ pageColumns(api, projectId, [null, ...current.columns], current.labelFilter, 'issue'),+ pageColumns(api, projectId, [null, ...current.columns], current.labelFilter, 'pull')+ ])set((state) => {const existing = state.projects[projectId]if (existing?.generation !== generation || existing.loadGeneration !== loadGeneration) return statereturn existing ? {projects: {...state.projects,- [projectId]: { ...existing, pages: Object.fromEntries(pages), loading: false, error: undefined }+ [projectId]: { ...existing, pages, pullPages, loading: false, error: undefined }}} : state})@@ -222,9 +249,10 @@ export const useGitHubIssues = create<GitHubIssuesState>((set, get) => ({}},- async loadMore(api, projectId, columnId) {+ async loadMore(api, projectId, columnId, kind = 'issue') {const project = get().projects[projectId]- const current = project?.pages[keyFor(columnId)]+ const field = kind === 'pull' ? 'pullPages' : 'pages'+ const current = project?.[field][keyFor(columnId)]if (!project || !current?.nextCursor) returnconst generation = project.generationconst loadGeneration = project.loadGeneration@@ -233,7 +261,8 @@ export const useGitHubIssues = create<GitHubIssuesState>((set, get) => ({columnId,pageSize: 50,cursor: current.nextCursor,- labelFilter: project.labelFilter+ labelFilter: project.labelFilter,+ kind})set((state) => {const existing = state.projects[projectId]@@ -244,8 +273,8 @@ export const useGitHubIssues = create<GitHubIssuesState>((set, get) => ({...state.projects,[projectId]: {...existing,- pages: {- ...existing.pages,+ [field]: {+ ...existing[field],[keyFor(columnId)]: { ...next, items: [...current.items, ...next.items] }}}diff --git a/src/renderer/styles.css b/src/renderer/styles.cssindex 7859f558e..1eac96e9f 100644--- a/src/renderer/styles.css+++ b/src/renderer/styles.css@@ -8552,6 +8552,51 @@ button.group-node__setup:disabled {.github-issue-state--closed {color: #a371f7;}+.kanban-card--pull {+ /* Read-only: no drag affordance, so no grab cursor either. */+ border-left-color: rgba(163, 113, 247, 0.7);+ cursor: pointer;+}+.github-pull-state {+ width: 9px;+ height: 9px;+ margin-top: 4px;+ border: 2px solid currentColor;+ border-radius: 50%;+ flex: 0 0 auto;+}+.github-pull-state--open {+ color: #3fb950;+}+.github-pull-state--draft {+ color: rgba(var(--tint-rgb), 0.45);+}+.github-pull-state--merged {+ color: #a371f7;+}+.github-pull-state--closed {+ color: #f85149;+}+.github-pull-badge {+ margin-left: 6px;+ border: 1px solid currentColor;+ border-radius: 999px;+ padding: 0 5px;+ font-size: 9px;+ font-weight: 600;+}+.github-pull-badge--open {+ color: #3fb950;+}+.github-pull-badge--draft {+ color: rgba(var(--tint-rgb), 0.5);+}+.github-pull-badge--merged {+ color: #a371f7;+}+.github-pull-badge--closed {+ color: #f85149;+}.github-issue-source {flex: 0 0 auto;border: 1px solid rgba(var(--tint-rgb), 0.15);diff --git a/src/shared/github-issues.ts b/src/shared/github-issues.tsindex 7f3e5782a..82b0ca740 100644--- a/src/shared/github-issues.ts+++ b/src/shared/github-issues.ts@@ -70,6 +70,19 @@ export interface GitHubIssueUser {avatarUrl: string}+/** The PR-only facts the issues endpoint carries for a pull request item, normalised. Its+ * presence on a `GitHubIssue` is the discriminator: GitHub returns pull requests from+ * `/repos/{repo}/issues`, and only those items have a `pull_request` object (an issue item+ * carries no `draft` key at all). */+export interface GitHubPullMeta {+ draft: boolean+ /** ISO stamp when the PR merged, else null — the only thing separating merged from+ * closed-unmerged, both of which report `state: 'closed'`. */+ mergedAt: string | null+ /** Head branch. NOT in the issues list payload; filled by a targeted per-branch read. */+ head?: string+}+export interface GitHubIssue {id: numbernumber: number@@ -84,6 +97,8 @@ export interface GitHubIssue {createdAt: stringupdatedAt: stringlocked: boolean+ /** Present iff this item is a pull request. */+ pull?: GitHubPullMeta}export interface ListIssueOptions {@@ -130,6 +145,9 @@ export interface GitHubIssueCardView extends GitHubIssue {export interface GitHubIssueQuery {projectId: string+ /** Which kind of item to page. Absent = `'issue'`, so a caller that predates pull requests+ * gets exactly the page it always got. */+ kind?: 'issue' | 'pull'columnId: string | nullpageSize: numbercursor?: string