Skip to content

Reload flashes: quiet plugin routes, remembered plugin chrome, last-known composer options - #1678

Merged
SawyerHood merged 17 commits into
get-bb:mainfrom
lnittman:bb/reload-flashes-host
Aug 19, 2026
Merged

SawyerHood merged 17 commits into
get-bb:mainfrom
lnittman:bb/reload-flashes-host

Conversation

@lnittman

@lnittman lnittman commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1676 (items 2 to 5; item 1 is the plugin PR).

Host-side last-known state so a reload paints what this profile last saw instead of neutral defaults that the live answers then replace:

  • A small last-known localStorage cache primitive (scoped versioned keys, zod-validated reads, reads and writes that never throw, stale versions pruned) shared by everything below.
  • Plugin panel routes stay quiet until plugin frontends have settled (initial boot resolved or failed, with a 15s fallback if system config never resolves); the "not available" copy shows only after a settled boot with no matching panel.
  • The host-owned chrome of the panels this profile last saw (plugin id, panel id, path, title, icon, never the component) paints first in the app header, the sidebar rows, and split-pane headers; live registrations replace it under the same keys, and the memory is rewritten on every change so a removed plugin does not come back as a ghost.
  • The composer's model-catalog placeholder is generalized from Claude Code to every provider (keyed by environment, host, provider, with a provider-level "latest" fallback for a routing never fetched to completion), and the host's provider list is replayed with it so a custom or installed ACP provider paints as itself; when the remembered provider is in no list the placeholder can vouch for, the composer waits as before. The placeholder ceiling is the most restrictive mode, so provisional data fails safe.
  • A thread's last server-resolved execution options replay as placeholderData; display uses the replay while submission and the permission controls keep waiting for the verified resolution (isPlaceholderData counts as loading in both composers).
  • The sidebar navigation replays the last bootstrap this profile received (validated against the wire schema on read, written only from a successful fetch), so the rail paints its remembered projects and threads instead of the two-row loading skeleton; the cache primitive's version prune learned to spare a zero-scope entry, which had been deleting exactly that replay on every load.

Client only (apps/app); no plugin API surface, no wire changes. The raw boot budget is raised by 4 KB: the sidebar replay adds about a hundred bytes to the boot path and the ratchet had zero raw headroom left (1667.1 KB against 1667.0 KB, brotli still under budget), so this keeps the guard about barrel regressions rather than byte noise.

AGENT GENERATED: by Claude Fable 5

@lnittman lnittman changed the title Paint plugin panel chrome and composer options from last-known state on reload Reload flashes: quiet plugin routes, remembered plugin chrome, last-known composer options Aug 16, 2026
@bb-slop-cop

bb-slop-cop Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

🚨 SLOP COP 🚨 · review

I am the Slop Cop. I started the security, code quality, performance, architecture, and product checks.

readCachedModelCatalog(cacheKey) ??
(providerCacheKey === null
? null
: readCachedModelCatalog(providerCacheKey));

@bb-slop-cop bb-slop-cop Bot Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 slopcop/review — Do not reuse models across hosts or workspaces

This fallback ignores both environmentId and hostId. The model endpoint uses the environment path as cwd, and hosts can have different account access.

After host A warms this cache, host B gets A's models before its own probe resolves. Placeholder data makes isLoading false, so new-thread submission can use an invalid model.

Please replay only exact routing keys. When the route is unknown, wait for it or cache a pointer without copying its catalog.

}, [resolved]);
useEffect(() => {
const timeout = window.setTimeout(
markPluginFrontendsSettled,

@bb-slop-cop bb-slop-cop Bot Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 slopcop/review — Do not finish a plugin boot while it remains active

This timer marks frontends settled even when the boot has started and remains active. Content scripts can take ten seconds each and mount in sequence.

At 15 seconds, slow valid panels show as unavailable. The settled effect also writes a partial or empty list over remembered chrome.

Track the not-started, booting, and complete states separately. Use the timeout only for the no-start display, and persist chrome after boot completes.

queryFn: ({ signal }) => fetchSidebarNavigation(signal),
queryFn: async ({ signal }) => {
const response = await fetchSidebarNavigation(signal);
writeCachedSidebarBootstrap(SIDEBAR_BOOTSTRAP_CACHE_KEY, response);

@bb-slop-cop bb-slop-cop Bot Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 slopcop/review — Keep the synchronous sidebar cache bounded

This response contains every unarchived thread, without a size limit. setItem serializes the full response synchronously after the network response was parsed.

A reload also parses and validates the full copy. Large supported profiles can block the main thread and exceed storage quota after this work occurs.

Cache a bounded chrome projection and read it once per page. The live response can replace the limited placeholder.

@bb-slop-cop bb-slop-cop Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 SLOP COP 🚨 · review

Plain-English summary: This PR remembers recent interface data. Reloads show that data first, then replace it with current server data.

I found three issues:

  1. High: The global model fallback crosses host and environment boundaries. A new-thread composer can submit a model from another route.
  2. Medium: The 15-second timer can finish an active plugin boot. It can show false errors and remove valid remembered chrome.
  3. Medium: The app synchronously stores the full, unbounded sidebar response. Large profiles can block reloads and exceed browser storage limits.

I found no security defect. The new cache helper removes useful duplication. The small cache-specific modules do not need another refactor.

The PR also has eight conflicts with current main. Current main removed @bb/agent-providers, so the model-cache work needs an architecture update during the rebase.

Verification:

  • The app type check passed.
  • The seven focused test files passed all 67 tests.
  • A browser smoke test loaded the root route and created the new cache entries.
  • The dev compiler delayed reload startup, so I could not make a reliable visual timing claim.
  • The complete app suite ended with exit 137 during shared process pressure.

I used a comment-only review. I did not approve the PR or request changes.

A small shared shape for caches that replay the last verified answer on the
next mount: scoped, versioned keys; every read validated against the cache's
zod schema; reads and writes that never throw (a full store or a restricted
browser, including a SecurityError on localStorage itself, degrades to "no
cache" instead of turning a successful fetch into a query error or a render
into a failure); entries from other versions pruned on first use.
…booted

On a reload or deep link, /plugins/:pluginId/:panelPath renders before plugin
registrations arrive, so PluginPanelView showed "This plugin panel is not
available. The plugin may still be loading, or it has been disabled or
removed." for a few hundred milliseconds on every load of a plugin page.

- Track whether the page's plugin frontends have settled (boot resolved or
  failed) in a small external store; the lazy boot marks it either way.
- PluginPanelView renders an empty shell for an unknown panel until then, and
  only a settled boot with no matching panel shows the not-available message.
…ever resolves

The quiet-until-booted panel state has no end if the boot never starts (it
waits on system config), so a backend outage would leave a plugin route
blank forever. Mark frontends settled after a floor so a missing panel can
say so; a later boot still registers panels normally.
Plugin registrations arrive after first paint, so on a reload the header
title, the sidebar's plugin rows, and split-pane titles for plugin panels drew
empty and then popped in once frontends booted.

Remember the host-owned chrome of the panels this profile last saw (plugin
id, panel id, path, title, icon, never the component) and paint it first;
live registrations replace it under the same keys, so a matching plugin
reconciles in place with no remount. After frontends settle only live
registrations remain, and the memory is rewritten on every change so a
removed plugin does not return as a ghost. One hook feeds all three surfaces
(app header, sidebar rows, split-pane header); PluginPanelHeaderCenter now
takes chrome rather than a full registration.
The composer showed "Loading models…" for 3-5s on every full load because
system execution options are only cached in memory, and the localStorage
placeholder catalog that hides that wait was wired for Claude Code alone.

- Generalize the catalog cache: keyed by environment, host, and provider;
  written for any provider's verified response; served as placeholderData for
  every provider. Claude Code keeps its curated fallback on a cold cache;
  other providers still wait for the probe when nothing was recorded.
- Rename claude-model-catalog-cache to model-catalog-cache to match.

Consumers already treat placeholder rows as provisional (recovery gated on
isPlaceholderData, ceiling ignored), so nothing downstream changes.
…ve resolution

In a thread, the composer's model, reasoning level, service tier, and
permission mode come from the thread default-execution-options query. Until it
resolves the hook falls back to neutral defaults, so a full page load showed
e.g. reasoning "Medium" and then snapped to the thread's real "Extra High"
once the query landed, a gap the model-catalog placeholder now makes visible.

- Remember each thread's last resolved options (validated against
  resolvedThreadExecutionOptionsSchema on read) and replay them as
  placeholderData; null resolutions are not remembered.
- Display uses the replay; submission and the permission controls keep waiting
  for the verified resolution (isPlaceholderData counts as loading in both the
  thread prompt area and the embedded chat).
Both caches wrote through an unguarded localStorage.setItem inside their
query functions, so a QuotaExceededError (unbounded per-thread keys over
time, restrictive privacy modes) would have rejected a successful fetch. Move
them onto the last-known cache primitive: writes never throw, other versions
are pruned, reads stay schema-validated.

Also make the placeholder catalog's permission ceiling the most restrictive
mode instead of "full": consumers ignore it while data is provisional, so
this changes nothing today, but a replay must fail safe for any future reader
that forgets that gate. Document why the thread cache is keyed by thread id
alone (ULIDs are globally unique; the resolved options carry host/provider).
…est catalog

A thread composer can mount before its environment is known, so its first
execution-options key (no environment, no host) is superseded before that
fetch completes and is never cached: every cold thread load showed
"Loading models..." for that frame despite a warm cache for the routed key.

Record each verified catalog under a provider-level key as well and use it as
the placeholder when the routed key has no entry. It is a provisional stand-in
like every replay here: consumers keep gating recovery and the ceiling on
isPlaceholderData, and the live probe replaces it.
…eholder

The placeholder generalized the model catalog to every provider but kept
replaying only the built-in provider list, while the live list also carries
the host's custom and installed ACP agents. A composer remembering one of
those providers therefore selected the first built-in provider for the
placeholder frame and snapped to the real one when the response landed; the
provider picker also grew by those rows on every full load.

The last provider list each routing (environment, host) returned is now kept
in its own last-known cache and replayed with the catalog. When the
remembered provider is in no list the placeholder can vouch for (a cold or
cleared provider cache), the placeholder is withheld and the composer waits
as it did before, rather than painting a wrong provider. Covered by a custom
provider replay test and a withheld-placeholder test.
Every full load started the sidebar-bootstrap query from an empty cache, so
the rail showed its two-row loading skeleton on every visit (and every
surface reading project names from the shared cache started blank) until
the response landed.

The last bootstrap this profile received is now kept in the last-known
cache (validated against the wire schema on read, one entry per origin,
written only from a successful fetch) and replayed as placeholder data, so
the rail paints the projects and threads this browser last saw and the live
response replaces them in place. Rows are navigation, so a stale row
degrades to an in-page load failure at worst; a cold profile has nothing to
replay and keeps today's skeleton, and the connection-aware unavailable
state still applies there.
…rsion prune

A cache with no routing dimensions (the sidebar bootstrap) stores under the
bare version key, "prefix.version". The version prune kept only keys under
"prefix.version." with the trailing dot, so each fresh page load deleted the
cache's own entry before its first read: the replay vanished on every visit
and the value was rewritten after the fetch, endlessly. Scoped caches never
hit this because their keys always carry a segment after the version.

The prune now spares the exact zero-scope key. Covered by a fresh-instance
test (a second createLastKnownCache simulates the next page load's prune),
which fails against the old prune.
The sidebar bootstrap replay adds about a hundred bytes to the boot path
(the cache module and its placeholder wiring; the wire schema was already
there), and the raw ratchet had zero headroom left: 1667.1 KB against
1667.0 KB, while brotli stays under its budget. Raise maxBootBytes by 4 KB
so the guard keeps catching barrel regressions rather than paying-down
noise; per the budget's own doc, the reason rides in the pull request.
@SawyerHood
SawyerHood force-pushed the bb/reload-flashes-host branch from 28174db to d40eaed Compare August 19, 2026 21:13
SawyerHood and others added 3 commits August 19, 2026 21:44
The execution-options placeholder fell back to a provider-level "latest"
catalog keyed by provider alone, so a composer on host B or environment
B could paint (and, since placeholder data is not loading, submit) models
that only host A or environment A had ever reported. Only the exact
environment/host/provider key replays now; a routing that was never
fetched to completion keeps the built-in identity with no rows and
waits for its own probe.

Co-Authored-By: Claude <[email protected]>
The 15 s floor marked plugin frontends settled unconditionally, so a
slow valid boot (content scripts mount in sequence and can take seconds
each) reported its panels as unavailable and the remember-chrome effect
wrote a partial or empty list over valid remembered chrome.

Track idle / booting / complete separately: the floor only settles a
boot that never started, an in-flight boot settles itself when it
finishes, and remembered chrome is persisted only after the boot has
actually completed.

Co-Authored-By: Claude <[email protected]>
…tical path

The full bootstrap (every unarchived thread of every project) was
serialized to localStorage synchronously in the query function and
re-parsed and validated on every placeholder evaluation. Cap each
project's stored thread list, schedule the write on idle (setTimeout
fallback, quota failures swallowed by the cache primitive), and read the
replay once per page load.

Co-Authored-By: Claude <[email protected]>
@SawyerHood

Copy link
Copy Markdown
Collaborator

Pushed three commits addressing the SlopCop review (9c269d5, 5d62331, 6aefc2f):

  1. Model catalog crosses host/environment boundaries (high) — removed the provider-level "latest" catalog key. The execution-options placeholder now replays a remembered catalog only for the exact environment/host/provider routing it was observed on; a routing that was never fetched to completion keeps the built-in provider identity with no model rows and waits for its own probe. Tests: cross-environment and cross-host replays now assert an empty model list (system-queries.test.tsx).

  2. Settle floor finishing an active boot (medium) — plugin-frontend-boot-state now tracks idle | booting | complete. bootPluginFrontends marks the boot started; the 15 s floor only settles a boot that never started and an in-flight boot settles itself when it finishes. Remembered nav-panel chrome is persisted only once the boot has actually completed (usePluginFrontendBootComplete), so neither the floor nor a partially mounted boot can overwrite valid remembered chrome. Tests: floor elapsing during an in-flight boot stays unsettled; chrome is not rewritten on floor/partial boot.

  3. Unbounded synchronous sidebar snapshot (medium) — the stored bootstrap keeps projects whole (consumers resolve the current project by id from the replay) but caps each project's thread list at 30; the write is scheduled via requestIdleCallback (with a setTimeout fallback) instead of inline in the query function, quota/storage failures are swallowed by the cache primitive, and the replay is read/validated once per page load rather than on every placeholder evaluation. Tests: bounded storage, deferred write, and a rejected setItem leaving the fetch successful.

Verified: turbo typecheck --filter=@bb/app, the 8 touched/related @bb/app test files (82 tests), turbo build --filter=@bb/app + check-bundle-budget.mjs (OK), eslint/prettier on changed files.

AGENT GENERATED: by Claude Opus 5

A replayed sidebar bootstrap is a snapshot from the last page load and may
not know a project created since. The composer demoted that project to
the personal project and reported the bootstrap as settled, so a submit in
that window created the thread in the wrong project. Treat the replay as
settled only when it already knows the requested project; otherwise hold
the candidate (picker loading, submit blocked) until the live response.

Co-Authored-By: Claude <[email protected]>
@SawyerHood

Copy link
Copy Markdown
Collaborator

Follow-up to the SlopCop fixes: 16e7929 keeps an unknown requested project held (picker loading, submit blocked) while the replayed sidebar bootstrap is placeholder data, instead of demoting it to the personal project. A test covers the replay-then-live path.

AGENT GENERATED: by Claude Opus 5

The bounded copy is built inside the query function. A response the
bounding code cannot handle threw there and failed the whole bootstrap
(seen in MachinesSettingsSection tests that stub a partial response).
The cache is best-effort, so swallow bounding errors and skip the write.

Co-Authored-By: Claude <[email protected]>
@SawyerHood
SawyerHood merged commit 1654d0f into get-bb:main Aug 19, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reload flashes: Tasks empty state, plugin route chrome, composer model and reasoning

3 participants