Skip to content

Centralize provider model catalog discovery and refresh across BB - #7389

Closed
csells wants to merge 1 commit into
get-bb:mainfrom
csells:fix/pooled-claude-model-catalog
Closed

csells wants to merge 1 commit into
get-bb:mainfrom
csells:fix/pooled-claude-model-catalog

Conversation

@csells

@csells csells commented Nov 10, 2026 •

Copy link
Copy Markdown

Human comments

What was wrong

Model discovery could disagree with execution and with other BB surfaces. Claude, Pi, and ACP discovery could omit contributed routing credentials; provider-local caches concealed fresh upstream catalogs; Codex read only the first model page. CLI reads could return an old catalog while a background refresh ran, open UI queries did not periodically revalidate, and session catalog events could overwrite shared discovery using an older credential context. Pooled Claude's missing Fable 5.2 in #7329 is one instance of these gaps.

What changed

Review note: GitHub froze this closed PR at its earlier head. The complete current implementation is in this comparison. The fork branch is updated; a maintainer must approve the contributor and reopen the PR before its Files changed view can track that branch.

  • Extend the existing server catalog authority across UI, CLI, SDK, internal validation, and core/plugin pickers. Keep provider/host/workspace/routing scope, deduplicate concurrent refreshes, expose discovered revision/time/staleness, and surface transient refresh failures alongside retained models.
  • Add bb provider models --refresh, --catalog, SDK refresh: true, and a shared picker Refresh models control. Preserve existing --json array output. Active UI queries revalidate every minute and subscribe to catalog changes; ordinary CLI/SDK reads wait when the catalog is stale. Preserve project routing for previews and refresh.
  • Make Claude, Codex, Pi, and ACP discovery honor the common contract. Pass execution credentials into discovery and Pi model resolution, remove hidden catalog freshness caches, enumerate Codex pages with cursor/deadline protection, and use the authenticated pool endpoint to discover newly exposed Claude models. Incomplete discovery reports failure instead of publishing a partial list.
  • Treat session catalog events as invalidation hints, then rediscover through the authoritative provider path. Keep custom and selected-only model behavior. Update CLI guidance, provider contract documentation, and the Plugin Guide.

The HTTP API gains an optional query and optional snapshot metadata; existing host-daemon wire fields are unchanged. This uses the existing bridge request contract, so no daemon protocol bump is needed. Includes upstream main ba05ae88ede3d3eba9e1aedf0713d79339d2d229.

New IDs exposed by a provider do not require a BB allowlist update. Upstream runtimes may still cache or bundle their own inventory. Without upstream push, active UI discovery can take the one-minute cache window plus the next one-minute poll and upstream request time; explicit refresh bypasses BB's cache freshness.

How you verified

  • 2,327 distinct tests passed across Claude (440), Codex (574), Pi (350), ACP (578), server catalog/consumers (98), UI (217), SDK (56), CLI (8), and latest-main runtime input handling (6). Ten existing Windows/Bun-gated tests skipped on Linux. Relevant typechecks and the full 63-task application build passed. Provider lint is clean; application lint reports 223 warnings and no errors, including existing hook/memo warnings outside the changed hunks.
  • Restoring the old execution-options implementation makes all four generic-provider refresh regressions fail; restoring this implementation makes them pass. Tests also cover credential isolation, pagination, explicit refresh coalescing, stale failure reporting, session invalidation, and propagation to multiple observed UI surfaces.
  • Ran the actual built candidate in a disposable home-lab VM. Rendered browser and CLI forced refresh returned the same 15 Claude models and catalog revision, including Fable 5.2. The browser exercised Refresh models and selected Fable 5.2. Real inference through the staged pool returned SHARED_CATALOG_STAGING_OK using claude-fable-5-2.
  • Working staging review. Other providers were exercised through automated bridge tests; authenticated live inference was verified for Claude. Stable BB has not been promoted.

Fixes #7329

AGENT GENERATED

@github-actions github-actions Bot added the needs-approval PR author is not on the approved contributor list label Nov 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for the pull request, @csells. It was closed automatically because it does not meet the requirements below yet. This is an automated check, not a review of the change.

Contributor approval. bb reviews pull requests only from approved contributors, and you are not on the list yet. Join the #contributors channel in Discord (https://discord.gg/kvBU6tJhcJ), post a link to your pull request, and explain what it changes and why. A maintainer then adds you to the list and reopens the pull request.

See CONTRIBUTING.md for details.

@github-actions github-actions Bot closed this Nov 10, 2026
@csells csells changed the title Fix pooled Claude model discovery for newly released models Centralize provider model catalog discovery and refresh across BB Nov 10, 2026
ymichael added a commit that referenced this pull request Nov 10, 2026
## Human comments

## What was wrong

Two problems kept new Claude models out of the picker behind Account
Pooler routing:

1. With the pool's `ANTHROPIC_BASE_URL`/`ANTHROPIC_AUTH_TOKEN`, Claude
Code has no claude.ai login. It skips its served model catalog
(`[servedCatalog] off (not_claude_ai_auth)`), and its `initialize`
models are only the ones cached in `~/.claude.json` under an earlier
personal login (here Fable 5.1). No env flag brings the catalog back;
setting either variable alone is enough to get the stale list.
2. The Claude Code bridge parsed `model/list` params as `z.object({})`
and probed with its own process env. It dropped the `envVars` bb sends
with each request, so plugin-contributed settings, the pool's included,
never reached model discovery. A machine whose daemon had no Claude
settings got Claude Code's no-login public catalog, which is why some
pooled machines did show Fable 5.2; others showed the stale list.

## What changed

- **account-pool:** new `GET /claude/v1/models` hub route, forwarded to
Anthropic's `/v1/models` with a pooled account's credentials (the Claude
adapter strips the `claude/` prefix). The pool contributes
`BB_CLAUDE_MODELS_URL` pointing at it, and neutralizes it with the other
routing variables for isolated nested instances. The skill reference
documents it.
- **provider-claude-code:** `model/list` parses params with the
protocol's `modelListParamsSchema` and probes with the same env sessions
use (`buildSessionEnv(envVars)`). The 2-minute memo keeps one entry per
env set. When `BB_CLAUDE_MODELS_URL` is set, the bridge pages through
it, and the pooled accounts' list sets the picker rows: Claude Code's
default first, then the rest newest first, with the efforts from
`capabilities.effort`. Claude Code still supplies the default, its alias
entries (selected-only, for threads saved with `opus`,
`claude-fable-5-1[1m]`, ...), and descriptions for models both lists
share. A 404 (a parent pool without the route) keeps Claude Code's list.
Other failures, or an empty list, fail the listing, so a partial catalog
is never published.
- No server/daemon wire change: `envVars` was already part of
`model/list` params.

Differences from #7389, which has the same core idea: this lets the
accounts' list set the rows instead of appending it after Claude Code's
stale list; keeps the bridge memo (per env) instead of removing it; it
treats a 404 from an older parent pool as "no account catalog" instead
of failing the Claude list; and it leaves out the cross-provider
refresh/polling/SDK/CLI changes.

## How you verified

- New tests:
- Bridge: `model/list` passes each request's `envVars` to the probe and
caches per env. This failed before the parser fix.
- Account list: rows newest first after the default, Claude Code aliases
kept and models outside the account list dropped, pagination, effort
mapping, 404 fallback, and failure on 5xx or an empty list.
  - Memo: one entry per env set.
- Pool: the route forwards to upstream `/v1/models` with the account
token. This fails without the prefix strip.
- `pnpm exec turbo run test typecheck
--filter=bb-plugin-provider-claude-code
--filter=bb-plugin-account-pool`: 441 + 394 tests pass. Lint is clean
for both plugins.
- Live, on a `pnpm start:worktree` server on a host with no Claude
login:
- With the parent pool on current main (404 on the new route), the
picker keeps Claude Code's 4 models with no error.
- With a stand-in parent pool that serves the route from Anthropic using
a real pooled OAuth token, the stand-in logged `GET
/claude/v1/models?limit=1000` from the worktree hub, and `bb provider
models claude-code` listed 15 models including `claude-fable-5-2`
(default still Opus 5.5). After the ordering change, the real bridge
against real Claude Code and Anthropic responses lists Opus 5.5
(default), Fable 5.2, Haiku 5.5, Sonnet 5.5, Fable 5.1, then older
models.
- Confirmed directly that Anthropic's `/v1/models` accepts a pooled
subscription OAuth token without the OAuth beta header.

Fixes #7329

🤖 Generated with [Claude Code](https://claude.com/claude-code)

> AGENT GENERATED

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-approval PR author is not on the approved contributor list

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Account Pooler: Claude Code model picker never shows new models (CLI skips its served model catalog without a claude.ai login)

1 participant