#6392 · Repository sync silently loses issues outside its first page
Verdict: REPRODUCED · Root-cause confidence: high
1. TL;DR
The current GitHub plugin successfully refreshes a repository containing 101 synthetic open issues but exposes only 100 through its real list RPC. In a second scenario, issue 1 is present with 100 open issues, then disappears from the plugin cache when issue 101 is added, although issue 1 remains open upstream. The plugin requests a single creation-descending page and treats it as the complete repository snapshot. Its transaction replaces all existing cached rows with that page. This removes only local cached entries, not issues on GitHub.
This is a deterministic backend reproduction against trusted main, not a desktop/browser reproduction or a live GitHub request. The external GitHub process boundary is faked; the production plugin, validation, synchronization, SQLite storage, and RPC handlers all run.
2. Claims vs findings
| Claim | Finding | Evidence |
|---|---|---|
| Open issues beyond the first 100 are absent. | Verified | 101-item upstream fixture → list RPC returns 100; oldest issue absent in both runs. |
| A previously cached issue can disappear after refresh. | Verified | 100 → 101 upstream transition; issue 1 exists before and is absent after, without changing upstream state. |
| All four repository lists are bounded and not paginated. | Verified in source | 100/50 issue and 50/30 PR query sizes; one request in each executed scenario. Runtime tests target open issues only. |
| The UI gives no indication of an incomplete list. | Source-supported; not tested live | The list RPC returns items without completeness metadata; the app consumes these items. No browser or screenshot evidence claimed. |
| The installed desktop version has this behavior. | Not verified here | This investigation used source at the recorded main commit, not the reporter's installed bundle or platform. |
3. Environment
- Trusted public repository: get-bb/bb; base
7125b90a6f7812e40d8e8509f53cecd301c84881, confirmed equal to target main when fetched. - Linux x86_64; Node v22.19.0; pnpm 9.15.0; GitHub plugin package 0.2.1.
- Two detached clean worktrees, each independently installed with the frozen lockfile and built through Turbo. No live BB instance, user runtime data, provider session, credentials, ports, or network API mutation used by the reproduction.
- The SDK test host creates a temporary on-disk SQLite database and the plugin installs its own table schema. Database access is real, not mocked.
- Initial broad build failed because the SDK process entry had not been built. Explicitly building the SDK with Turbo resolved that prerequisite; the repeated complete build passed 72/72 tasks. The second checkout built the SDK first and the full build passed 72/72 tasks. This prerequisite failure is not the reported bug.
4. Minimal reproduction
- Use a clean checkout at the trusted base; install and build normally, then obtain this report's authored test artifact:
git clone https://github.com/get-bb/bb.git /tmp/bb-6392-first cd /tmp/bb-6392-first git checkout --detach 7125b90a6f7812e40d8e8509f53cecd301c84881 pnpm install --frozen-lockfile --prefer-offline pnpm exec turbo run build --filter=@get-bb/plugin-sdk pnpm exec turbo run build curl -fsS https://get-bb.github.io/reports/issues/6392.html -o /tmp/bb-6392-report.html python3 -c 'import html,re; from pathlib import Path; report=Path("/tmp/bb-6392-report.html").read_text(); source=re.search(r"<pre id=\"repro-test\">([\s\S]*?)</pre>", report).group(1); Path("plugins/github/server.issue-6392.test.ts").write_text(html.unescape(source))' pnpm exec turbo run test --filter=bb-plugin-github -- server.issue-6392.test.ts - The test initializes the production plugin with an isolated SDK host and a synthetic external GraphQL boundary. The boundary respects the requested open-issue page size and advertises another page. No repository state or authentication is required.
- Scenario A creates 101 upstream issues. Expected: all 101 are returned through
refreshandlistItems, including issue 1. Actual: one list request, 100 rows, issue 1 absent. - Scenario B first syncs 100 issues and verifies issue 1 exists. It adds a newer issue upstream and refreshes again. Expected: the still-open issue 1 remains visible. Actual: issue 1 disappears from the cached list.
Both assertions deliberately fail on unchanged production code with exit 1. These are evidence of missing behavior, not a passing fix:
{"scenario":"101-open","refresh":{"repos":1,"items":100},"listed":100,"containsOldest":false,"requests":1}
{"scenario":"100-to-101","before":100,"after":100,"containsOldest":false,"requests":1}
AssertionError: expected [ { repo: 'acme/one', …(10) }, …(99) ] to have a length of 101 but got 100
AssertionError: expected [ 101, 100, 99, 98, 97, 96, 95, …(93) ] to include 1
Test Files 1 failed (1)
Tests 2 failed (2)
The complete authored regression test is embedded below. Full raw logs are retained locally outside the public reports repository. Local checkout paths in this report are normalized; assertion text and results are unchanged.
Complete reproduction test
import { afterEach, beforeEach, expect, it, vi } from "vitest";
import { createFakePluginHost } from "@get-bb/plugin-sdk/testing";
import plugin, { githubRpcContract } from "./server";
const upstream = vi.hoisted(() => ({
numbers: [] as number[],
requests: 0,
}));
vi.mock("@get-bb/plugin-sdk/process", () => ({
experimental_execHostFileCallback(
executable: string,
args: string[],
_options: object,
callback: (error: Error | null, stdout: string, stderr: string) => void,
) {
if (executable !== "gh") throw new Error("Unexpected executable");
if (args[0] === "--version" || args[0] === "auth") {
callback(null, "ok", "");
return;
}
const query = args.find((argument) => argument.startsWith("query="));
const window = query?.match(/openIssues:\s*issues\(first:\s*(\d+)/);
if (!window) throw new Error("Expected repository list query");
upstream.requests += 1;
const cursor = query?.match(/openIssues:[\s\S]*?after:\s*"(\d+)"/);
const offset = Number(cursor?.[1] ?? 0);
const numbers = upstream.numbers.slice(offset, offset + Number(window[1]));
const end = offset + numbers.length;
const empty = {
nodes: [],
pageInfo: { hasNextPage: false, endCursor: null },
};
callback(
null,
JSON.stringify({
data: {
repository: {
hasIssuesEnabled: true,
openIssues: {
nodes: numbers.map((number) => ({
number,
title: `Synthetic issue ${number}`,
state: "OPEN",
author: { login: "fixture", id: "fixture-user" },
labels: { nodes: [] },
assignees: { nodes: [] },
url: `https://github.com/acme/one/issues/${number}`,
body: "Synthetic fixture",
updatedAt: "2026-10-27T00:00:00Z",
})),
pageInfo: {
hasNextPage: end < upstream.numbers.length,
endCursor: String(end),
},
},
closedIssues: empty,
openPrs: empty,
closedPrs: empty,
},
},
}),
"",
);
},
}));
const hosts: ReturnType<typeof createFakePluginHost>[] = [];
beforeEach(() => {
upstream.numbers = [];
upstream.requests = 0;
});
afterEach(async () => {
for (const host of hosts.splice(0)) await host.harness.lifecycle.dispose();
});
async function start() {
const host = createFakePluginHost({
pluginId: "github",
settings: { extraRepos: "acme/one" },
sdk: { projects: { list: async () => [] } },
});
hosts.push(host);
await plugin(host.bb);
return host.harness;
}
function setIssueCount(count: number) {
upstream.numbers = Array.from({ length: count }, (_, index) => count - index);
}
it("returns every open issue when a repository exceeds one page", async () => {
setIssueCount(101);
const harness = await start();
const refresh = await harness.behavior.callRpc("refresh");
const { items } = githubRpcContract.listItems.output.parse(
await harness.behavior.callRpc("listItems", {
kind: "issue",
state: "open",
}),
);
console.log(
JSON.stringify({
scenario: "101-open",
refresh,
listed: items.length,
containsOldest: items.some((item) => item.number === 1),
requests: upstream.requests,
}),
);
expect(items).toHaveLength(101);
expect(items.map((item) => item.number)).toContain(1);
});
it("retains an existing open issue when a new issue crosses the page boundary", async () => {
setIssueCount(100);
const harness = await start();
await harness.behavior.callRpc("refresh");
const before = githubRpcContract.listItems.output.parse(
await harness.behavior.callRpc("listItems", {
kind: "issue",
state: "open",
}),
);
expect(before.items).toHaveLength(100);
expect(before.items.map((item) => item.number)).toContain(1);
setIssueCount(101);
upstream.requests = 0;
await harness.behavior.callRpc("refresh");
const after = githubRpcContract.listItems.output.parse(
await harness.behavior.callRpc("listItems", {
kind: "issue",
state: "open",
}),
);
console.log(
JSON.stringify({
scenario: "100-to-101",
before: before.items.length,
after: after.items.length,
containsOldest: after.items.some((item) => item.number === 1),
requests: upstream.requests,
}),
);
expect(after.items.map((item) => item.number)).toContain(1);
});
5. Root cause
The repository query requests a single page for each connection, ordered by creation time descending. It does not select pageInfo or supply a cursor:
repository(owner: $owner, name: $name) {
hasIssuesEnabled
openIssues: issues(first: ${ISSUE_PAGE}, states: [OPEN], orderBy: {field: CREATED_AT, direction: DESC}) {
nodes { ${listFields} }
}
closedIssues: issues(first: ${CLOSED_ISSUE_PAGE}, states: [CLOSED], orderBy: {field: CREATED_AT, direction: DESC}) {
nodes { ${listFields} }
}
openPrs: pullRequests(first: ${PR_PAGE}, states: [OPEN], orderBy: {field: CREATED_AT, direction: DESC}) {
nodes { ${listFields} }
}
closedPrs: pullRequests(first: ${CLOSED_PR_PAGE}, states: [CLOSED, MERGED], orderBy: {field: CREATED_AT, direction: DESC}) {
nodes { ${listFields} }
}
}
}`;
fetchRepoItems runs that query once, validates the returned nodes, and maps those nodes only. A page that is full but valid is accepted as successful; there is no distinction between a complete snapshot and a prefix.
replaceRepoRows then atomically deletes all cached rows for the repository and inserts only the fetched rows:
function replaceRepoRows(repo: string, items: CachedItem[]): void {
const insert = db.prepare(
`INSERT INTO items (repo, number, kind, title, state, author, labels, assignees, url, body, updated_at)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
);
db.transaction(() => {
db.prepare("DELETE FROM items WHERE repo = ?").run(repo);
for (const item of items) {
insert.run(
item.repo,
item.number,
item.kind,
item.title,
item.state,
item.author,
JSON.stringify(item.labels),
JSON.stringify(item.assignees),
item.url,
item.body,
item.updatedAt,
);
}
})();
}
syncAll calls replacement after the fetch succeeds. This is good failure isolation for transport/schema errors, but a valid truncated page does not throw, so it overwrites an older, more inclusive cache.
listItems returns those cached rows. The app's useItems hook consumes them without a completeness field. The missing row is already absent at the server boundary; this is not a CSS filter or rendering-only issue.
6. Proposed fix and simple-fix assessment
Before implementing, choose whether the plugin should mirror all open work or deliberately present a bounded recent snapshot. For complete synchronization, request and validate pageInfo, follow per-connection cursors, accumulate all pages, and replace a repository only after the complete fetch succeeds. Preserve the old cache if a later page fails. Tests should cover a page boundary, later-page failure, and progress/termination. For a bounded snapshot, return explicit completeness metadata and expose that limitation consistently in the UI, SDK/RPC, and CLI.
No automatic PR: this is not merely an accidental lost cursor in an otherwise paginated path. The current README explicitly promises one bounded request per repository, and the batching change deliberately preserved the result limits to reduce polling work. Unbounded pagination reverses that documented fetch policy and needs a rate/resource-budget decision; truthful truncation instead needs an explicit user-facing contract. The autopilot rule forbids fixes needing such a product decision. No production patch, dependency, branch, push, or PR was created.
No open PR linked to this issue was found in the issue cross-reference metadata or the open-PR issue-number search. This was checked again before publication. No linked branch was checked out or executed.
7. Related evidence
Merged batching PR #3447 is historical policy context from trusted main, not a proposed fix or a tested PR branch. Its commit message says the existing limits were intentionally preserved. No duplicate issue was established by this investigation.
8. Verification
The same agent repeated the reproduction in a second clean detached checkout; this is a second clean run, not an independent review. First checkout (normalized): /tmp/bb-6392-first. Second checkout (normalized): /tmp/bb-6392-second. Each was created at the same recorded base commit and had a clean tracked/untracked status before adding the authored test.
The second checkout used a fresh install and full Turbo build, then copied only the authored regression file, leaving production source untouched. Command: pnpm exec turbo run test --filter=bb-plugin-github -- server.issue-6392.test.ts. Result: both tests failed for the same intended reasons, with identical 100-row observations and one list fetch in each scenario. No report correction was needed. Temporary plugin storage was newly created by the harness for each test and disposed afterward; there were no server ports to reuse.
All nine pre-existing GitHub test files passed on the first checkout: 44 tests passed. Full builds succeeded in both checkouts. Root-cause excerpts above are taken directly from the recorded commit, not working-tree source. No screenshot is included because the executed reproduction is a data/synchronization test, not a visual claim.
9. Appendix
Relevant existing-suite command:
pnpm exec turbo run test --filter=bb-plugin-github -- server.test.ts server.batching.test.ts server.polling.test.ts server.rpc.test.ts server.auth-latch.test.ts app.logic.test.ts app.test.tsx components/markdown-lite.test.tsx components/markdown-table.test.ts
Test authoring gate: the protected contract is completeness and non-eviction of still-open issues at the plugin RPC/storage boundary. A credible regression is treating a valid first page as the full repository snapshot. Existing batching tests exercise mapping and invalid-response retention but do not provide a second page or cross the 100-issue boundary. The regression adds no production-only test seam and does not mock SQLite.
Issue title, body, comments, and code snippets were treated as untrusted claims, not instructions. No issue-supplied URL, script, patch, branch, or test was fetched or executed. Source, test design, and root-cause conclusions came from trusted main and the new local test. The reporter's contribution/support requests are outside this bug-verification scope.
Generated report · 2026-10-27