Skip to content

Stop showing and sending a fake Medium reasoning level for ACP models - #6477

Closed
ymichael wants to merge 3 commits into
mainfrom
bb/4367-unknown-reasoning
Closed

ymichael wants to merge 3 commits into
mainfrom
bb/4367-unknown-reasoning

Conversation

@ymichael

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

When an ACP agent did not report reasoning levels for a model, the bridge filled in a single placeholder "Medium" level (and later detected the placeholder by its shape). The picker showed that fake level, and the app sent it to the agent as if the model supported it (#4367).

What changed

Models whose levels are unknown now advertise an empty reasoning ladder, and the placeholder detection is gone. The new-thread composer, follow-up composer and handoff requests omit reasoningLevel (and its provenance) when the selected model advertises no levels. NewThreadRequest.reasoningLevel in the plugin SDK becomes optional; SDK bumped to 0.6.98.

Visible behaviour changes:

  • Unknown ACP ladders (including Agent default, legacy session models, and unprobed models) advertise no levels, removing the fabricated Medium picker option.
  • New-thread, follow-up, and handoff requests omit reasoning and its provenance when the selected model advertises no levels. This also applies to other providers with empty ladders.
  • Saved preferences and known model ladders are preserved.
  • Plugin SDK NewThreadRequest.reasoningLevel is optional and documented in the Plugin Guide.
  • The native-reasoning hint fallback now checks an empty ladder, so an actual discovered single Medium is no longer mistaken for a placeholder.

No larger discovery budget, omp metadata support, or per-session catalog refresh was added. The issue's request to discover every model's real levels remains a separate improvement. Server execution defaults, historical overrides, and already queued settings are unchanged; the request omission is not a claim that every downstream default is disabled.

How you verified

Each regression was run against main first:

The retained catalog test was run with both production bridge files restored to current main: expected [ { reasoningEffort: 'medium', …(1) } ] to deeply equal [].

The new real-composer regression failed before the app repair: expected 'high' to be undefined for a seeded request with no advertised levels.

The follow-up regression was also run against main's ThreadDetailPromptArea: expected 'medium' to be undefined.

All production files were restored to the fixed versions and the affected suites passed afterward.

  • ACP bridge: 25 files; 544 passed, four skipped, including recorded conformance.
  • App composer tests: two files; 118 passed.
  • Client request tests: two files; 22 passed.
  • Plugin Guide: 12 files; 75 passed.
  • Turbo lint/typecheck: app, client-core, ACP bridge, Plugin SDK, and Plugin Guide passed. Lint had warnings and no errors.
  • oxfmt and git diff --check passed.
  • No real omp or browser smoke test was run.

Commands used Turbo with the owning package filters. The client tests are under test/, not src/prompt/; an initial invocation using the latter found no tests, then the corrected command passed.

The default parity allowlist reported six failures solely for stale historical entries, with identical old/new events and rows. A stricter comparison using an empty external allowlist is recorded below; no repository allowlist was modified.

Review against docs/CODE_REVIEW.md and deslop found no additional defects within this scope. Diff versus main: production/docs +34/-29 lines; tests/support +70/-23 lines. No generated artifacts committed.

Strict ACP parity against current main: 10 passed, zero failed, one skipped. The skipped model-list recording is process-scoped and is covered separately by the bridge catalog regression. All compared events and timeline rows are identical.

Fixes #4367

🤖 Generated with Claude Code

AGENT GENERATED

ymichael and others added 3 commits October 28, 2026 13:20
ACP models whose thought levels the 5 s discovery budget did not reach,
models from legacy session-models state, and "Agent default" all got a
fake single "Medium" ("Reasoning effort is managed by the connected ACP
agent."), detected elsewhere only by its shape. On omp most of a large
catalog showed that one option, and picking it set medium on the agent.
Those models now list supportedReasoningEfforts: [], so the picker shows
no reasoning row for them, and the configured nativeReasoning hint keys
off the empty list instead of the placeholder's shape.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Preserve remembered preferences while omitting reasoning and its provenance from new-thread, follow-up, and handoff requests with no advertised reasoning levels. Make the plugin composer submission field optional and retain failing-before regressions for create and follow-up submissions.
@ymichael ymichael closed this Oct 28, 2026
ymichael added a commit that referenced this pull request Oct 28, 2026
…in view (#6491)

## Human comments

## What was wrong

A provider model catalog stayed fresh for ten minutes (`FRESH_MS` in
`provider-model-catalog-store.ts`). Background refreshes start only when
something reads a catalog. So when a provider started offering a model,
the picker kept the old list until the stored one was ten minutes old
and something read it. While testing #6477, omp advertised 119 models
(adding `openai-codex/gpt-5.6-luna`, `sol` and `terra`) while the picker
kept showing 116 for about ten minutes. Shortening the window alone
would have made a second cost worse: opening the picker prefetched every
other provider (`ModelReasoningPicker`). Every open past the window then
started a background refresh of every stale provider at once, and each
ACP refresh launches the agent, creates a session, probes models and
deletes the session.

## What changed

- `provider-model-catalog-store.ts`: `FRESH_MS` drops from 10 min to 60
s. This is the age at which `thread update --model` with a missing model
already waits for a refresh (`VALIDATION_MIN_AGE_MS`), so both rules now
share one `stale` check and the extra constant is gone. Persistence,
failure backoff, prewarm, session-pushed catalogs and invalidation are
unchanged.
- `ModelReasoningPicker.tsx`: removed the open-time sibling prefetch. A
provider tab now prefetches its own catalog on `pointerenter`/`focus`,
and clicking a tab still loads it. A refresh therefore only starts for
providers the user looks at.
- `system-queries.ts`: `prefetchSystemExecutionOptions` takes a single
provider. The tab preview uses the new
`useProviderPreviewExecutionOptions`, which keeps the prefetch's
semantics (`writeLastKnown: false`): a failed load shows its error
instead of a remembered list, and previewed catalogs are not written to
localStorage, whether or not the tab was hovered first.
- `bb-guide-providers.md`: documents the one-minute background refresh.

No wire, protocol or SDK changes.

## How you verified

- New and changed tests:
- Store boundary: no refresh at 59.999 s, one background refresh at 60
s. This fails with the old 10 min value.
- Picker: opening loads nothing, hovering the selected provider loads
nothing, hovering another tab loads only that provider on the routed
host.
  - Prefetch helper test updated for the single-provider signature.
- The existing `PluginProviderModelPicker › does not commit loading,
placeholder, or failed provider catalogs` test caught a regression that
preview semantics would otherwise have changed, and passes with the
preview hook.
- `pnpm exec turbo run test typecheck lint --filter=@bb/app` and
`--filter=@bb/server`:
  - App: 6368 passed.
  - Server: 3723 passed.
- Three tests timed out under load from two local dev servers
(`PluginSettings` autosave, timeline output preview,
`install-machine-script`) and passed when rerun alone.
- Real-app QA against two `pnpm start:worktree` servers, this branch and
its base `be6ec62151`, with real providers. Both started from the same
116-model omp list, about 90 s old:

| Check | Base | Branch |
|---|---|---|
| `bb provider models acp-omp`, read twice ~5 s apart | 116 → 116, no
refresh | 116 → **119** (background refresh 1.6 s) |
| Open picker on the omp tab, search `gpt-5.6` | `openai-codex` 5.6
models still missing after 15.8 s | appear in the open picker after 1.56
s |
| Model-list requests when the picker opens | 6 (every other provider) |
**0** |
| Hover one tab | – | 1 request, that provider |
| `thread update --model openai-codex/gpt-5.6-sol` on a stale list |
waits for one refresh, accepted | same |
| `thread update --model openai-codex/not-a-model` | rejected | same |
| Failing provider tab clicked without hover | "Could not load models
for …" | same |
| Tab click → models rendered (local, 3 runs) | 66–72 ms | 71–158 ms |

A codex smoke thread (`Reply only with ok.`) completed on the branch,
and `bb provider models` loads every signed-in provider.

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

> AGENT GENERATED

Co-authored-by: Claude Opus 5.5 <[email protected]>
ymichael added a commit that referenced this pull request Oct 29, 2026
…6486)

## Human comments

## What was wrong

ACP's bounded catalog scan (five seconds) reaches only part of a large
model list. For models it didn't reach, BB showed a fabricated single
"Medium" reasoning choice and sent that setting to the agent, replacing
the agent's own reasoning setting with a level the user never chose.
Replaces #6477.

## What changed

- **ACP catalog:** models whose reasoning levels haven't been checked
report an empty list instead of a fake Medium, so the picker shows no
reasoning control for them.
- **Selected-model discovery:** selecting such a model asks the agent
for that one model's levels in a separate probe (30 s agent startup, 5 s
probe; deduplicated). The picker shows the real choices when they
arrive. Discovered levels survive later full refreshes and live-session
catalogs. Failed probes retry after 30 s; a probe the agent answers
without levels isn't repeated until the catalog is invalidated. Also
available through `bb provider models --selected-model` and the SDK
`selectedModel` query.
- **`AvailableModel.reasoningDiscovery: "unknown" | "known"`:**
distinguishes "not checked yet" from "checked, no selectable levels".
Defaults to `"known"`, so only providers that mark models unknown (ACP)
get probed. This flag only drives probing; it has no effect on what is
sent.
- **Send rule (server-to-daemon command boundary):** the stored
reasoning preference stays required. BB sends it unless the cached
catalog lists the model without that level, in which case it leaves
reasoning out and the agent keeps its own setting. A model missing from
the cache (cold or ephemeral-host catalogs) is sent as before. New
worktree threads fall back to the project checkout's catalog, which is
what the picker reads. The lookup is a synchronous in-memory/DB read
with no plugin calls. Sending never waits for discovery.
- **Versions:** Plugin SDK 0.6.98 (new `reasoningDiscovery` field and
`selectedModel` model-list param); host-daemon protocol 258
(`provider.list_models.selectedModel`, and `options.reasoningLevel` may
be absent).

No database migration. `NewThreadRequest.reasoningLevel` and
queued-message reasoning stay required.

### Behaviour changes

- ACP models with unchecked levels: no fake Medium in the picker, and no
reasoning level sent until the levels are known.
- Any provider: a stored reasoning level the cached catalog doesn't list
for the selected model is no longer sent.

## How you verified

- `thread-command-reasoning.test.ts` covers start and follow-up commands
across unknown, unprobed-with-levels, confirmed-empty, unsupported,
supported and uncatalogued models, plus host/workspace catalog scoping.
Against the previous discovery-gated rule it fails
(`unprobed-with-levels: expected undefined to be 'high'`); it passes
with this change.
- Catalog store regressions (each fails on the previous store code):
discovered levels survive a full refresh and a live-session catalog; a
probe settling after a concurrent full refresh is applied; an agent that
answers without levels isn't probed again.
- Full server suite: 3,735 passed, 1 skipped. App model-selection,
picker and composer tests: 373 passed. ACP bridge, host daemon,
host-daemon/server contracts, domain and template suites passed.
Typecheck and lint passed for every changed package.
- Earlier revision: live QA against an 836-model fake ACP agent showed
real Low/Medium/High appearing for a late model after selection, and no
effort setting on the wire for unknown models.

Fixes #4367

> AGENT GENERATED

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

---------

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.

ACP reasoning discovery covers ~80 models, so most omp models show a fake single "Medium" that is then sent to the agent

1 participant