Skip to content

fix(desktop): Claude model picks + agent avatars after restart - #2701

Open
Chessing234 wants to merge 4 commits into
block:mainfrom
Chessing234:fix/claude-model-avatar-bugs
Open

fix(desktop): Claude model picks + agent avatars after restart#2701
Chessing234 wants to merge 4 commits into
block:mainfrom
Chessing234:fix/claude-model-avatar-bugs

Conversation

@Chessing234

Copy link
Copy Markdown
Contributor

Summary

  • Claude Code agents honor the Edit Agent model picker via ANTHROPIC_MODEL at spawn
  • Agents screen keeps custom avatars after restart by preferring the managed agent URL

Test plan

  • just ci
  • Set a Claude Code agent model ≠ global default → restart → ask which model it is
  • Set a custom agent avatar → quit/relaunch Buzz → Agents screen still shows it

Closes #2692
Closes #2576

Made with Cursor

@bosoud

bosoud commented Jul 24, 2026

Copy link
Copy Markdown

Heads up: #2695 (opened earlier today, also fixing #2692) carries this same fix — model_env_var: Some(ANTHROPIC_MODEL) + the derived-key addition, with two extras worth keeping whichever PR moves forward:

  • a shared ANTHROPIC_MODEL_ENV_KEY const in env_vars.rs referenced by the runtime entry, the derived-key list, and the existing literal in readiness.rs's provider-model mapping — three call sites, one definition, so the key can't drift;
  • a regression test pinning the claude runtime shape itself (known_acp_runtime_exact("claude").model_env_var == Some("ANTHROPIC_MODEL"), provider still locked).

No attachment to whose lands — happy to close #2695 if you'd rather fold the const + readiness dedup in here (the avatar fix bundled in this PR is orthogonal either way), or rebase mine if you prefer to split. Maintainers' call.

@Chessing234

Copy link
Copy Markdown
Contributor Author

Folded in the shared ANTHROPIC_MODEL_ENV_KEY + claude runtime shape regression from #2695. Avatar fix stays here; fine if you close #2695 as duplicate.

wpfleger96 pushed a commit that referenced this pull request Jul 28, 2026
…itch (#2795)

## Summary

Fixes #2794. Related: #2692.

`resolve_model_switch_method()` reads the `configId` key from each
`session/new` `configOptions` entry and skips entries that lack it.
`claude-agent-acp` (v0.61.0) keys its entries with `id`, so every
model-category entry was skipped, the desired model never matched, and
Claude Code sessions fell back to the CLI default from the user's
`~/.claude/settings.json`. The only trace was a `pool::model` WARN that
never reaches the per-agent log files.

This is the ACP-side half of the symptom reported in #2692. The open
desktop-side PRs (#2695, #2701, #2696) inject `ANTHROPIC_MODEL` at
spawn, which masks the problem for spawn-time selection but leaves the
config-option switch path broken.

## Changes

- `resolve_model_switch_method()` accepts either `configId` or `id` when
extracting the config id. The set request is unchanged: the ACP SDK
schema takes `configId` as the request param and the adapter resolves it
against its `id`-keyed entries, so only the read side needed fixing.
- Regression test with an `id`-keyed `configOptions` payload mirroring
the real adapter response (including `models: null`, so the unstable
fallback path cannot rescue the match).
- Doc comment on `extract_model_config_options()` notes the key drift.

## Testing

`cargo test -p buzz-acp --lib`: 599 passed, 0 failed. The new test fails
on main and passes with this change.

Verified against the real adapter: a stdio JSON-RPC probe of the bundled
`claude-agent-acp` 0.61.0 confirms `session/new` returns `id`-keyed
config options with `opus[1m]` present as a value, and the SDK's
`SetSessionConfigOptionRequest` schema accepts `{sessionId, configId,
value}` as sent by `session_set_config_option()`.

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

Signed-off-by: chillerno1 <gh.chiller@pm.me>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
@cameronhotchkies cameronhotchkies added the triage-ready Appropriate for agentic review label Jul 28, 2026
@Chessing234
Chessing234 force-pushed the fix/claude-model-avatar-bugs branch from b0b2db9 to e6c5769 Compare July 29, 2026 14:35
Chessing234 and others added 4 commits July 29, 2026 17:42
Wire the claude runtime's model_env_var so Edit Agent selections reach
spawned sessions, and treat ANTHROPIC_MODEL as a derived key.

Closes block#2692

Signed-off-by: Taksh <takshkothari09@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Prefer the managed agent avatar URL before the profile query cache so
custom icons don't flash to monograms on cold start.

Closes block#2576

Signed-off-by: Taksh <takshkothari09@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Single const for discovery, derived-key filter, and readiness so the key cannot drift; pin claude runtime shape with a regression test.

Signed-off-by: Taksh <takshkothari09@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Move the regression test into a sibling module so discovery/tests.rs
does not grow past the over-limit baseline.

Signed-off-by: Taksh <takshkothari09@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@Chessing234
Chessing234 force-pushed the fix/claude-model-avatar-bugs branch from e6c5769 to 63a2c01 Compare July 29, 2026 14:45
@Chessing234

Copy link
Copy Markdown
Contributor Author

Rebased onto latest main to pick up nostr 0.44.6 (RUSTSEC-2026-0216) and the file-size ratchet baseline. Local Desktop file-size check is clean against current main.

CI workflows are waiting on maintainer approval for this fork push — please Approve and run workflows when you can.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

triage-ready Appropriate for agentic review

Projects

None yet

3 participants