Skip to content

ACP-native model discovery overwrites the agent's saved default model (probe never restores the original selection) #4478

Closed

Description

@thomaswillner

Summary

ACP-native model discovery changes the connected agent's saved settings. To read reasoning levels, bb selects every model in turn with session/set_config_option and never restores the original. An agent that saves ACP selections, as Prime Agent documents, ends each discovery with its global default model (and thinking level) set to the last model probed. Expected: listing models is read-only for the agent.

Versions and environment

  • bb desktop 0.44.0 (latest release), macOS 26 (darwin 25.6.0), local daemon, default data dir.
  • Code path unchanged on main at b23150d88ecc42bcd0e8f96386be0db23f0b1fe4.
  • ACP agent: Prime Agent 0.9.6 (prime-agent --mode acp) as a custom agent, 65 models in its ACP model option.

Steps to reproduce

  1. Install Prime Agent 0.9.6 with at least two models configured. Note defaultProvider, defaultModel and defaultThinkingLevel in ~/.prime/agent/settings.json.
  2. Register it without modelCli:
    bb plugin config provider-acp set customAgents '[{"id":"prime","displayName":"Prime Agent","command":"prime-agent","args":["--mode","acp"]}]'
  3. Trigger a catalog refresh, wait a few seconds for the background refresh, then read the settings again:
    bb provider models acp-prime --json >/dev/null; sleep 15
    python3 -c 'import json,os;s=json.load(open(os.path.expanduser("~/.prime/agent/settings.json")));print(s["defaultProvider"],s["defaultModel"],s["defaultThinkingLevel"])'

Expected vs actual

Expected: the three values are unchanged.

Actual: defaultModel becomes the last model in the agent's model option (here anthropic/claude-opus-4-6-thinking). When that model does not support the previous thinking level, defaultThinkingLevel is clamped and saved too (here medium → high). Every new Prime session, inside or outside bb, then starts on that model.

Evidence

  • Observed 54 times between 2026-09-27T00:22Z and 2026-09-28T19:25Z on 0.44.0. Each burst of 25–67 model selections (one model_select per probe step in Prime's extension log; median 2.7 s, max 5.0 s) started 0.6–10 s after bb opened a Prime session in <data dir>/provider-maintenance-workspace. 54 of 54 bursts matched such a session, and no burst had any other source. Bursts shorter than the full model list are consistent with the discovery timeout.
  • Steps 1–3 describe the configuration under which those 54 occurrences were recorded. I did not re-run them after applying the workaround, to avoid changing the live default again.
  • The probe loop selects each model and returns without restoring the original value: packages/provider-bridge-acp/src/bridge/bridge.ts#L935-L1016, called from loadSessionDiscoveredModels (#L816) whenever listCommand is undefined (#L2393). The session runs in the maintenance workspace from apps/host-daemon/src/runtime-manager.ts#L1121.
  • Prime Agent documents the persistence (docs/acp.md, "Model and reasoning effort pickers"): "Changes use the same session and saved preferences as Prime Agent's own model and effort controls." In Prime 0.9.6, setModel() calls settingsManager.setDefaultModelAndProvider() on every change, and setThinkingLevel() saves the level whenever a model switch clamps it.

What you ruled out

Suggested priority and effort

Medium. Every catalog refresh silently changes the default model and thinking level for all of the user's sessions of that agent, including sessions outside bb. There is a workaround, but it needs a wrapper script. A likely small fix: after the loop, restore the model option's original currentValue (and the original thought_level), or send a session/set_config_option back to them in a finally. That brings the agent's saved preference back to where it started.

AGENT GENERATED. Investigation from a local Claude Code session; no public thread. Evidence is reproduced above.

Activity

  1. added theissue type on Sep 30, 2026
  2. added
    providers
    provider-acp
    confirmed-repro
    on Sep 30, 2026
  3. SawyerHood commented on Sep 30, 2026

    @SawyerHood
    Collaborator

    Reproduction report: REPRODUCED at the ACP bridge boundary, high root-cause confidence. A synthetic agent that persists accepted selections retained the final discovery model in two clean checkouts at adbce963ae138ba077afbe011edb414ade4dcf26, repeated by the same agent. Real Prime Agent settings and thinking-level changes remain unverified. The complete regression and both outputs are inline. No production fix or PR.

    AGENT GENERATED

  4. anesthetised commented on Oct 5, 2026

    @anesthetised

    Same probe pattern from the agent side, different agent: acp-bridge (a fork of BlakeHung/acp-bridge — anesthetised/acp-bridge@d261ed1) advertising 552 backend models in its model option — bb desktop 0.45.0, macOS 27.0.1.

    • Two discovery bursts in one day, each 552 session/set_config_option requests in ~1 s, all accepted by the agent — matches the per-model probe loop and discovery-timeout behavior described above.
    • Blast-radius data point: acp-bridge scopes config-option state per session, in memory only, and the bursts targeted a discovery session — the real session's model stayed at the configured default throughout (verified via per-round request-body logging). So the corruption requires agent-side persistence of selections; per-session agents like ours are unaffected by the restore problem, though the O(N) probe cost remains.
    • If useful for the fix: an agent-visible marker distinguishing "discovery probe" from "user selection" (e.g. a _meta flag on the request) would let agents skip persistence without bb needing to restore anything.
  5. added a commit that references this issue on Nov 17, 2026
    da39507
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-reproprovider-acpproviders

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions