buzz icon indicating copy to clipboard operation
buzz copied to clipboard

[Bug] Claude Code agents ignore the model set in Buzz Desktop — model picker persists but nothing applies it at spawn

Open bosoud opened this issue 4 months ago • 8 comments

Describe the bug

Setting a model for a Claude Code harness agent in Buzz Desktop (agent edit → model picker) persists the selection but never applies it: the spawned session runs on the user's global Claude Code default (~/.claude/settings.json / account default) instead. No error, no warning — the agent simply answers as a different model than the one configured.

Observed on Buzz Desktop 0.4.24 (macOS): a stock agent set to Sonnet reports claude-fable-5 in-session, across restarts.

Root cause

The model reaches spawned agents through runtime_metadata_env_vars (desktop/src-tauri/src/managed_agents/runtime.rs), which injects (model_env_var, effective_model) — but only when the runtime declares a model_env_var. The claude entry in KNOWN_ACP_RUNTIMES (desktop/src-tauri/src/managed_agents/discovery.rs) declares:

supports_acp_model_switching: false,
model_env_var: None,
provider_env_var: None,
provider_locked: true,

So for Claude Code there is no channel at all from the persisted model to the session: no env var, no ACP model switch. Goose (GOOSE_MODEL) and Buzz Agent (BUZZ_AGENT_MODEL) both have one. Meanwhile the model picker UI happily lists Anthropic models for the claude harness (discover_anthropic_models in commands/agent_models.rs) and persists the choice — a selection surface with no application path behind it.

Notably the readiness checker already knows the right key — readiness.rs maps Some("anthropic") => Some("ANTHROPIC_MODEL") — it's only the spawn-time runtime entry that lacks it.

Suggested fix

model_env_var: Some("ANTHROPIC_MODEL") on the claude runtime entry. The Claude Code CLI honors ANTHROPIC_MODEL as a session model override (verified locally: ANTHROPIC_MODEL=claude-sonnet-5 claude --print "…model id…" → claude-sonnet-5), and the ACP adapter's child claude process inherits the spawn env. provider_locked: true already keeps provider injection off, which is correct for this harness.

If that's adopted, ANTHROPIC_MODEL should probably also join DERIVED_PROVIDER_MODEL_ENV_KEYS (managed_agents/env_vars.rs) so a stale persisted copy can't shadow later UI edits — same treatment as GOOSE_MODEL/BUZZ_AGENT_MODEL.

Workaround

Until fixed, add ANTHROPIC_MODEL=<model-id> as a custom env var on the agent (edit agent → environment variables) and restart it.

To Reproduce

  1. Create/edit a Claude Code harness agent in Buzz Desktop; set model to any non-default (e.g. Sonnet).
  2. Restart the agent, ask it what model it runs on.
  3. It reports the user's global Claude Code default, not the configured model.

Environment

  • Buzz Desktop 0.4.24 (official Block-signed build), macOS (Intel), Darwin 25.5.0
  • Claude Code harness via claude-agent-acp
  • Repo state: block/buzz @ 06e3d82b

bosoud avatar Jul 24 '26 08:07 bosoud

Adding a second, closely related path we just traced on Buzz Desktop 0.4.24 (macOS, Apple Silicon, claude-agent-acp v0.61.0): the global default model (Desktop model picker → agents/global-agent-config.json → BUZZ_ACP_MODEL) does have an application channel for Claude Code — but it can silently fail at spawn and land on the same wrong-model outcome described here.

What we observed

global-agent-config.json had "model": "opus[1m]", and buzz-acp was launched with BUZZ_ACP_MODEL=opus[1m] (visible in the agent process env). Per crates/buzz-acp/src/pool.rs (~line 872), the harness resolves the desired model against the fresh session/new response via resolve_model_switch_method() (crates/buzz-acp/src/acp.rs) — an exact string match against the advertised configOptions/availableModels. At spawn it missed:

2026-07-24T08:43:38.691656Z  WARN pool::model: desired model opus[1m] not found in agent's available models — proceeding with agent default

…and the session fell back to the "agent default", i.e. whatever ~/.claude/settings.json happens to pin (in our case claude-fable-5[1m], churned by the user's ordinary Claude Code sessions). The agent then reports Fable 5 in-session — same symptom as this issue, different mechanism.

The suspicious part: running /Applications/Buzz.app/Contents/MacOS/buzz-acp models afterwards (warm) lists opus[1m] as a perfectly valid stable configOption value:

Models (stable configOptions):
  - default
  - opus[1m]
  - claude-fable-5[1m]
  - sonnet
  - haiku

So the spawn-time miss looks like a cold-start model-discovery race rather than a genuinely unsupported ID — this harness boots ~24 agents concurrently (agents=24 in the startup log), and the session/new response the validation ran against apparently didn't yet include the full model list. Possibly related to #2261 (cold-start model discovery returning empty for Codex).

Net effect: even where a model channel exists for Claude Code, one silent WARN turns the user's explicit selection into "whatever the user's last interactive Claude Code session set" — which makes the failure look nondeterministic to end users.

Two suggestions beyond the model_env_var: Some("ANTHROPIC_MODEL") fix proposed above (which we agree with):

  1. Retry/defer the session/set_model validation when the advertised model list is empty or lacks the desired ID at spawn (it may simply not be populated yet), rather than falling back permanently on first miss.
  2. Surface the fallback to the user (Desktop toast or agent status), not just a harness-log WARN — today the only way to notice is to ask the agent what model it's running.

Workaround we're using (complementary to the env-var one above): a project-scoped .claude/settings.json in the buzz-acp working directory pinning "model": "opus[1m]". The adapter loads settingSources: ["user", "project", "local"], and project beats user, so agent sessions get a stable model that interactive Claude Code sessions can't churn. Verified with a headless run from that cwd resolving to claude-opus-4-8[1m].

skyerus avatar Jul 24 '26 08:07 skyerus

Fixed in #2701 — Claude runtime now injects ANTHROPIC_MODEL at spawn.

chessing234 avatar Jul 24 '26 10:07 chessing234

Confirming this still reproduces on Buzz Desktop 0.4.26 (official Block-signed build, macOS Apple Silicon, Darwin 25.2.0) with claude-agent-acp v0.62.0 — two Desktop versions after the original report, and one adapter version after the comment above.

We hit both mechanisms in this thread in sequence, which is worth noting because it makes the bug look like it "keeps coming back" from a user's perspective:

  1. Set the per-agent model to opus[1m] in the agent edit screen → restart → agent still reports claude-fable-5. That's the issue body's root cause (model_env_var: None on the claude runtime).
  2. Concluded the per-agent picker was broken, so set the global default to opus[1m] instead → restart → still claude-fable-5. That's @skyerus's comment (the BUZZ_ACP_MODEL → session/set_model exact-match miss).

From a user's seat the two are indistinguishable: every lever in the UI silently resolves to whatever ~/.claude/settings.json happens to pin.

Binary-level corroboration on 0.4.26

Consistent with the root cause in the issue body — strings on the shipped buzz-desktop binary:

$ strings -a /Applications/Buzz.app/Contents/MacOS/buzz-desktop \
    | grep -oE '(GOOSE_MODEL|BUZZ_AGENT_MODEL|ANTHROPIC_MODEL)' | sort | uniq -c
   1 ANTHROPIC_MODEL
   3 BUZZ_AGENT_MODEL
   6 GOOSE_MODEL

ANTHROPIC_MODEL appears exactly once — matching the description above that only readiness.rs knows the key, with no spawn-time injection. The runtimes that work (GOOSE_MODEL, BUZZ_AGENT_MODEL) each appear multiple times.

And the second mechanism's code path is present in the shipped buzz-acp:

$ strings -a /Applications/Buzz.app/Contents/MacOS/buzz-acp | grep BUZZ_ACP_MODEL
... Desired LLM model ID. Applied to every new ACP session after creation.
    Use `buzz-acp models` to discover available model IDs  BUZZ_ACP_MODEL

$ strings -a /Applications/Buzz.app/Contents/MacOS/buzz-acp \
    | grep -c "not found in agent's available models"
1

Warm model discovery lists the desired ID as perfectly valid, so the spawn-time miss is not an unsupported-model problem:

$ /Applications/Buzz.app/Contents/MacOS/buzz-acp models
Agent: @agentclientprotocol/claude-agent-acp v0.62.0

Models (stable configOptions):
  ? (configId: ?)
    - default (value: default)
    - opus[1m] (value: opus[1m])
    - claude-fable-5[1m] (value: claude-fable-5[1m])
    - sonnet (value: sonnet)
    - haiku (value: haiku)

Caveat, to be precise about what we did and didn't observe: we could not locate buzz-acp logs on this machine, so we have not directly seen the desired model ... not found in agent's available models WARN fire in our own sessions. Our match on mechanism 2 is from the binary containing that exact code path plus an identical symptom — not from our own log line. Mechanism 1 (the strings counts) is direct evidence.

Workaround, independently arrived at

Before finding this issue we landed on exactly the project-scoped workaround @skyerus describes: a .claude/settings.json in the buzz-acp working directory (~/.buzz for us) pinning "model": "claude-opus-5[1m]". Verified — a fresh agent session after restart now reports claude-opus-5[1m] while the user's own interactive Claude Code sessions keep ~/.claude/settings.json untouched.

Worth calling out for anyone else landing here: this workaround is arguably more robust than the ANTHROPIC_MODEL env var one, because it doesn't depend on the spawn-time model-discovery race resolving correctly. The tradeoff is that it's per-working-directory rather than per-agent, so all agents sharing a cwd get the same model.

On the fix

#2701 is still open as of this comment, so neither mechanism is fixed in 0.4.26. Strong +1 on both of @skyerus's suggestions beyond the model_env_var change — particularly surfacing the fallback in the UI. The failure mode here isn't just "wrong model," it's that the only way to discover you're on the wrong model is to ask the agent, and the model it reports is whatever the user's last interactive Claude Code session happened to set. That makes it read as nondeterministic and sends people chasing the wrong lever, as it did us.

mablesjoesph avatar Jul 26 '26 14:07 mablesjoesph

Corroborating this from another current environment rather than opening a duplicate.

Environment

  • Buzz Desktop 0.4.26 (official app)
  • macOS 26.3.2, Apple Silicon
  • claude-agent-acp 0.61.0

Reproduction

  1. Save claude-opus-5 as the managed Claude Code agent's per-agent model in Buzz.
  2. Restart the agent.
  3. Start a fresh Buzz session.

Expected: the fresh session uses the saved per-agent model.

Observed: fresh Buzz sdk-ts sessions continued to hit the same Fable 5 usage-credit failure, while interactive Claude Code on the same account was working with Opus 5. The saved Buzz change did not alter the observed effective behavior.

Evidence caveat: the failed synthetic transcript entries do not record the requested model. They prove that the saved change did not alter the observed behavior; they do not independently prove which model ID reached the adapter.

The current source path remains consistent with this report. As of main commit 4a977c588a540be38bd8ddb268cd24437bac8165 (Desktop 0.5.0), the Claude runtime still has model_env_var: None in desktop/src-tauri/src/managed_agents/discovery.rs. Main includes 925a9a7, which fixes the separate id/configId ACP model-switch lookup; that commit notes that desktop-side ANTHROPIC_MODEL injection remains in open PRs.

Banbanaste avatar Jul 28 '26 15:07 Banbanaste

Cross-linking a related report for the Cursor runtime (same silent-fallback pattern, different adapter).

Filed #4004: Desktop sets composer-2.5[fast=false] → harness env is correct (BUZZ_ACP_MODEL=composer-2.5[fast=false]) → but buzz-acp models shows Current: composer-2.5[fast=true] and Cursor usage dashboard bills everything as Fast.

Root cause appears to be cursor-agent ACP only registering Composer as composer-2.5[fast=true] (no fast=false in catalog), not missing env injection like Claude's model_env_var: None case — but the user-visible symptom is identical: model picker says one thing, session/billing says another, no error surfaced.

NocturnusCoder avatar Jul 31 '26 20:07 NocturnusCoder

Opened #4519, which addresses the "nothing applies it at spawn" half of this — though partially, so worth being precise about what it does and doesn't do.

Tracing the spawn path: resolve_model_switch_method (crates/buzz-acp/src/acp.rs:2110) matches the desired model by byte-exact equality against the harness catalog. On a miss, pool.rs:958 logs a warning and proceeds on the agent's own default.

The failure was reported to the desktop — but only as modelOverridden: false, which is also what a session with no model requested at all reports. config_bridge/reader.rs collapses both cases (if !model_overridden { … }), so a rejected pick was indistinguishable from never having picked anything. That's why the picker keeps showing your model while the agent runs another one, with nothing surfaced.

#4519 adds requestedModel + modelApplied to the session_config_captured frame and shows <model> not applied in the picker.

It does not make the model apply — a model whose id doesn't byte-match still won't be honoured. That needs alias/variant normalization (opus[1m], provider prefixes, -latest), which I deliberately left alone: #4054 pins exact-match semantics on purpose, and #3603 looks like it lands a capabilities/label registry. Someone closer to those should decide where normalization belongs.

mikececco avatar Aug 03 '26 18:08 mikececco

Confirming this on Windows 10 as well (Buzz local dev build 318fbf896, claude-agent-acp 0.64.2), so it isn't macOS-specific.

A trap in the ANTHROPIC_MODEL workaround worth flagging

The suggested workaround — adding ANTHROPIC_MODEL=<model-id> as a custom env var on the agent — collides with a separate frontend bug I hit locally: changing an agent's model in the picker serialises envVars as null, wiping all of the agent's environment variables. (desktop/src/features/agents/ui/ModelPicker.tsx; the backend in agent_models.rs correctly preserves env_vars when the field is omitted, so it's purely frontend.)

The combination is nasty:

  1. User hits this issue, applies the ANTHROPIC_MODEL workaround.
  2. User later touches the model picker for any reason.
  3. envVars is wiped — the workaround silently disappears.
  4. The agent reverts to the account default, with no error and no visible config change.

So anyone applying the workaround can have it removed by the very UI control that made the workaround necessary. This also strengthens the suggestion above about adding ANTHROPIC_MODEL to DERIVED_PROVIDER_MODEL_ENV_KEYS — deriving it removes the need for users to hand-maintain a fragile env var at all.

Knock-on effect on debugging #2698

This issue also makes #2698 materially harder to diagnose, which I ran into first-hand. Because the configured model never reaches the session, the model shown in the agent config — and echoed in the buzz-acp startup banner (… model=haiku) — is not the model actually answering. When investigating why an agent's replies were vanishing, I initially attributed behaviour to the configured model before realising it had never been applied. Anyone triaging a "weak model doesn't call buzz messages send" report on the claude runtime can't currently trust the reported model at all.

Might be worth cross-linking the two issues for that reason.

blissfire avatar Aug 04 '26 08:08 blissfire

Fresh evidence for this on Buzz Desktop (Windows 11), from a fleet where two Claude Code agents run side by side.

Consequence worth naming explicitly: two Claude agents on one machine cannot run different models. Because the spawned session falls back to the global Claude Code default instead of the per-agent selection, every Claude-harness agent on the machine converges to the same model. Selecting Opus for one agent and Sonnet for another is not expressible today — the second selection is silently ignored, and both sessions report the same model.

Measured, not assumed. We read message.model from the session transcripts (~/.claude/projects/**/*.jsonl) for both agents:

agent PM     → claude-opus-5
agent WEB    → claude-opus-5

…after the owner had set them from Desktop expecting a split. Before the change both were claude-fable-5 — i.e. they move together, which is exactly what "spawn uses the global default" predicts.

Two notes that may help whoever picks this up:

  1. The failure is silent in a way that costs money. With no per-agent model, you can't put the cheap agent on a cheap model. In one measured hour our two Claude agents burned 206.5M and 53.6M tokens; being unable to split models (or effort) means the expensive profile applies fleet-wide.
  2. There is no way to verify the effective model from Buzz. We only caught the convergence by parsing transcripts, and attributing a transcript to an agent required inferring identity from Nostr pubkeys in mention p tags (the owner's pubkey appears there but never as the message sender — no identity stamp in the transcript). Whatever the fix, exposing the effective model per agent (buzz agents list or the Desktop panel) would let users confirm it applied.

Filed the sibling gap for thinking effort as #5995 — same shape: a fleet-wide value with no per-agent override.

isabettinbirinci avatar Aug 15 '26 22:08 isabettinbirinci