Skip to content

fix(desktop): honor the composer's provider/model at session spawn - #813

Merged
agentforce314 merged 1 commit into
mainfrom
fix/desktop-per-session-provider
Aug 8, 2026
Merged

fix(desktop): honor the composer's provider/model at session spawn#813
agentforce314 merged 1 commit into
mainfrom
fix/desktop-per-session-provider

Conversation

@agentforce314

Copy link
Copy Markdown
Owner

The bug you hit

agent-server failed to start: Claude OAuth request failed (400):
{"error": "invalid_grant", "error_description": "Refresh token not found or invalid"}

Two things were going on:

  1. Root cause: your default_provider is anthropic on a Claude subscription (no API key), and the OAuth refresh token has expired/invalidated — so the subscription session is dead.
  2. The real desktop bug (this PR): switching to deepseek-v4-flash should have worked around it, but didn't. clawcodex serve built one spawn closure at startup with the config's default provider and reused it for every session — the provider/model/reasoning_effort the composer sends in session.create were silently ignored. So a new session always re-booted the broken default and failed at build.

Fix

DesktopServeState now carries the base AgentServerConfig and builds a per-session spawn (dataclasses.replace + make_spawn_agent) honoring the create params' provider/model/effort. An empty selection falls back to the shared default spawn.

Verified live

session.create {provider: deepseek, model: deepseek-v4-flash} now spawns deepseek-v4-flash with no OAuth error (previously booted anthropic and died). 2 new pytest cases; 60 desktop tests green.

After pulling this, selecting deepseek in the composer runs on deepseek. To restore Claude on your subscription, re-run clawcodex login → anthropic → subscription.

🤖 Generated with Claude Code

serve built ONE spawn closure at startup with the config default provider and
reused it for every session — the provider/model/effort the desktop sends in
session.create were silently ignored. Consequence: if the default provider is
broken (an expired Claude subscription, a missing key), the app is unusable
and switching the model in the composer does NOT help, because the new
session still boots the broken default and fails at build:

    agent-server failed to start: Claude OAuth request failed (400):
    invalid_grant — Refresh token not found or invalid

Now DesktopServeState carries the base AgentServerConfig and builds a
per-session spawn (dataclasses.replace + make_spawn_agent) honoring the
create params' provider/model/reasoning_effort; an empty selection falls
back to the shared default spawn. So selecting a provider with a working key
(e.g. deepseek) actually runs on it.

Verified live: session.create {provider: deepseek, model: deepseek-v4-flash}
spawns deepseek-v4-flash with no OAuth error (previously booted anthropic).
2 new pytest cases (override reaches the spawn; no-override uses the base
spawn); 60 desktop tests green.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@agentforce314
agentforce314 enabled auto-merge (squash) August 8, 2026 16:10
@agentforce314
agentforce314 merged commit b50bea4 into main Aug 8, 2026
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.

1 participant