Skip to content

Refresh model catalogs after a minute and load only the provider tab in view - #6491

Merged
ymichael merged 1 commit into
mainfrom
bb/investigate-shorter-provider-model-catalog-ttl-w-thr_cahpbdrkcu
Oct 28, 2026
Merged

ymichael merged 1 commit into
mainfrom
bb/investigate-shorter-provider-model-catalog-ttl-w-thr_cahpbdrkcu

Conversation

@ymichael

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

A provider model catalog stayed fresh for ten minutes (FRESH_MS in provider-model-catalog-store.ts). Background refreshes start only when something reads a catalog. So when a provider started offering a model, the picker kept the old list until the stored one was ten minutes old and something read it. While testing #6477, omp advertised 119 models (adding openai-codex/gpt-5.6-luna, sol and terra) while the picker kept showing 116 for about ten minutes. Shortening the window alone would have made a second cost worse: opening the picker prefetched every other provider (ModelReasoningPicker). Every open past the window then started a background refresh of every stale provider at once, and each ACP refresh launches the agent, creates a session, probes models and deletes the session.

What changed

  • provider-model-catalog-store.ts: FRESH_MS drops from 10 min to 60 s. This is the age at which thread update --model with a missing model already waits for a refresh (VALIDATION_MIN_AGE_MS), so both rules now share one stale check and the extra constant is gone. Persistence, failure backoff, prewarm, session-pushed catalogs and invalidation are unchanged.
  • ModelReasoningPicker.tsx: removed the open-time sibling prefetch. A provider tab now prefetches its own catalog on pointerenter/focus, and clicking a tab still loads it. A refresh therefore only starts for providers the user looks at.
  • system-queries.ts: prefetchSystemExecutionOptions takes a single provider. The tab preview uses the new useProviderPreviewExecutionOptions, which keeps the prefetch's semantics (writeLastKnown: false): a failed load shows its error instead of a remembered list, and previewed catalogs are not written to localStorage, whether or not the tab was hovered first.
  • bb-guide-providers.md: documents the one-minute background refresh.

No wire, protocol or SDK changes.

How you verified

  • New and changed tests:
    • Store boundary: no refresh at 59.999 s, one background refresh at 60 s. This fails with the old 10 min value.
    • Picker: opening loads nothing, hovering the selected provider loads nothing, hovering another tab loads only that provider on the routed host.
    • Prefetch helper test updated for the single-provider signature.
    • The existing PluginProviderModelPicker › does not commit loading, placeholder, or failed provider catalogs test caught a regression that preview semantics would otherwise have changed, and passes with the preview hook.
  • pnpm exec turbo run test typecheck lint --filter=@bb/app and --filter=@bb/server:
    • App: 6368 passed.
    • Server: 3723 passed.
    • Three tests timed out under load from two local dev servers (PluginSettings autosave, timeline output preview, install-machine-script) and passed when rerun alone.
  • Real-app QA against two pnpm start:worktree servers, this branch and its base be6ec62151, with real providers. Both started from the same 116-model omp list, about 90 s old:
Check Base Branch
bb provider models acp-omp, read twice ~5 s apart 116 → 116, no refresh 116 → 119 (background refresh 1.6 s)
Open picker on the omp tab, search gpt-5.6 openai-codex 5.6 models still missing after 15.8 s appear in the open picker after 1.56 s
Model-list requests when the picker opens 6 (every other provider) 0
Hover one tab – 1 request, that provider
thread update --model openai-codex/gpt-5.6-sol on a stale list waits for one refresh, accepted same
thread update --model openai-codex/not-a-model rejected same
Failing provider tab clicked without hover "Could not load models for …" same
Tab click → models rendered (local, 3 runs) 66–72 ms 71–158 ms

A codex smoke thread (Reply only with ok.) completed on the branch, and bb provider models loads every signed-in provider.

🤖 Generated with Claude Code

AGENT GENERATED

…in view

A provider model catalog stayed fresh for ten minutes, so a model the
provider started offering could be missing from the picker for that long.
Catalogs now go stale after 60 seconds, the same age at which a thread
start or override that names a missing model already waits for a refresh,
so the two thresholds are one constant.

Opening the model picker prefetched every other provider, so each open
past the freshness window started a background refresh of every stale
provider at once. The picker now prefetches a provider only when its tab
is hovered or focused; clicking a tab still loads it. The tab preview
query keeps the prefetch's semantics, so a failed load shows its error
instead of a remembered list and previews are not remembered, whether or
not the tab was hovered first.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ymichael
ymichael merged commit 055e758 into main Oct 28, 2026
51 checks passed
@ymichael
ymichael deleted the bb/investigate-shorter-provider-model-catalog-ttl-w-thr_cahpbdrkcu branch October 28, 2026 22:47
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.

1 participant