Skip to content

fix(tui): load the provider catalog only when a connect dialog opens - #53593

Closed
moritzWa wants to merge 1 commit into
anomalyco:devfrom
moritzWa:perf/tui-lazy-provider-catalog
Closed

moritzWa wants to merge 1 commit into
anomalyco:devfrom
moritzWa:perf/tui-lazy-provider-catalog

Conversation

@moritzWa

@moritzWa moritzWa commented Oct 6, 2026 •

Copy link
Copy Markdown

Issue for this PR

Closes #47677

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Bootstrap no longer fetches /provider. sync.providerCatalog() loads it into provider_next when needed, at most once per bootstrap, and each bootstrap marks it stale so the next dialog refetches for the current directory. createDialogProviderOptions calls it on mount, and the custom provider flow waits for it before checking whether the provider exists.

Nothing else reads provider_next. The prompt, model list and useConnected use config.providers, which bootstrap still loads.

In my build, over 24 session switches across directories, the blocking part of a directory reload went from a median 495 ms to 87 ms.

How did you verify your code works?

New test in sync.test.tsx: bootstrap makes no /provider request, two concurrent providerCatalog() calls make one request, and the next bootstrap makes it fetch again. TUI tests and typecheck pass. I also opened the connect dialog and model picker by hand in my build.

Screenshots / recordings

No visual change, except the first time a connect dialog opens its provider list can take a few hundred ms to appear.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

The full provider list (6.7 MB here, 227 providers and 8,452 models) is only read by the connect and model dialogs, but every bootstrap fetched and reconciled it.
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Hey! Your PR title perf(tui): load the provider catalog only when a connect dialog opens doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

@moritzWa moritzWa changed the title perf(tui): load the provider catalog only when a connect dialog opens fix(tui): load the provider catalog only when a connect dialog opens Oct 6, 2026
@moritzWa

moritzWa commented Oct 6, 2026

Copy link
Copy Markdown
Author

Overlaps #52816, which was opened first. The difference is that this one also loads the catalog for the model picker, whose "Popular providers" section reads it when nothing is connected yet. I'll close this one if #52816 picks that up.

@thdxr

thdxr commented Oct 10, 2026

Copy link
Copy Markdown
Member

This branch has been upgraded to V2. We're no longer taking PRs for V1. If you think this is still relevant, please port it over and open it for V2.

— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

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.

App bootstrap fetches the whole models.dev catalog from /provider on every start, once per project

2 participants