Skip to content

List provider models with plugin-contributed provider environment - #5767

Merged
ymichael merged 1 commit into
mainfrom
bb/account-pooler-issue-thr_rkd49caabz
Oct 19, 2026
Merged

ymichael merged 1 commit into
mainfrom
bb/account-pooler-issue-thr_rkd49caabz

Conversation

@ymichael

@ymichael ymichael commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

The model catalog sent provider.list_models without the environment plugins contribute through bb.providers.experimental_contributeEnv. Those resolvers ran only for thread sessions and turns. With the Account Pooler routing Codex, the bridge's model-list codex app-server therefore started with the machine's own Codex login instead of the pool. On a machine without its own login, or with a smaller plan, the picker showed only that account's models. For example, GPT-6-Astra and the Sol models were missing even though pooled threads could use them.

What changed

  • Server (provider-model-catalog-store.ts): catalog reads and prewarm resolve contributed provider env with { threadId: null, projectId: null, hostId } and send it on provider.list_models. The env names and values are part of the catalog fingerprint, so a route or token change discards the stored list.
  • Wire: provider.list_models gains a required contributedEnv; HOST_DAEMON_PROTOCOL_VERSION 242 → 243. The daemon passes it to runtime.listModels. The runtime expands it like a session's env (serverPath → BB_SERVER_URL + path) through a shared resolveContributedEnvironment, and sends the result as envVars on the bridge model/list request. That bridge param is optional, so existing bridges ignore it.
  • Codex bridge: the cached model-list app-server is keyed on the pool base URL and auth token. It relaunches when they change, and discards a launch that loses a race with a newer route.
  • Plugin SDK (0.6.56 → 0.6.57): ExperimentalPluginProviderEnvContext.threadId and projectId are now string | null, with null meaning "no thread", e.g. model catalog listing. This is a breaking change to an experimental_ API.
  • Account Pooler: with a null thread it still returns the pooled env, but skips the thread bypass check, the retry-route: key and recordRouted.
  • Docs: docs/provider-plugin-api.md, docs/api_to_audit.md, and the bb-plugin-authoring providers.md reference.

Marketplace impact. I searched all 414 community marketplace entries (316 git repos and 13 npm packages, default branches). 7 plugins call experimental_contributeEnv. None crash, because when a resolver throws, bb logs it and skips that plugin's env.

  • OXI-717/account-pool-balanced throws in hubTokens.forThread, which requires a string thread, so its Codex catalog still lists local-login models and logs an error per read. It needs the same null-thread guard as the bundled pooler: Resolve provider env without a thread for bb model listing OXI-717/bb-plugins#70.
  • grrowl/bb-github-app-auth returns nothing and logs project-lookup warnings.
  • Magpie (vaayne/agent-kit) falls back to its global routing setting, so it gets the fix.
  • The other four ignore the thread or no-op.

How you verified

  • New tests:
    • runtime: model list expands contributed env against BB_SERVER_URL
    • catalog store: contributed env reaches provider.list_models and a change invalidates the stored list
    • Account Pooler: a null-thread resolve returns pooled env and writes no thread state
    • Codex bridge: the model-list app-server relaunches with the new token (verified through the fake app-server's launch log)
  • pnpm exec turbo run typecheck lint --filter='...[origin/main]': 142/142 tasks passed.
  • turbo run test for agent-runtime, host-daemon-contract, host-daemon, server, provider-bridge-protocol, plugin-sdk, account-pool and provider-codex all passed, except one timing assertion in builtin-plugins.test.ts (builtin hot-reload), which passed when re-run alone.
  • Manual: ran pnpm start:worktree inside a pooled bb thread (parent-proxy mode; this machine has no Codex login). bb provider models codex against main listed 3 models (gpt-6-luna, gpt-5.6-terra, gpt-5.6-luna). Against this branch it listed 8, including gpt-6-astra, gpt-6.1-sol and gpt-6-sol, all with the fast tier.

AGENT GENERATED

🤖 Generated with Claude Code

The model catalog launched each provider's model/list without the environment
plugins contribute through bb.providers.experimental_contributeEnv, so Codex
behind the Account Pooler listed only the models of the machine's own login.
The server now resolves contributed env with a null thread and project for
catalog reads and prewarm, fingerprints it into the catalog cache, and sends it
on provider.list_models. The Codex bridge relaunches its model-list app-server
when the pool route or token changes. ExperimentalPluginProviderEnvContext
threadId and projectId become nullable; the Account Pooler skips per-thread
routing state when there is no thread.

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant