Skip to content

ACP: stop switching models to list them, and restore settings after a selected-model probe - #7646

Merged
ymichael merged 3 commits into
mainfrom
acp-stop-model-sweep-4478
Nov 17, 2026
Merged

ymichael merged 3 commits into
mainfrom
acp-stop-model-sweep-4478

Conversation

@ymichael

@ymichael ymichael commented Nov 16, 2026 •

Copy link
Copy Markdown
Collaborator

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

lanjak and others added 3 commits November 16, 2026 14:49
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 #4478
Listing an ACP agent's models switched the agent through every model in
its model option to read each one's reasoning levels. Agents that save
each switch as the user's default, such as Prime Agent, ended every
catalog refresh on the last model probed, often with a clamped
reasoning level saved too.

Listing models now reads only what the agent reports for its current
model and never switches. Other models stay "unknown" until the user
selects one; the existing selected-model discovery then switches to just
that model. Afterwards it sets the session's starting model back and
then every other option whose value changed (reasoning level, Fast),
within a 10 second budget, including after a failed or timed-out probe.

The reasoning probe priority list only ordered the removed sweep, so it
is removed from the Cursor and Grok profiles and the bridge options.

Fixes #4478

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Picking a model whose reasoning levels are not known yet hid the
Reasoning section and the trigger's level label until selected-model
discovery returned, so the picker looked like the model had no
reasoning and then grew. useThreadCreationOptions now reports
isLoadingReasoning while that discovery query is pending, and the
picker keeps the Reasoning heading with skeleton toggles and shows a
skeleton in the trigger.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ymichael
ymichael merged commit da39507 into main Nov 17, 2026
52 checks passed
@ymichael
ymichael deleted the acp-stop-model-sweep-4478 branch November 17, 2026 05:09
alexburlis added a commit to alexburlis/omnyo that referenced this pull request Nov 27, 2026
…model

Port the applicable ACP fixes from get-bb/bb#7788 and get-bb/bb#7646. Preserve existing session restoration, model preferences, and model-specific settings.
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-native model discovery overwrites the agent's saved default model (probe never restores the original selection)

2 participants