Skip to content

refactor(provider): prepare live model catalogs for per-account lists - #1581

Merged
bwachman merged 4 commits into
mainfrom
cl-11727-prepare-bounded-catalogs-for-the-live-chatgpt-catalog
Nov 3, 2026
Merged

bwachman merged 4 commits into
mainfrom
cl-11727-prepare-bounded-catalogs-for-the-live-chatgpt-catalog

Conversation

@bwachman

Copy link
Copy Markdown
Contributor

Summary

  • A bounded model catalog takes its request and response parser as inputs, so a catalog that authenticates or reads a different response shape reuses the snapshot, in-flight dedupe and bounded read. An OAuth projection chooses its models per profile. The live ChatGPT catalog builds on both.
  • When a live catalog keeps its fallback, the log says why: an empty or malformed catalog warns, and a connection that drops or times out logs at debug.
  • After an OpenCode Go or Zen prefetch settles, the rebuilt catalog keeps the live model selection, so a model switched during the rebuild gets its own context window.

Verification

  • bun run check and bun run test pass.

Part of CL-11727

An authenticated catalog with a different response shape can then reuse
the snapshot, in-flight dedupe and bounded read instead of copying them.
The "models" discovery state is now a non-empty tuple and the catalog is
generic over its seed, so a catalog seeded with a non-empty list always
yields a non-empty one without a cast.
The startup refresh after an OpenCode Go or Zen prefetch rebuilt the
catalog without the live selection, so a model switched during that
rebuild kept the previous model's context window. All four prefetch
refresh sites now share one helper that passes it, as the connect path
already did.
A connection that drops or times out mid-body now counts as unavailable
rather than malformed, so routine network trouble stays at debug while
an empty or malformed catalog warns.
@linear-code

linear-code Bot commented Oct 29, 2026

Copy link
Copy Markdown

CL-11727

@corbits-triage

corbits-triage Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Triage: Pass

No changes needed from you. A maintainer will review this pull request.

Notes:

  • added code matches a code pattern: src/tui/runner/catalog-refresh.ts:27-57 promise-chain: Promise chain; use async/await with try/catch., src/tui/runner/catalog-refresh.ts:27-56 promise-chain: Promise chain; use async/await with try/catch., src/tui/runner/settings.ts:289-387 iife: Immediately invoked function; name the function., src/tui/runner/settings.ts:289-387 promise-chain: Promise chain; use async/await with try/catch.

@bwachman

Copy link
Copy Markdown
Contributor Author

Stack merge order: #1580 → #1581 → #1579. This repo keeps merged branches, so GitHub does not retarget the next PR on its own:

  1. After fix(auth): drop the models retired for ChatGPT sign-in #1580 merges: gh pr edit 1581 --base main
  2. After refactor(provider): prepare live model catalogs for per-account lists #1581 merges: gh pr edit 1579 --base main

@TheGreatAxios TheGreatAxios left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Review · Approve

This change gets model lists ready for one list per signed-in account, instead of a single shared list.

Fetching a provider's models and reading the response are now arguments, so a later ChatGPT list can reuse the same cache instead of copying it. Each signed-in profile picks its own models. If a fetch fails, the log says whether the catalog was empty or the connection dropped. Refreshing an OpenCode Go or Zen list no longer forgets the model you just switched to, so that model keeps the right context window.

Checked against the parent branch (#1580) only. No problems in this slice.

@TheGreatAxios TheGreatAxios left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Review · Approve

A bounded catalog takes its request and parser as inputs, an OAuth projection chooses models per profile, and a settled prefetch keeps the live model selection.

Findings

No findings.

@TheGreatAxios TheGreatAxios left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Review · Comment

Planner: the injected request and parser, the per-profile models callback, and the shared prefetch refresh fit a later authenticated, per-account catalog without widening those seams.

Findings

No findings.

@bwachman
bwachman changed the base branch from cl-11727-fix-the-built-in-chatgpt-model-list to main November 3, 2026 00:45
@bwachman
bwachman merged commit d5d6f42 into main Nov 3, 2026
14 checks passed
@bwachman
bwachman deleted the cl-11727-prepare-bounded-catalogs-for-the-live-chatgpt-catalog branch November 3, 2026 00:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants