Repository navigation
Conversation
ACP model discovery calls session/set_config_option for each model to read its reasoning options. It did not set the model back afterwards, so an agent that saves accepted selections kept the last probed model as its default. After the probe loop, discovery now sets the model option back to the currentValue that the agent reported at session start. Discovery also does this when single probes fail. When the discovery timeout fires, the bridge kills the connection, so no restore request is sent. If the restore request fails, the bridge writes the error to stderr and returns the catalog. Fixes get-bb#4478
ymichael
added a commit
that referenced
this pull request
Nov 17, 2026
… selected-model probe (#7646) ## Human comments ## What was wrong To read each model's reasoning levels, ACP-native model discovery switched the agent through every model in its `model` config option with `session/set_config_option` (`discoverAcpNativeModelSupport` in `packages/provider-bridge-acp/src/bridge/bridge.ts`), and never switched back. ACP has no read-only way to ask about another model, so a catalog refresh became up to one settings write per model. Agents that save each switch as the user's default, as Prime Agent documents, ended every refresh on the last model probed. A reasoning level clamped during a switch was saved too. The 5 s sweep budget also meant large catalogs were only partly probed, so models beyond the budget already relied on the selected-model discovery added in #6486. T3 Code never switches models to discover them. It reads the session's initial configuration, takes per-model levels from model metadata when present, and otherwise learns them from real sessions. This supersedes #7503 by @lanjak. That PR restores the model after the sweep, but the restore is skipped when the 5 s timeout fires (the reporter's bursts reached it), and the clamped reasoning level is not restored. Their commit is kept on this branch. ## What changed - `packages/provider-bridge-acp/src/bridge/bridge.ts`: - Listing models reads only the levels the agent reports for its current model and sends no `session/set_config_option`. Other models report `reasoningDiscovery: "unknown"`, which the server and picker already handle: selecting such a model triggers selected-model discovery. - Selected-model discovery switches to that one model (same 5 s budget, and the same one retry for an unconfirmed reply). It then sets the session's starting model back, followed by every other option whose value changed (reasoning level, Fast). This runs after success, failure and timeout, within a 10 s restore budget, before the existing session teardown. - Removed `reasoningProbePriorityModelIds`, which only ordered the removed sweep. It is gone from the Cursor and Grok known-agent profiles, the plugin's bridge options and the bridge option schema. The bridge schema is passthrough, so an older plugin that still sends the field is accepted. - `plugins/provider-acp/skills/acp-provider/SKILL.md` describes the new discovery and restore behavior. - Model picker (`apps/app`): this change sends more models through selected-model discovery. While it ran, the picker hid the Reasoning section and the trigger's level label, so the model looked like it had no reasoning, and the popup grew when the levels arrived. `useThreadCreationOptions` now returns `isLoadingReasoning` while that query is pending (false once it settles, including when it returns no levels). `ExecutionControls` and `PluginProviderModelPicker` pass it to `ModelReasoningPicker`, which keeps the Reasoning heading with three skeleton toggles of the buttons' height and shows a skeleton in place of the trigger's level label. No server/daemon wire change: `selectedModel` already exists (protocol 258), and provider options are opaque to the daemon. Behavior change: right after a catalog refresh, only the agent's current model shows reasoning choices. Other models show them once selected, after one short probe. Models past the old 5 s budget already worked this way. ## How you verified - New bridge tests, which fail against `origin/main`'s `bridge.ts` and pass with this change: - listing a 3-model catalog sends no `session/set_config_option`, and only the current model's levels are known; - after a selected probe that changes the model and clamps the reasoning level, the bridge sends `model=<starting>` then `effort=<starting>`; - the model is restored after a failed probe; - the model and effort are restored after a timed-out probe. - Sweep-only tests removed. The stale-reply, Cursor and empty-thought-level tests now use selected-model discovery. - `pnpm exec turbo run lint lint:type-aware typecheck test --filter=@bb/provider-bridge-acp --filter=bb-plugin-provider-acp`: 590 passed / 4 skipped, and 85 passed; 0 lint warnings. `oxfmt --check` is clean. - Live in a `pnpm start:worktree` instance with a custom ACP agent that saves each model switch and clamped reasoning level to a settings file, as Prime does: - Before (main): one `bb provider models acp-saver` changed the saved default from `acme/alpha` to `acme/delta`. - After: server start and `bb provider models` sent no switches, and settings were unchanged. - `--selected-model acme/delta` logged `set model acme/delta`, `clamped effort high`, `set model acme/alpha`, `set effort medium`. It ended at `alpha/medium` with delta's levels `["high"]`. - `--selected-model acme/gamma` restored only the model, because nothing was clamped. - Picker skeleton: `useThreadCreationOptions.test.tsx` now checks that `isLoadingReasoning` is true while selected-model discovery is pending, false once the levels arrive, and false when discovery returns no levels. `turbo run typecheck lint --filter=@bb/app` passes, and the 17 affected app test files pass (378 tests). In the worktree instance, with an agent that takes 3 s per change, picking an unchecked model showed 3 menu skeletons and 1 trigger skeleton with no reasoning radios. About 9 s later it showed the 3 real radios and no skeletons, and the popup kept its height. - Known limit: with an agent that takes 5.5 s per setting change, the model was restored but the reasoning-level restore exceeded the 10 s budget. Fixes #4478 > AGENT GENERATED 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: rufi <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
Contributor
Author
|
Superseded by #7646, which keeps this commit, also restores the model when the probe times out, and restores the reasoning level. Closing. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Human comments
What was wrong
discoverAcpNativeModelSupport(packages/provider-bridge-acp/src/bridge/bridge.ts:1278) reads the agent's current model (modelOption.currentValue), then sendssession/set_config_optionfor each model it probes (:1347). When the loop ends, it returns the catalog and the caller kills the connection. Nothing sets the original model back. An agent that saves each accepted selection therefore keeps the last probed model as its default (#4478).What changed
packages/provider-bridge-acp/src/bridge/bridge.ts: after the probe loop, if the discovery timeout has not fired andcurrentValueis defined, the bridge sends one moresession/set_config_optionwith the original value. This also runs when single probes fail, because the loop catches those per model. If the restore request fails, the bridge writes the error to stderr and still returns the catalog.packages/provider-bridge-acp/src/bridge/bridge.test.ts: a new test (all probes succeed, and the last probe fails) checks that the request sequence ends with the original model. Two existing tests that list the exactset_config_optioncalls now include the restore call. The timeout case still expects no restore.No wire, CLI or plugin API change.
Not covered:
How you verified
bridge.ts), both cases fail:AssertionError: expected [ 'fake/strong', 'fake/gen-2' ] to deeply equal [ 'fake/strong', 'fake/gen-2', ...(1) ].pnpm exec turbo run lint lint:type-aware typecheck test --filter=@bb/provider-bridge-acppasses, 589 passed and 4 skipped, 0 lint warnings.oxfmt --checkpasses. A second, independent run passes too.Fixes #4478