#6349 · Canonical tab collisions block synchronization
Verdict: REPRODUCED · Root-cause confidence: high
1. TL;DR
Saved thread tabs can contain an old built-in tab alongside its current plugin-backed replacement. The app converts both entries to the same identifier, but keeps both entries. Its outgoing validation rejects that duplicate before making an SDK update, leaving the saved state unchanged and future writes blocked. The same normalization also affects local-tab migration. A small client-only fix keeps the first occurrence of each normalized identifier.
2. Claims vs findings
| Claim | Finding | Evidence |
|---|---|---|
| Mixed old/current built-in tabs can be stored. | Verified at contract boundary | The test parses mixed input with the real threadTabsSchema; identifiers are distinct before normalization. No live server/database experiment was needed or performed. |
| Normalization creates duplicate Diff identifiers. | Verified | Both clean runs produce an extra plugin-fixed:core:diff entry; Info behaves the same way. |
| Writes fail repeatedly. | Verified mechanism | The scheduled persistence and migration tests drain without invoking the SDK update. The unchanged saved aliases force normalization again on later writes. |
| The server rejects the outgoing sync. | Corrected | The client evaluates threadTabsSchema.parse before sdk.threads.tabs.update is called. Server validation uses the same contract, but this path fails on the client first. |
| The exact reported installation/version and visible toast were observed. | Unverified live UI | This is a real production-module unit reproduction on trusted main, not an inspection of the reporter's instance or a browser screenshot. |
3. Environment
- Public repository get-bb/bb; trusted origin/main commit
748a96524eddedbf58d5eb5bd139f1b8b5c4f536. - Linux 4.19.0-gvisor; Node v22.19.0; pnpm 9.15.0; repository bb-app version 0.47.1.
- Two separate fresh clones: first
source, secondverification, under one fresh temporary investigation directory. Both started with unchanged production code. - No running app, ports, provider sessions, database fixtures, credentials, or user runtime data were used. Ports and data directories: not applicable.
4. Minimal reproduction
- Clone the trusted repository and pin the base; install without changing dependencies; build the SDK and copy the authored regression test:
git clone https://github.com/get-bb/bb.git bb-6349 cd bb-6349 git checkout --detach 748a96524eddedbf58d5eb5bd139f1b8b5c4f536 pnpm install --frozen-lockfile --prefer-offline pnpm exec turbo run build --filter=@get-bb/plugin-sdk python3 - <<'EXTRACT' import html, re, urllib.request from pathlib import Path page = urllib.request.urlopen("https://get-bb.github.io/reports/issues/6349.html").read().decode() test = html.unescape(re.search(r'<pre id="regression-test">(.*?)</pre>', page, re.S).group(1)) Path("apps/app/src/lib/thread-tabs-sync.test.ts").write_text(test) EXTRACT pnpm exec turbo run test --filter=@bb/app -- src/lib/thread-tabs-sync.test.ts - The new cases construct synthetic legacy entries from repository-supported kinds and current tabs from repository factories. The pure cases run each alias order with neighboring browser tabs; the queued cases cover existing-server persistence and initial local migration.
- Expected: one canonical tab per identifier, valid outgoing tabs, successful migration/persistence and a subsequent browser-tab write. Actual on unchanged main:
Test Files 1 failed (1) Tests 4 failed | 14 passed (18)
The assertion diff includes the extra canonical Diff and Info entries. Both queued cases observe no SDK update.
Complete runnable test inline · First failure log · Second failure log. Per the reports repository policy, test code and evidence are inline rather than published as separate test/log artifacts.
Complete regression test and existing owner suite
import { openSecondaryPanelTabInState } from "@bb/client-core";
import { threadTabsSchema, type ThreadTab } from "@bb/server-contract";
import { QueryClient } from "@tanstack/react-query";
import { describe, expect, it, vi } from "vitest";
import { setCachedThreadTabs } from "@/hooks/cache-owners/thread-tabs-cache-owner";
import {
createBrowserFixedPanelTab,
createEmptyFixedPanelTabsState,
createGitDiffFixedPanelTab,
createNewTabFixedPanelTab,
createTerminalFixedPanelTab,
createThreadInfoFixedPanelTab,
type FixedPanelTab,
} from "./fixed-panel-tabs-state";
import { createPluginPageFixedPanelTab } from "./fixed-panel-tabs-state";
import {
areThreadTabListsEquivalent,
hasPendingThreadTabsWrite,
mergeThreadTabChanges,
reconcileFixedPanelTabsState,
resolveFixedPanelTabsHydration,
scheduleLocalThreadTabsMigration,
scheduleThreadTabsPersistence,
} from "./thread-tabs-sync";
const updateThreadTabs = vi.hoisted(() => vi.fn());
vi.mock("./sdk", async (importOriginal) => {
const actual = await importOriginal<typeof import("./sdk")>();
return {
...actual,
sdk: { threads: { tabs: { update: updateThreadTabs } } },
};
});
function browserTab(
id: string,
title: string,
): Extract<ThreadTab, { kind: "browser" }> {
return {
environmentId: null,
id: `browser:${id}:none`,
kind: "browser",
title,
url: `https://${id}.example.com`,
};
}
describe("thread tab synchronization", () => {
it.each([
["git-diff", createGitDiffFixedPanelTab()],
["thread-info", createThreadInfoFixedPanelTab()],
] as const)(
"collapses %s aliases in either order while preserving neighboring tabs",
(kind, canonical) => {
const first = browserTab("first", "First");
const last = browserTab("last", "Last");
const legacy: ThreadTab = { id: `legacy:${kind}`, kind };
for (const aliases of [
[canonical, legacy],
[legacy, canonical],
]) {
const saved = threadTabsSchema.parse([first, ...aliases, last]);
const merged = mergeThreadTabChanges(saved, [], []);
expect(merged).toEqual([first, canonical, last]);
expect(threadTabsSchema.safeParse(merged).success).toBe(true);
const restored = reconcileFixedPanelTabsState(
createEmptyFixedPanelTabsState(),
saved,
);
expect(restored.secondary.tabs).toEqual([first, canonical, last]);
}
},
);
it.each(["persist", "migrate"] as const)(
"%s writes mixed legacy and canonical tabs once without blocking later writes",
async (mode) => {
const queryClient = new QueryClient();
const threadId = `mixed-aliases-${mode}`;
const info = createThreadInfoFixedPanelTab();
const diff = createGitDiffFixedPanelTab();
const mixed: FixedPanelTab[] = [
info,
diff,
{ id: "legacy:diff", kind: "git-diff" },
{ id: "legacy:info", kind: "thread-info" },
];
const revision = mode === "persist" ? 7 : 0;
setCachedThreadTabs(queryClient, threadId, {
revision,
tabs: mode === "persist" ? threadTabsSchema.parse(mixed) : [],
});
updateThreadTabs.mockResolvedValue({
revision: revision + 1,
tabs: [info, diff],
});
if (mode === "persist") {
scheduleThreadTabsPersistence({
queryClient,
threadId,
previousTabs: [info, diff],
tabs: [info, diff],
});
} else {
scheduleLocalThreadTabsMigration({
queryClient,
threadId,
tabs: mixed,
});
}
await vi.waitFor(() =>
expect(hasPendingThreadTabsWrite(queryClient, threadId)).toBe(false),
);
expect(updateThreadTabs).toHaveBeenCalledWith({
threadId,
expectedRevision: revision,
tabs: [info, diff],
});
const added = browserTab("added", "Added");
updateThreadTabs.mockResolvedValue({
revision: revision + 2,
tabs: [info, diff, added],
});
scheduleThreadTabsPersistence({
queryClient,
threadId,
previousTabs: [info, diff],
tabs: [info, diff, added],
});
await vi.waitFor(() =>
expect(hasPendingThreadTabsWrite(queryClient, threadId)).toBe(false),
);
expect(updateThreadTabs).toHaveBeenCalledWith({
threadId,
expectedRevision: revision + 1,
tabs: [info, diff, added],
});
queryClient.clear();
},
);
it("converts server-saved Diff and Info tabs in place before reconciling selection", () => {
const current = createEmptyFixedPanelTabsState({
secondary: {
tabs: [
{
id: "plugin-fixed:core:diff",
kind: "plugin-fixed",
pluginId: "core",
tabId: "diff",
},
],
activeTabId: "plugin-fixed:core:diff",
isOpen: true,
},
});
const terminal = createTerminalFixedPanelTab({ terminalId: "saved" });
const restored = reconcileFixedPanelTabsState(current, [
terminal,
{ id: "git-diff:git-diff:none", kind: "git-diff" },
{ id: "thread-info:thread-info:none", kind: "thread-info" },
]);
expect(restored.secondary).toEqual({
isOpen: true,
activeTabId: "plugin-fixed:core:diff",
tabs: [
terminal,
{
id: "plugin-fixed:core:diff",
kind: "plugin-fixed",
pluginId: "core",
tabId: "diff",
},
{
id: "plugin-fixed:core:info",
kind: "plugin-fixed",
pluginId: "core",
tabId: "info",
},
],
});
});
it("preserves remote additions and edits when removing a local tab", () => {
const source = browserTab("source", "Source");
const updatedSource = { ...source, title: "Updated elsewhere" };
const detour = browserTab("detour", "Detour");
const remote = browserTab("remote", "Remote");
expect(
mergeThreadTabChanges(
[updatedSource, detour, remote],
[source, detour],
[source],
),
).toEqual([updatedSource, remote]);
});
it("inserts a replacement without restoring other remotely closed tabs", () => {
const source = browserTab("source", "Source");
const placeholder = browserTab("placeholder", "Placeholder");
const neighbor = browserTab("neighbor", "Neighbor");
const terminal = createTerminalFixedPanelTab({ terminalId: "replacement" });
expect(
mergeThreadTabChanges(
[placeholder, neighbor],
[source, placeholder, neighbor],
[source, terminal, neighbor],
),
).toEqual([terminal, neighbor]);
});
it("keeps the server's desktop window when saving a local page update", () => {
const closedWindow = {
hostId: "host-1",
instanceId: "closed-window",
generation: "g1",
};
const liveWindow = {
hostId: "host-1",
instanceId: "live-window",
generation: "g2",
};
const local = {
...browserTab("native", "Before"),
id: "native-tab",
desktopTarget: closedWindow,
};
const adopted = { ...local, desktopTarget: liveWindow };
expect(
mergeThreadTabChanges(
[adopted],
[local],
[{ ...local, title: "Reopened" }],
),
).toEqual([{ ...adopted, title: "Reopened" }]);
});
it("keeps remote ordering unless the local operation reorders tabs", () => {
const a = browserTab("a", "A");
const b = browserTab("b", "B");
const c = browserTab("c", "C");
const remote = browserTab("remote", "Remote");
expect(mergeThreadTabChanges([c, a, b], [a, b, c], [a, c])).toEqual([c, a]);
expect(
mergeThreadTabChanges([a, remote, b, c], [a, b, c], [c, a, b]),
).toEqual([c, remote, a, b]);
});
it("preserves local presentation state while adopting remote tabs", () => {
const first = browserTab("first", "First");
const second = browserTab("second", "Second");
const current = createEmptyFixedPanelTabsState({
lastUsedAt: 123,
secondary: {
activeTabId: first.id,
isOpen: true,
tabs: [first],
},
});
const withBoth = reconcileFixedPanelTabsState(current, [first, second]);
expect(withBoth).toMatchObject({
lastUsedAt: 123,
secondary: { activeTabId: first.id, isOpen: true },
});
expect(withBoth.secondary.tabs).toEqual([first, second]);
const withoutActive = reconcileFixedPanelTabsState(withBoth, [second]);
expect(withoutActive).toMatchObject({
lastUsedAt: 123,
secondary: { activeTabId: second.id, isOpen: true },
});
});
it("drops legacy native side-chat tabs persisted before their removal", () => {
const browser = browserTab("first", "First");
const legacySideChat: ThreadTab = {
id: "side-chat:legacy",
kind: "side-chat",
sourceMessageText: "anchor",
sourceSeqEnd: null,
threadId: "thr_legacy",
title: "Side chat",
};
const current = createEmptyFixedPanelTabsState({
lastUsedAt: 123,
secondary: { activeTabId: null, isOpen: true, tabs: [] },
});
const reconciled = reconcileFixedPanelTabsState(current, [
browser,
legacySideChat,
]);
expect(reconciled.secondary.tabs).toEqual([browser]);
});
it("keeps plugin page fixed tabs out of thread synchronization", () => {
const pageTab = createPluginPageFixedPanelTab({
fixedTabId: "navigation",
pageId: "tasks",
pluginId: "tasks",
});
expect(areThreadTabListsEquivalent([pageTab], [])).toBe(true);
});
});
it("returns to the prior terminal when another client removes the active terminal before its close callback", () => {
const source = createTerminalFixedPanelTab({ terminalId: "source" });
const detour = createTerminalFixedPanelTab({ terminalId: "detour" });
const state = openSecondaryPanelTabInState({
state: createEmptyFixedPanelTabsState({
secondary: {
tabs: [createThreadInfoFixedPanelTab(), source],
activeTabId: source.id,
isOpen: true,
},
}),
tab: detour,
});
const reconciled = reconcileFixedPanelTabsState(state, [
createThreadInfoFixedPanelTab(),
source,
]);
expect(reconciled.secondary.activeTabId).toBe(source.id);
});
it("does not restore a removed placeholder when a stale client closes a terminal", async () => {
const queryClient = new QueryClient();
const threadId = "stale-terminal-close";
const info = createThreadInfoFixedPanelTab();
const source = createTerminalFixedPanelTab({ terminalId: "source" });
const detour = createTerminalFixedPanelTab({ terminalId: "detour" });
const placeholder = createNewTabFixedPanelTab();
setCachedThreadTabs(queryClient, threadId, {
revision: 9,
tabs: [info, source, detour],
});
updateThreadTabs.mockResolvedValue({ revision: 10, tabs: [info, source] });
scheduleThreadTabsPersistence({
queryClient,
threadId,
previousTabs: [info, source, placeholder, detour],
tabs: [info, source, placeholder],
});
await vi.waitFor(() => {
expect(updateThreadTabs).toHaveBeenCalledWith({
expectedRevision: 9,
tabs: [info, source],
threadId,
});
});
});
describe("resolveFixedPanelTabsHydration", () => {
const localTab = createBrowserFixedPanelTab({
environmentId: null,
url: "https://local.example.com",
});
const remoteTab = createBrowserFixedPanelTab({
environmentId: null,
url: "https://remote.example.com",
});
const openWith = (tabs: FixedPanelTab[]) =>
createEmptyFixedPanelTabsState({
lastUsedAt: 123,
secondary: { activeTabId: tabs[0]?.id ?? null, isOpen: true, tabs },
});
it("migrates existing local tabs when the server has no tab row", () => {
const current = openWith([localTab]);
expect(
resolveFixedPanelTabsHydration({
current,
hasPendingWrite: false,
localTabs: current.secondary.tabs,
server: { revision: 0, tabs: [] },
}),
).toEqual({ kind: "migrate-local-tabs" });
});
it("adopts server tabs while keeping presentation state local", () => {
const current = openWith([createThreadInfoFixedPanelTab()]);
expect(
resolveFixedPanelTabsHydration({
current,
hasPendingWrite: false,
localTabs: current.secondary.tabs,
server: { revision: 4, tabs: [remoteTab] },
}),
).toEqual({
kind: "replace",
state: {
...current,
secondary: {
activeTabId: remoteTab.id,
isOpen: true,
tabs: [remoteTab],
},
},
});
});
it("closes an open thread panel when hydration leaves no tabs", () => {
const current = openWith([]);
expect(
resolveFixedPanelTabsHydration({
current,
hasPendingWrite: false,
localTabs: [],
server: { revision: 2, tabs: [] },
}),
).toEqual({
kind: "replace",
state: {
...current,
secondary: { activeTabId: null, isOpen: false, tabs: [] },
},
});
});
it("leaves a state the server already matches untouched so storage is not rewritten", () => {
const current = openWith([remoteTab]);
expect(
resolveFixedPanelTabsHydration({
current,
hasPendingWrite: false,
localTabs: current.secondary.tabs,
server: { revision: 4, tabs: [remoteTab] },
}),
).toBeNull();
});
});
5. Root cause
The shared app helper filters nonpersistent tabs, then maps old built-in kinds to plugin-fixed tabs without deduplicating the resulting identifiers. It feeds list equivalence, reconciliation, merge, and migration. Distinct input identifiers can therefore collide after mapping.
apps/app/src/lib/thread-tabs-sync.ts:48
function persistedThreadTabs(
tabs: readonly (FixedPanelTab | ThreadTab)[],
): readonly PersistedThreadFixedPanelTab[] {
return tabs
.filter(
(tab): tab is PersistedThreadFixedPanelTab =>
tab.kind !== "side-chat" && tab.kind !== "plugin-page-fixed",
)
.map((tab) =>
tab.kind === "git-diff"
? createGitDiffFixedPanelTab()
: tab.kind === "thread-info"
? createThreadInfoFixedPanelTab()
: tab,
);
The persistence path deliberately writes when legacy kinds are present. Its schema parse happens during argument evaluation, before the SDK call; migration has the same validation order.
apps/app/src/lib/thread-tabs-sync.ts:253
async function persistThreadTabs({
previousTabs,
tabs,
queryClient,
threadId,
}: PersistThreadTabsArgs): Promise<void> {
let current = await readCurrentThreadTabs({ queryClient, threadId });
for (let attempt = 1; attempt <= MAX_WRITE_ATTEMPTS; attempt++) {
const tabsToPersist = mergeThreadTabChanges(
current.tabs,
previousTabs,
tabs,
);
if (
!current.tabs.some(
(tab) => tab.kind === "git-diff" || tab.kind === "thread-info",
) &&
areThreadTabListsEquivalent(current.tabs, tabsToPersist)
) {
return;
}
try {
const response = await sdk.threads.tabs.update({
expectedRevision: current.revision,
tabs: threadTabsSchema.parse(tabsToPersist),
threadId,
});
setCachedThreadTabs(queryClient, threadId, response);
return;
} catch (error) {
if (!isThreadTabsConflict(error) || attempt === MAX_WRITE_ATTEMPTS) {
throw error;
}
current = await sdk.threads.tabs.get({ threadId });
setCachedThreadTabs(queryClient, threadId, current);
}
}
}
async function migrateLocalThreadTabs({
queryClient,
tabs,
threadId,
}: MigrateLocalThreadTabsArgs): Promise<void> {
const current = await readCurrentThreadTabs({ queryClient, threadId });
if (current.revision !== 0) {
return;
}
const tabsToPersist = persistedThreadTabs(tabs);
const response = await sdk.threads.tabs.update({
expectedRevision: 0,
tabs: threadTabsSchema.parse(tabsToPersist),
threadId,
});
setCachedThreadTabs(queryClient, threadId, response);
The contract checks uniqueness of the supplied raw identifiers, not logical equivalence across historical aliases. This admits the mixed original list and rejects the normalized duplicate list. Rejection prevents a successful update, so the original legacy state survives. This report does not change the public schema.
packages/server-contract/src/api/thread-tabs.ts:192
export const threadTabsSchema = z
.array(threadTabSchema)
.max(THREAD_TAB_LIST_MAX_LENGTH)
.superRefine((tabs, context) => {
if (JSON.stringify(tabs).length > THREAD_TABS_JSON_MAX_LENGTH) {
context.addIssue({
code: "custom",
message: "Thread tabs payload is too large",
});
}
const seenIds = new Set<string>();
for (const [index, tab] of tabs.entries()) {
if (seenIds.has(tab.id)) {
context.addIssue({
code: "custom",
message: `Duplicate tab id: ${tab.id}`,
path: [index, "id"],
});
}
seenIds.add(tab.id);
}
});
6. Proposed fix and local verification
After existing normalization, filter by identifier with a local Set, preserving the first occurrence and order of unrelated tabs. Keep the public contract, wire protocol, dependency graph, and database unchanged. This fixes every caller of the shared helper rather than adding retries or masking the validation error.
A local implementation changes two existing app subsystem files: 105 additions + 2 deletions = 107 changed text lines. Production: 7 additions + 1 deletion; tests: 98 additions + 1 deletion. The new tests fail first against unchanged main and pass after the fix.
pnpm exec turbo run test --filter=@bb/app -- src/lib/thread-tabs-sync.test.ts src/lib/fixed-panel-tabs-state.test.ts src/lib/fixed-panel-tabs-sync.test.ts src/lib/fixed-panel-tabs.plugin-terminal.test.ts Test Files 4 passed (4) Tests 57 passed (57) pnpm exec turbo run lint typecheck --filter=@bb/app Tasks: 6 successful, 6 total Lint: 246 warnings, 0 errors git diff --check exit 0
No new public UI, SDK, CLI, schema, daemon protocol, migration, or stored-data backfill is introduced.
7. Verification
The same agent repeated the reproduction in a second clean temporary clone at the exact recorded commit. Only the authored test file was copied; production code was not modified. A separate frozen install and SDK build preceded the exact Turbo test command above. Result: the same four failures and fourteen passes, including canonical Diff/Info collisions and both blocked write paths. This is a repeat run by the same agent, not independent-agent verification. The second run supported the final report; the causal description is corrected to say client-side validation fails before network update.
8. Related issues and pull requests
No open pull request referencing #6349 was found in issue cross-reference metadata or an open-PR search at investigation time. No duplicate issue covering this alias collision was found in the focused tab-sync search. This report does not claim to exhaust all historical tab bugs.
9. Appendix and limits
Issue text, links, and suggested commands were treated as untrusted evidence and were not executed or fetched. The regression input and fix were derived from trusted main's schema, factories, and synchronization code. No dependency was added, and no linked pull-request code was executed.
Preparation commands also included pnpm exec turbo run build. The initial fresh-clone build encountered a plugin/SDK build-order race (the GitHub plugin's SDK host output was not present yet); retrying the unchanged build succeeded: 72 tasks. The focused second-checkout preparation builds the SDK explicitly. This environment/setup issue is separate from the reproduced tab bug.
Other checks: git fetch origin main, git diff --numstat origin/main, pnpm exec oxfmt on the two changed files, and GitHub metadata reads for issue classification and open cross-references. These are synthetic unit-level repros using the real client normalizer and schema, an in-memory query cache, and a mocked SDK transport. They do not demonstrate a live HTTP response, actual user database contents, or rendered toast.
First clean-run failure output
• turbo 2.10.12
• Packages in scope: @bb/app
• Running test in 1 packages
• Remote caching disabled
@bb/templates:generate:templates: cache miss, executing fcdd019a2b9314b1
@bb/templates:generate:plugin-scaffold: cache miss, executing 73001e7690f64b9a
@bb/plugin-build:generate: cache miss, executing e5ff71367425f896
//:ensure-native-modules: cache bypass, force executing a6049ed59485c670
@bb/process-utils:generate:profile-worker: cache miss, executing ae0abf7092247ecb
@bb/templates:generate:templates:
@bb/templates:generate:templates: > @bb/templates@0.0.1 generate:templates <first-checkout>/packages/templates
@bb/templates:generate:templates: > node ./scripts/generate-templates.mjs
@bb/templates:generate:templates:
@bb/templates:generate:plugin-scaffold:
@bb/templates:generate:plugin-scaffold: > @bb/templates@0.0.1 generate:plugin-scaffold <first-checkout>/packages/templates
@bb/templates:generate:plugin-scaffold: > node ./scripts/generate-plugin-scaffold.mjs
@bb/templates:generate:plugin-scaffold:
@bb/plugin-build:generate:
@bb/plugin-build:generate: > @bb/plugin-build@0.0.1 generate <first-checkout>/packages/plugin-build
@bb/plugin-build:generate: > node ./scripts/generate-plugin-theme.mjs && node ./scripts/generate-runtime-export-manifest.mjs
@bb/plugin-build:generate:
@bb/process-utils:generate:profile-worker:
@bb/process-utils:generate:profile-worker: > @bb/process-utils@0.0.1 generate:profile-worker <first-checkout>/packages/process-utils
@bb/process-utils:generate:profile-worker: > node scripts/generate-profile-worker.mjs
@bb/process-utils:generate:profile-worker:
//:ensure-native-modules:
//:ensure-native-modules: > bb@ ensure-native-modules <first-checkout>
//:ensure-native-modules: > node scripts/ensure-native-modules.mjs
//:ensure-native-modules:
@bb/plugin-build:generate: plugin-theme.generated.ts up to date
//:ensure-native-modules: [ensure-native-modules] Detached hardlinked better-sqlite3 binary before verification
@bb/plugin-build:generate: wrote <first-checkout>/packages/plugin-build/src/generated/runtime-export-manifest.generated.ts (react@19.3.0)
@bb/app:test: cache miss, executing 15edf9ef7945f54d
@bb/app:test:
@bb/app:test: > @bb/app@0.0.1 test <first-checkout>/apps/app
@bb/app:test: > node scripts/generate-pwa-icons.mjs --check && vitest run --config vitest.config.ts "src/lib/thread-tabs-sync.test.ts"
@bb/app:test:
@bb/app:test:
@bb/app:test: RUN v4.1.1 <first-checkout>/apps/app
@bb/app:test:
@bb/app:test: ❯ |@bb/app:isolated| src/lib/thread-tabs-sync.test.ts (18 tests | 4 failed) 178ms
@bb/app:test: × collapses git-diff aliases in either order while preserving neighboring tabs 14ms
@bb/app:test: × collapses thread-info aliases in either order while preserving neighboring tabs 2ms
@bb/app:test: × persist writes mixed legacy and canonical tabs once without blocking later writes 53ms
@bb/app:test: × migrate writes mixed legacy and canonical tabs once without blocking later writes 52ms
@bb/app:test: ✓ converts server-saved Diff and Info tabs in place before reconciling selection 1ms
@bb/app:test: ✓ preserves remote additions and edits when removing a local tab 0ms
@bb/app:test: ✓ inserts a replacement without restoring other remotely closed tabs 0ms
@bb/app:test: ✓ keeps the server's desktop window when saving a local page update 0ms
@bb/app:test: ✓ keeps remote ordering unless the local operation reorders tabs 1ms
@bb/app:test: ✓ preserves local presentation state while adopting remote tabs 1ms
@bb/app:test: ✓ drops legacy native side-chat tabs persisted before their removal 0ms
@bb/app:test: ✓ keeps plugin page fixed tabs out of thread synchronization 0ms
@bb/app:test: ✓ returns to the prior terminal when another client removes the active terminal before its close callback 0ms
@bb/app:test: ✓ does not restore a removed placeholder when a stale client closes a terminal 51ms
@bb/app:test: ✓ migrates existing local tabs when the server has no tab row 0ms
@bb/app:test: ✓ adopts server tabs while keeping presentation state local 0ms
@bb/app:test: ✓ closes an open thread panel when hydration leaves no tabs 0ms
@bb/app:test: ✓ leaves a state the server already matches untouched so storage is not rewritten 0ms
@bb/app:test:
@bb/app:test: ⎯⎯⎯⎯⎯⎯⎯ Failed Tests 4 ⎯⎯⎯⎯⎯⎯⎯
@bb/app:test:
@bb/app:test: FAIL |@bb/app:isolated| src/lib/thread-tabs-sync.test.ts > thread tab synchronization > collapses git-diff aliases in either order while preserving neighboring tabs
@bb/app:test: AssertionError: expected [ { environmentId: null, …(4) }, …(3) ] to deeply equal [ { environmentId: null, …(4) }, …(2) ]
@bb/app:test:
@bb/app:test: - Expected
@bb/app:test: + Received
@bb/app:test:
@bb/app:test: @@ -11,10 +11,16 @@
@bb/app:test: "kind": "plugin-fixed",
@bb/app:test: "pluginId": "core",
@bb/app:test: "tabId": "diff",
@bb/app:test: },
@bb/app:test: {
@bb/app:test: + "id": "plugin-fixed:core:diff",
@bb/app:test: + "kind": "plugin-fixed",
@bb/app:test: + "pluginId": "core",
@bb/app:test: + "tabId": "diff",
@bb/app:test: + },
@bb/app:test: + {
@bb/app:test: "environmentId": null,
@bb/app:test: "id": "browser:last:none",
@bb/app:test: "kind": "browser",
@bb/app:test: "title": "Last",
@bb/app:test: "url": "https://last.example.com",
@bb/app:test:
@bb/app:test: ❯ src/lib/thread-tabs-sync.test.ts:65:24
@bb/app:test: 63| const saved = threadTabsSchema.parse([first, ...aliases, last]…
@bb/app:test: 64| const merged = mergeThreadTabChanges(saved, [], []);
@bb/app:test: 65| expect(merged).toEqual([first, canonical, last]);
@bb/app:test: | ^
@bb/app:test: 66| expect(threadTabsSchema.safeParse(merged).success).toBe(true);
@bb/app:test: 67| const restored = reconcileFixedPanelTabsState(
@bb/app:test:
@bb/app:test: ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/4]⎯
@bb/app:test:
@bb/app:test: FAIL |@bb/app:isolated| src/lib/thread-tabs-sync.test.ts > thread tab synchronization > collapses thread-info aliases in either order while preserving neighboring tabs
@bb/app:test: AssertionError: expected [ { environmentId: null, …(4) }, …(3) ] to deeply equal [ { environmentId: null, …(4) }, …(2) ]
@bb/app:test:
@bb/app:test: - Expected
@bb/app:test: + Received
@bb/app:test:
@bb/app:test: @@ -11,10 +11,16 @@
@bb/app:test: "kind": "plugin-fixed",
@bb/app:test: "pluginId": "core",
@bb/app:test: "tabId": "info",
@bb/app:test: },
@bb/app:test: {
@bb/app:test: + "id": "plugin-fixed:core:info",
@bb/app:test: + "kind": "plugin-fixed",
@bb/app:test: + "pluginId": "core",
@bb/app:test: + "tabId": "info",
@bb/app:test: + },
@bb/app:test: + {
@bb/app:test: "environmentId": null,
@bb/app:test: "id": "browser:last:none",
@bb/app:test: "kind": "browser",
@bb/app:test: "title": "Last",
@bb/app:test: "url": "https://last.example.com",
@bb/app:test:
@bb/app:test: ❯ src/lib/thread-tabs-sync.test.ts:65:24
@bb/app:test: 63| const saved = threadTabsSchema.parse([first, ...aliases, last]…
@bb/app:test: 64| const merged = mergeThreadTabChanges(saved, [], []);
@bb/app:test: 65| expect(merged).toEqual([first, canonical, last]);
@bb/app:test: | ^
@bb/app:test: 66| expect(threadTabsSchema.safeParse(merged).success).toBe(true);
@bb/app:test: 67| const restored = reconcileFixedPanelTabsState(
@bb/app:test:
@bb/app:test: ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[2/4]⎯
@bb/app:test:
@bb/app:test: FAIL |@bb/app:isolated| src/lib/thread-tabs-sync.test.ts > thread tab synchronization > persist writes mixed legacy and canonical tabs once without blocking later writes
@bb/app:test: FAIL |@bb/app:isolated| src/lib/thread-tabs-sync.test.ts > thread tab synchronization > migrate writes mixed legacy and canonical tabs once without blocking later writes
@bb/app:test: AssertionError: expected "vi.fn()" to be called with arguments: [ { …(3) } ]
@bb/app:test:
@bb/app:test: Number of calls: 0
@bb/app:test:
@bb/app:test: ❯ src/lib/thread-tabs-sync.test.ts:115:32
@bb/app:test: 113| expect(hasPendingThreadTabsWrite(queryClient, threadId)).toBe(…
@bb/app:test: 114| );
@bb/app:test: 115| expect(updateThreadTabs).toHaveBeenCalledWith({
@bb/app:test: | ^
@bb/app:test: 116| threadId,
@bb/app:test: 117| expectedRevision: revision,
@bb/app:test:
@bb/app:test: ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[3/4]⎯
@bb/app:test:
@bb/app:test:
@bb/app:test: Test Files 1 failed (1)
@bb/app:test: Tests 4 failed | 14 passed (18)
@bb/app:test: Start at 23:52:18
@bb/app:test: Duration 2.88s (transform 1.76s, setup 204ms, import 2.26s, tests 178ms, environment 0ms)
@bb/app:test:
@bb/app:test: ELIFECYCLE Test failed. See above for more details.
@bb/app#test: ERROR command (<first-checkout>/apps/app) /usr/local/bin/pnpm run test src/lib/thread-tabs-sync.test.ts exited (1)
Tasks: 5 successful, 6 total
Cached: 0 cached, 6 total
Time: 5.859s
Failed: @bb/app#test
ERROR run failed: command exited (1)
Second clean-run failure output
• turbo 2.10.12
• Packages in scope: @bb/app
• Running test in 1 packages
• Remote caching disabled
//:ensure-native-modules: cache bypass, force executing a6049ed59485c670
@bb/templates:generate:plugin-scaffold: cache miss, executing 73001e7690f64b9a
@bb/process-utils:generate:profile-worker: cache miss, executing ae0abf7092247ecb
@bb/plugin-build:generate: cache miss, executing e5ff71367425f896
@bb/templates:generate:templates: cache miss, executing fcdd019a2b9314b1
@bb/templates:generate:plugin-scaffold:
@bb/templates:generate:plugin-scaffold: > @bb/templates@0.0.1 generate:plugin-scaffold <second-checkout>/packages/templates
@bb/templates:generate:plugin-scaffold: > node ./scripts/generate-plugin-scaffold.mjs
@bb/templates:generate:plugin-scaffold:
@bb/process-utils:generate:profile-worker:
@bb/process-utils:generate:profile-worker: > @bb/process-utils@0.0.1 generate:profile-worker <second-checkout>/packages/process-utils
@bb/process-utils:generate:profile-worker: > node scripts/generate-profile-worker.mjs
@bb/process-utils:generate:profile-worker:
//:ensure-native-modules:
//:ensure-native-modules: > bb@ ensure-native-modules <second-checkout>
//:ensure-native-modules: > node scripts/ensure-native-modules.mjs
//:ensure-native-modules:
@bb/plugin-build:generate:
@bb/plugin-build:generate: > @bb/plugin-build@0.0.1 generate <second-checkout>/packages/plugin-build
@bb/plugin-build:generate: > node ./scripts/generate-plugin-theme.mjs && node ./scripts/generate-runtime-export-manifest.mjs
@bb/plugin-build:generate:
@bb/templates:generate:templates:
@bb/templates:generate:templates: > @bb/templates@0.0.1 generate:templates <second-checkout>/packages/templates
@bb/templates:generate:templates: > node ./scripts/generate-templates.mjs
@bb/templates:generate:templates:
//:ensure-native-modules: [ensure-native-modules] Detached hardlinked better-sqlite3 binary before verification
@bb/plugin-build:generate: plugin-theme.generated.ts up to date
@bb/plugin-build:generate: wrote <second-checkout>/packages/plugin-build/src/generated/runtime-export-manifest.generated.ts (react@19.3.0)
@bb/app:test: cache miss, executing 15edf9ef7945f54d
@bb/app:test:
@bb/app:test: > @bb/app@0.0.1 test <second-checkout>/apps/app
@bb/app:test: > node scripts/generate-pwa-icons.mjs --check && vitest run --config vitest.config.ts "src/lib/thread-tabs-sync.test.ts"
@bb/app:test:
@bb/app:test:
@bb/app:test: RUN v4.1.1 <second-checkout>/apps/app
@bb/app:test:
@bb/app:test: ❯ |@bb/app:isolated| src/lib/thread-tabs-sync.test.ts (18 tests | 4 failed) 181ms
@bb/app:test: × collapses git-diff aliases in either order while preserving neighboring tabs 14ms
@bb/app:test: × collapses thread-info aliases in either order while preserving neighboring tabs 3ms
@bb/app:test: × persist writes mixed legacy and canonical tabs once without blocking later writes 54ms
@bb/app:test: × migrate writes mixed legacy and canonical tabs once without blocking later writes 52ms
@bb/app:test: ✓ converts server-saved Diff and Info tabs in place before reconciling selection 1ms
@bb/app:test: ✓ preserves remote additions and edits when removing a local tab 0ms
@bb/app:test: ✓ inserts a replacement without restoring other remotely closed tabs 1ms
@bb/app:test: ✓ keeps the server's desktop window when saving a local page update 0ms
@bb/app:test: ✓ keeps remote ordering unless the local operation reorders tabs 1ms
@bb/app:test: ✓ preserves local presentation state while adopting remote tabs 1ms
@bb/app:test: ✓ drops legacy native side-chat tabs persisted before their removal 0ms
@bb/app:test: ✓ keeps plugin page fixed tabs out of thread synchronization 0ms
@bb/app:test: ✓ returns to the prior terminal when another client removes the active terminal before its close callback 0ms
@bb/app:test: ✓ does not restore a removed placeholder when a stale client closes a terminal 51ms
@bb/app:test: ✓ migrates existing local tabs when the server has no tab row 0ms
@bb/app:test: ✓ adopts server tabs while keeping presentation state local 0ms
@bb/app:test: ✓ closes an open thread panel when hydration leaves no tabs 0ms
@bb/app:test: ✓ leaves a state the server already matches untouched so storage is not rewritten 0ms
@bb/app:test:
@bb/app:test: ⎯⎯⎯⎯⎯⎯⎯ Failed Tests 4 ⎯⎯⎯⎯⎯⎯⎯
@bb/app:test:
@bb/app:test: FAIL |@bb/app:isolated| src/lib/thread-tabs-sync.test.ts > thread tab synchronization > collapses git-diff aliases in either order while preserving neighboring tabs
@bb/app:test: AssertionError: expected [ { environmentId: null, …(4) }, …(3) ] to deeply equal [ { environmentId: null, …(4) }, …(2) ]
@bb/app:test:
@bb/app:test: - Expected
@bb/app:test: + Received
@bb/app:test:
@bb/app:test: @@ -11,10 +11,16 @@
@bb/app:test: "kind": "plugin-fixed",
@bb/app:test: "pluginId": "core",
@bb/app:test: "tabId": "diff",
@bb/app:test: },
@bb/app:test: {
@bb/app:test: + "id": "plugin-fixed:core:diff",
@bb/app:test: + "kind": "plugin-fixed",
@bb/app:test: + "pluginId": "core",
@bb/app:test: + "tabId": "diff",
@bb/app:test: + },
@bb/app:test: + {
@bb/app:test: "environmentId": null,
@bb/app:test: "id": "browser:last:none",
@bb/app:test: "kind": "browser",
@bb/app:test: "title": "Last",
@bb/app:test: "url": "https://last.example.com",
@bb/app:test:
@bb/app:test: ❯ src/lib/thread-tabs-sync.test.ts:65:24
@bb/app:test: 63| const saved = threadTabsSchema.parse([first, ...aliases, last]…
@bb/app:test: 64| const merged = mergeThreadTabChanges(saved, [], []);
@bb/app:test: 65| expect(merged).toEqual([first, canonical, last]);
@bb/app:test: | ^
@bb/app:test: 66| expect(threadTabsSchema.safeParse(merged).success).toBe(true);
@bb/app:test: 67| const restored = reconcileFixedPanelTabsState(
@bb/app:test:
@bb/app:test: ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/4]⎯
@bb/app:test:
@bb/app:test: FAIL |@bb/app:isolated| src/lib/thread-tabs-sync.test.ts > thread tab synchronization > collapses thread-info aliases in either order while preserving neighboring tabs
@bb/app:test: AssertionError: expected [ { environmentId: null, …(4) }, …(3) ] to deeply equal [ { environmentId: null, …(4) }, …(2) ]
@bb/app:test:
@bb/app:test: - Expected
@bb/app:test: + Received
@bb/app:test:
@bb/app:test: @@ -11,10 +11,16 @@
@bb/app:test: "kind": "plugin-fixed",
@bb/app:test: "pluginId": "core",
@bb/app:test: "tabId": "info",
@bb/app:test: },
@bb/app:test: {
@bb/app:test: + "id": "plugin-fixed:core:info",
@bb/app:test: + "kind": "plugin-fixed",
@bb/app:test: + "pluginId": "core",
@bb/app:test: + "tabId": "info",
@bb/app:test: + },
@bb/app:test: + {
@bb/app:test: "environmentId": null,
@bb/app:test: "id": "browser:last:none",
@bb/app:test: "kind": "browser",
@bb/app:test: "title": "Last",
@bb/app:test: "url": "https://last.example.com",
@bb/app:test:
@bb/app:test: ❯ src/lib/thread-tabs-sync.test.ts:65:24
@bb/app:test: 63| const saved = threadTabsSchema.parse([first, ...aliases, last]…
@bb/app:test: 64| const merged = mergeThreadTabChanges(saved, [], []);
@bb/app:test: 65| expect(merged).toEqual([first, canonical, last]);
@bb/app:test: | ^
@bb/app:test: 66| expect(threadTabsSchema.safeParse(merged).success).toBe(true);
@bb/app:test: 67| const restored = reconcileFixedPanelTabsState(
@bb/app:test:
@bb/app:test: ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[2/4]⎯
@bb/app:test:
@bb/app:test: FAIL |@bb/app:isolated| src/lib/thread-tabs-sync.test.ts > thread tab synchronization > persist writes mixed legacy and canonical tabs once without blocking later writes
@bb/app:test: FAIL |@bb/app:isolated| src/lib/thread-tabs-sync.test.ts > thread tab synchronization > migrate writes mixed legacy and canonical tabs once without blocking later writes
@bb/app:test: AssertionError: expected "vi.fn()" to be called with arguments: [ { …(3) } ]
@bb/app:test:
@bb/app:test: Number of calls: 0
@bb/app:test:
@bb/app:test: ❯ src/lib/thread-tabs-sync.test.ts:115:32
@bb/app:test: 113| expect(hasPendingThreadTabsWrite(queryClient, threadId)).toBe(…
@bb/app:test: 114| );
@bb/app:test: 115| expect(updateThreadTabs).toHaveBeenCalledWith({
@bb/app:test: | ^
@bb/app:test: 116| threadId,
@bb/app:test: 117| expectedRevision: revision,
@bb/app:test:
@bb/app:test: ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[3/4]⎯
@bb/app:test:
@bb/app:test:
@bb/app:test: Test Files 1 failed (1)
@bb/app:test: Tests 4 failed | 14 passed (18)
@bb/app:test: Start at 23:52:03
@bb/app:test: Duration 3.03s (transform 1.85s, setup 198ms, import 2.42s, tests 181ms, environment 0ms)
@bb/app:test:
@bb/app:test: ELIFECYCLE Test failed. See above for more details.
@bb/app#test: ERROR command (<second-checkout>/apps/app) /usr/local/bin/pnpm run test src/lib/thread-tabs-sync.test.ts exited (1)
Tasks: 5 successful, 6 total
Cached: 0 cached, 6 total
Time: 6.31s
Failed: @bb/app#test
ERROR run failed: command exited (1)
Relevant passing suites
• turbo 2.10.12 • Packages in scope: @bb/app • Running test in 1 packages • Remote caching disabled //:ensure-native-modules: cache bypass, force executing 34fbf04d8bec83e5 @bb/process-utils:generate:profile-worker: cache miss, executing 2ea6228696926457 @bb/plugin-build:generate: cache miss, executing 0750018c47eea3d3 @bb/templates:generate:plugin-scaffold: cache miss, executing fba75627bb06b4c1 @bb/templates:generate:templates: cache miss, executing 4ec67969dd7a7f1b @bb/process-utils:generate:profile-worker: @bb/process-utils:generate:profile-worker: > @bb/process-utils@0.0.1 generate:profile-worker <first-checkout>/packages/process-utils @bb/process-utils:generate:profile-worker: > node scripts/generate-profile-worker.mjs @bb/process-utils:generate:profile-worker: @bb/plugin-build:generate: @bb/plugin-build:generate: > @bb/plugin-build@0.0.1 generate <first-checkout>/packages/plugin-build @bb/plugin-build:generate: > node ./scripts/generate-plugin-theme.mjs && node ./scripts/generate-runtime-export-manifest.mjs @bb/plugin-build:generate: //:ensure-native-modules: //:ensure-native-modules: > bb@ ensure-native-modules <first-checkout> //:ensure-native-modules: > node scripts/ensure-native-modules.mjs //:ensure-native-modules: @bb/templates:generate:plugin-scaffold: @bb/templates:generate:plugin-scaffold: > @bb/templates@0.0.1 generate:plugin-scaffold <first-checkout>/packages/templates @bb/templates:generate:plugin-scaffold: > node ./scripts/generate-plugin-scaffold.mjs @bb/templates:generate:plugin-scaffold: @bb/templates:generate:templates: @bb/templates:generate:templates: > @bb/templates@0.0.1 generate:templates <first-checkout>/packages/templates @bb/templates:generate:templates: > node ./scripts/generate-templates.mjs @bb/templates:generate:templates: @bb/plugin-build:generate: plugin-theme.generated.ts up to date @bb/plugin-build:generate: wrote <first-checkout>/packages/plugin-build/src/generated/runtime-export-manifest.generated.ts (react@19.3.0) @bb/app:test: cache miss, executing 982f9769bc5476c5 @bb/app:test: @bb/app:test: > @bb/app@0.0.1 test <first-checkout>/apps/app @bb/app:test: > node scripts/generate-pwa-icons.mjs --check && vitest run --config vitest.config.ts "src/lib/thread-tabs-sync.test.ts" "src/lib/fixed-panel-tabs-state.test.ts" "src/lib/fixed-panel-tabs-sync.test.ts" "src/lib/fixed-panel-tabs.plugin-terminal.test.ts" @bb/app:test: @bb/app:test: @bb/app:test: RUN v4.1.1 <first-checkout>/apps/app @bb/app:test: @bb/app:test: ✓ |@bb/app:isolated| src/lib/fixed-panel-tabs-state.test.ts (23 tests) 33ms @bb/app:test: ✓ |@bb/app:isolated| src/lib/thread-tabs-sync.test.ts (18 tests) 278ms @bb/app:test: ✓ |@bb/app| src/lib/fixed-panel-tabs.plugin-terminal.test.ts (3 tests) 6ms @bb/app:test: ✓ |@bb/app:isolated| src/lib/fixed-panel-tabs-sync.test.ts (13 tests) 547ms @bb/app:test: @bb/app:test: Test Files 4 passed (4) @bb/app:test: Tests 57 passed (57) @bb/app:test: Start at 23:53:10 @bb/app:test: Duration 5.76s (transform 11.04s, setup 1.17s, import 14.03s, tests 863ms, environment 1.04s) @bb/app:test: Tasks: 6 successful, 6 total Cached: 0 cached, 6 total Time: 8.761s