Skip to content

fix(tui): stop blocking first render on the full provider catalog - #53680

Open
Nowaker wants to merge 1 commit into
anomalyco:devfrom
Nowaker:tui-lazy-provider-list
Open

Nowaker wants to merge 1 commit into
anomalyco:devfrom
Nowaker:tui-lazy-provider-list

Conversation

@Nowaker

@Nowaker Nowaker commented Oct 7, 2026 •

Copy link
Copy Markdown

Issue for this PR

Closes #53679

Type of change

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

What does this PR do?

The TUI's blocking bootstrap waits on sdk.client.provider.list() (GET /provider) before it shows the prompt. That response is the entire models.dev catalog, 6.6 MB for an install with one connected provider, and the only reader of the resulting provider_next store is the connect dialog.

This moves that one request into the existing non-blocking group that runs after the prompt is shown. provider_next already starts with an empty value ({ all: [], default: {}, connected: [] }), so nothing reads undefined while it loads; the connect dialog opened in the first moment would list providers a beat later. Everything the prompt and model picker use comes from config.providers(), which stays blocking.

How did you verify your code works?

  • packages/tui typecheck, and test/app-lifecycle.test.tsx, test/runtime.test.tsx, test/context (7 pass).
  • Launch to a typable prompt with a compiled binary, measured by typing a unique token into the pane and timing until it is on screen. macOS M2 Pro, --pure, median (min-max) of 10 relaunches in ABBA order:
before after
home screen 2235 (2183-2277) ms 1976 (1928-2048) ms
3,906-message session 2575 (2523-2625) ms 2331 (2295-2421) ms
first launch on a fresh home 2592 ms 2146 ms
  • Opened /connect in a launched binary after startup: the full provider list (302.AI, Abacus, ...) is listed.

Screenshots / recordings

n/a, no visual change

Checklist

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

This PR is AI generated, but under direct supervision and on request of @Nowaker.

The blocking bootstrap waited for GET /provider, which returns every
models.dev provider and model: 6.6 MB, 226 providers and 8,405 models
for an install with one provider connected. Building and encoding it
costs the server worker 1.2 s warm (4.1 s on first call) on a loaded
host, and the TUI parses all of it before the prompt can appear.

Only the connect dialog reads provider_next, and the store already
starts with an empty value, so the request moves to the non-blocking
group that runs after the prompt is shown.

Launch to a typable prompt, compiled binary, macOS M2 Pro, median
(min-max) of 10 relaunches in ABBA order:

  home screen           2235 (2183-2277) ms -> 1976 (1928-2048) ms
  3,906-message session 2575 (2523-2625) ms -> 2331 (2295-2421) ms
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

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

@Nowaker
Nowaker force-pushed the tui-lazy-provider-list branch from 186f5c6 to 3c4a6b3 Compare October 7, 2026 11:13

This branch has not been deployed

No deployments
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.

TUI blocks its first render on the full 6.6 MB provider catalog

1 participant