Skip to content

Run the real-CLI Claude Code model probe in CI - #4126

Merged
andrewkchan merged 1 commit into
mainfrom
ci/real-provider-model-listing
Sep 23, 2026
Merged

andrewkchan merged 1 commit into
mainfrom
ci/real-provider-model-listing

Conversation

@andrewkchan

@andrewkchan andrewkchan commented Sep 22, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

I am running into a bug on the Claude Code model picker where the models are not listing properly. It looks like we have some automated tests that download claude code and then run the bb probe against it to get the list of models to display in the picker, but they simply do not run in CI.

This wires them up in CI. Note some changes are needed for secrets:

  1. Passing the env var for CLAUDE_CODE_OAUTH_TOKEN through to the bridge process
  2. Adding CLAUDE_CODE_OAUTH_TOKEN to the github repo secrets

PR also includes the fix for the bug on my local computer. Unfortunately, the automated tests on linux do not repro the issue.

What was wrong

Every automated check of bb's Claude Code model catalog mocks the Agent SDK's query(), so nothing in CI has ever spawned a real claude. A test that would catch a broken probe already exists — integration.provider-basic.test.ts "lists models" — but test:integration is referenced nowhere under .github/, so it only runs when someone remembers to run it locally.

That gap surfaced when the picker started showing "Could not load models for Claude Code": the probe's settingSources: [] made the CLI exit with code 0 and no output, which the SDK reports as Query closed before response received. It had been failing since at least Sep 16, hidden by models.fallback until #4084 removed it.

What changed

  • .github/workflows/ci.yml: new provider-model-listing job on pushes and same-repo PRs. Installs the Claude Code CLI, authenticates from a CLAUDE_CODE_OAUTH_TOKEN secret, runs the model-listing probe against a real binary.
  • plugins/provider-claude-code/src/bridge/model-list.ts: the probe now uses settingSources: ["user", "project", "local"], matching what sdk-session.ts already passes for real sessions.
  • plugins/provider-claude-code/server.ts, turbo.json: let CLAUDE_CODE_OAUTH_TOKEN reach the CLI. Two layers stripped it — the bridge env allowlist declared only BB_CLAUDE_CODE_EXECUTABLE, and Turbo strips undeclared variables. So token auth never worked for any bb user, not just CI, and the documented BB_CLAUDE_CODE_EXECUTABLE override was inert under test:integration.
  • docs/configuration.md, claude-code-provider skill: document both variables.

Scope is the model-listing tests only, to keep the job fast and free of real model turns. The CLI version is unpinned (pinning would hide the breakage this job watches for), and it installs the native build, which is what bb resolves from PATH and ~/.local/bin.

Expected state of this job: green

This job passes, and would have passed on the unfixed probe too. It is general regression coverage, not a reproduction of the defect that motivated it.

That defect is specific to the macOS native build, which exits when the settings set it loads is empty. On CLI 2.1.280:

macOS, native, settingSources: []  -> FAIL  Query closed before response received
macOS, npm build, same config, []  -> OK
Linux CI, native, authenticated,[] -> OK

So a Linux runner cannot reproduce it; a macOS leg could, and is the natural follow-up. A CLI that exits 0 with empty stdout and stderr also leaves bb nothing to report, which is worth filing upstream separately.

How you verified

  • Probe fix confirmed against the real native CLI: [] fails, ["user","project","local"] returns 5 models. Verified end to end in a dev build.
  • The CI job runs and passes on Linux with exactly one test selected: ✓ lists models, Tests 1 passed | 64 skipped (65) — the filter is not silently matching zero tests.
  • Env plumbing proved with a shim: both variables reach the spawned process, while an undeclared control variable is still stripped.
  • turbo run test typecheck --filter=bb-plugin-provider-claude-code: passing. turbo run test --filter=@bb/server: 295 files passing, with one unrelated pre-existing failure (bb-official-generator.test.ts, a local git %cI format difference) that reproduces with these changes stashed.

Fixes #

AGENT GENERATED

@andrewkchan
andrewkchan force-pushed the ci/real-provider-model-listing branch 3 times, most recently from 7ad115a to a951482 Compare September 23, 2026 00:14
Every automated check of bb's Claude Code model catalog mocks the Agent SDK's
`query()`, so nothing in CI ever spawned a real `claude`. The test that would
catch a broken probe already exists — `integration.provider-basic.test.ts`
"lists models" — but `test:integration` is referenced nowhere in `.github/`.

The picker broke exactly that way: the probe's `settingSources: []` made the
CLI exit with code 0 and no output, reported as "Query closed before response
received". `models.fallback` hid it until #4084 removed it.

- Add a `provider-model-listing` CI job running the probe against a real,
  unpinned CLI. It passes today, and would have passed on the unfixed probe:
  the defect is specific to the macOS native build, which exits when the
  settings set it loads is empty, so a Linux runner cannot reproduce it.
- Match the probe's setting sources to what `sdk-session.ts` already passes
  for real sessions, which fixes the picker.
- Let CLAUDE_CODE_OAUTH_TOKEN reach the CLI. The bridge env allowlist declared
  only BB_CLAUDE_CODE_EXECUTABLE, and Turbo strips undeclared variables, so
  token auth never worked for any bb user and the documented executable
  override was inert under `test:integration`.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@andrewkchan
andrewkchan force-pushed the ci/real-provider-model-listing branch from a951482 to 830886e Compare September 23, 2026 00:20
@andrewkchan
andrewkchan merged commit 4f9f453 into main Sep 23, 2026
17 checks passed
@andrewkchan
andrewkchan deleted the ci/real-provider-model-listing branch September 23, 2026 00:24
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