← reports

#7358 · UI preference failure message scope

Bug Priority: Low Effort: Low ui GitHub issue · 2026-11-10

Trusted main commit: 7c1353d80729983b86ea1555d18b42407f320406

Verdict: REPRODUCED · Root-cause confidence: high.

1. TL;DR

A failed save of a non-sidebar UI preference produces a notification naming the sidebar. All synced UI preferences share one error handler, but its title describes only a subset of those preferences. A focused behavioral regression reproduces this by rejecting the save for the information-panel collapsed sections, then observing the toast arguments. The same test fails for the same title mismatch in a second clean checkout. Changing only the shared title to name UI preferences fixes the mismatch without altering persistence, retry, or error deduplication.

2. Claims vs findings

ClaimFindingEvidence
Non-sidebar preference failures use sidebar-specific wording.VerifiedThe rejected information-panel write emits “Couldn’t sync sidebar preferences”; both clean runs fail the expected general-title assertion.
The synced key set covers the composer, information panel, and pinned thread context.VerifiedThe domain key list contains all three, and their UI modules use synced preference atoms.
Switching an AI provider in the new-thread composer is a direct reproduction.Not established; example requires clarificationcomposer.provider selects a plugin composer renderer, not an AI model provider. The production consumer is composerRendererProviderAtom; its settings control is labeled Composer. The reproduction instead uses the unambiguous information-panel key.
A physical offline browser produces the failure.Not separately exercisedThe test deterministically rejects the real sync coordinator's SDK write with Error("offline"). It proves error-message semantics, not browser networking.

3. Environment

4. Minimal reproduction

  1. Clone https://github.com/get-bb/bb.git and check out 7c1353d80729983b86ea1555d18b42407f320406.
  2. Install and build the trusted code:
    pnpm install --frozen-lockfile --prefer-offline
    pnpm exec turbo run build --filter=@get-bb/plugin-sdk
    pnpm exec turbo run build
  3. Open apps/app/src/lib/ui-preferences/ui-preferences-sync.test.ts. Replace its existing test named toasts once and invalidates the query on a non-conflict failure with the complete test block printed below. Keep the existing imports, mocks, fixtures, and other tests unchanged. Do not apply a production fix.
  4. Run the owning sync suite:
    pnpm exec turbo run test --filter=@bb/app -- src/lib/ui-preferences/ui-preferences-sync.test.ts

The changed behavioral test, using the existing file's real sync harness and SDK/toast boundary mocks:

it("toasts once for failed UI preference writes and invalidates the query", async () => {
  const { modeAtom, queryClient, store } = startSyncedHarness(
    serverResponse({
      "sidebar.organizationMode": { revision: 1, value: "project" },
    }),
  );
  const collapsedSectionsAtom = createSyncedPreferenceAtom(
    "infoPanel.collapsedSections",
  );
  const invalidate = vi.spyOn(queryClient, "invalidateQueries");
  mocks.set.mockRejectedValueOnce(new Error("offline"));
  store.set(collapsedSectionsAtom, ["commits"]);
  await waitForUiPreferenceWrites();
  mocks.set.mockRejectedValueOnce(new Error("offline"));
  store.set(modeAtom, "chronological");
  await waitForUiPreferenceWrites();
  expect(mocks.toastError).toHaveBeenCalledTimes(1);
  expect(mocks.toastError).toHaveBeenCalledWith(
    "Couldn’t sync UI preferences",
    { description: "offline" },
  );
  expect(invalidate).toHaveBeenCalledTimes(2);
  expect(store.get(collapsedSectionsAtom)).toEqual(["commits"]);
  expect(store.get(modeAtom)).toBe("chronological");
});

Expected and actual title mismatch, verbatim from the first test run:

-   "Couldn’t sync UI preferences",
+   "Couldn’t sync sidebar preferences",
    {
      "description": "offline",
    },

Test Files  1 failed (1)
     Tests  1 failed | 22 passed (23)

This is a text-contract reproduction, not a layout or rendering defect. No screenshot or live browser result is claimed. The coordinator, Jotai state updates, and query invalidation execute; only the external SDK response and toast sink are controlled.

5. Root cause

Synced preference atoms register any supported key and schedule a write after a local change. The domain key list is broader than the sidebar. A failed non-conflict SDK write propagates into the shared flush catch handler, which calls one deduplicated failure notifier:

appToast.error("Couldn’t sync sidebar preferences", {
  description:
    error instanceof Error ? error.message : "Changes stay on this device.",
});

The title is independent of the failed key, so a failed information-panel write necessarily receives the sidebar title. This is misleading copy in the owner of the error message, not a server, retry, authentication, or stored-data defect. Existing coverage checked one-toast deduplication, invalidation, and retained local values, but did not check the message title.

Composer clarification: the composer consumer resolves plugin composer replacements, and its settings control changes that renderer preference.

6. Proposed fix

Use “Couldn’t sync UI preferences” in the existing shared notifier. Extend the existing failure test to trigger a non-sidebar write first, then a sidebar write, and assert the title as well as existing deduplication, invalidation, and local-state behavior. This introduces no new API, schema, dependency, protocol, generated file, or product decision.

7. Related issues and pull requests

No linked open pull request was present in the issue timeline, and an open-PR search for the issue number returned no match during investigation. No other issue is required to explain this narrowly scoped defect.

8. Verification

The same agent repeated the reproduction in a second clean temporary clone, designated second-checkout, checked out at the exact same trusted commit. The production tree was unchanged; only the regression test was copied in. A fresh frozen install was followed by the identical Turbo test command. It failed on the same title mismatch: 1 failed, 22 passed. The second run was not an independent review. The report corrects the ambiguous AI-provider example instead of claiming to have verified it.

After the one-line production repair in the first clone, the full owning file passed: 23 passed. App lint and typecheck passed; lint reported 223 existing warnings and zero errors. The repair is 16 changed text lines across two files: 13 additions and three deletions.

9. Appendix

Repeated reproduction result, from the second clean run:

-   "Couldn’t sync UI preferences",
+   "Couldn’t sync sidebar preferences",
    {
      "description": "offline",
    },

Test Files  1 failed (1)
     Tests  1 failed | 22 passed (23)

Post-fix owning-suite output:

Test Files  1 passed (1)
     Tests  23 passed (23)

Formatting, static checks, and patch-size checks:

pnpm exec oxfmt apps/app/src/lib/ui-preferences/ui-preferences-sync.test.ts apps/app/src/lib/ui-preferences/ui-preferences-sync.ts
pnpm exec turbo run lint typecheck --filter=@bb/app
Found 223 warnings and 0 errors.
Tasks: 6 successful, 6 total

git diff --check
git diff --numstat origin/main
12  2  apps/app/src/lib/ui-preferences/ui-preferences-sync.test.ts
1   1  apps/app/src/lib/ui-preferences/ui-preferences-sync.ts

An initial combined test/lint/typecheck command incorrectly forwarded the test filename to typecheck; it was discarded and rerun as the separate successful commands documented above. Raw logs and full test artifacts remain in the local evidence backup rather than this public repository.

Trust boundary: issue text was treated only as untrusted claims. No supplied scripts, branches, patches, linked URLs, or instructions were executed. Production code came from the trusted repository's main branch; the regression was written from repository evidence.