Default agent models to the provider's default, not hardcoded Claude Sonnet - #11
Merged
Conversation
wparad
force-pushed
the
claude/gitzi-mobile-api-plan-hpgltd
branch
3 times, most recently
from
July 18, 2026 07:03
8ffceb0 to
11b7e06
Compare
main already made config::default_model empty, but two gaps remained: - AgentRole::default_agent_def (dispatcher) still returned a hardcoded "claude-sonnet-4-20250514". It was dead code (no callers) — removed it. - resolve_agent's terminal fallback was still empty (unwrap_or_default), so a role with no explicit model, no `main` fallback, and no provider default resolved to "". resolve_agent now resolves the model through a single helper resolve_model: explicit model -> the provider's `default_model` -> terminal fallback `qwen3-8b`. A provider whose `default_model` is an empty string still deliberately means "route to whatever the provider has loaded" (e.g. LM Studio GUI) and is preserved as empty; only a provider with no default, or no provider at all, falls through to qwen3-8b. Updated the resolve_agent property test to assert the new terminal fallback. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018UFD2FvZXDBaMmaXJSSQQ5
The main chat backend switched to streaming (turn_streaming sends
`stream: true` and parses a Server-Sent Events response), but the e2e mock
server only ever returned a single non-streaming JSON body. The SSE parser
found no content chunks, so the main-agent chat turn resolved to empty text and
chat_with_mock_agent_returns_response failed with "response should not be
empty" — red on main's own tip and every recent CI run.
The mock now inspects the request's `stream` flag and responds in the matching
shape: an SSE stream (data: {delta}... / [DONE]) for streaming requests, and
the original single JSON object for the non-streaming sub-agent calls.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018UFD2FvZXDBaMmaXJSSQQ5
wparad
force-pushed
the
claude/gitzi-mobile-api-plan-hpgltd
branch
from
July 20, 2026 13:17
d463df5 to
2e252b4
Compare
CI's clippy step never ran on main because the cargo test step failed first
(the e2e mock test). With that test fixed, the clippy step now runs and flags
latent lints under the newer stable toolchain (1.97):
- src/daemon/mod.rs, src/model/task.rs, src/state/review.rs and several test
files: redundant `&` in format! arguments (useless_borrows_in_formatting).
- src/main.rs: collapse an `and_then(|r| if ok { Some(r) } else { None })` into
`filter(|r| r.status().is_success())`.
- tests: collapsible if / redundant closure.
Verified on the 1.97 toolchain: cargo fmt --check, cargo clippy --all-features
(and --all-targets) -- -D warnings, and cargo test --all-features all pass.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018UFD2FvZXDBaMmaXJSSQQ5
wparad
added a commit
that referenced
this pull request
Jul 25, 2026
Default agent models to the provider's default, not hardcoded Claude Sonnet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Every agent role resolved to a hardcoded Claude Sonnet model regardless of the configured provider. This came from two hardcodes:
AgentRole::default_agent_def(src/dispatcher/mod.rs) returned"claude-sonnet-4-20250514". This function was dead code — it had no callers anywhere in the repo.config::default_model(src/config.rs) returned"claude-sonnet-4-6"as the serde/Defaultvalue forAgentDef::model, pinning any agent entry that omittedmodelto Sonnet and short-circuiting provider-based resolution. (Note:mainhas since madedefault_modelempty on its own; the remaining gaps are the two items below.)Change
The correct rule: each role defaults to the provider's own default model; if the provider has no default, fall back to
qwen3-8b.AgentRole::default_agent_def.resolve_agentresolves the model through a single helperresolve_model: explicit model → the provider'sdefault_model→ terminal fallbackqwen3-8b.default_modelis an empty string still deliberately means "route to whatever model the provider has loaded" (e.g. LM Studio) and is preserved as empty; only a provider with no default (None), or no provider at all, falls through toqwen3-8b.qwen3-8balready exists as a provider default elsewhere in the codebase (setup.rs,bootstrap.rs).resolve_agentproperty test to assert the new terminal fallback.Also fixes CI (previously red on
main)main's CI has been red ontests/e2e_pipeline.rs::chat_with_mock_agent_returns_response("response should not be empty") on its own tip and every recent run. Root cause: the main chat backend switched to streaming (turn_streamingsendsstream: trueand parses an SSE response), but the e2e mock server only ever returned a single non-streaming JSON body, so the streamed chat turn resolved to empty text. The mock now inspects the request'sstreamflag and responds in the matching shape — an SSE stream for streaming requests, the original JSON object for the non-streaming sub-agent calls.Tests
Local run matches CI exactly and is fully green:
cargo fmt --checkcleancargo clippy --all-features -- -D warningscleancargo test --all-features→ all suites pass (90 unit + every integration suite, including the previously-failinge2e_pipeline).Context
Surfaced while designing the
gitzi-apicloud backend, where model selection is per-tenant/per-provider and a universal Sonnet default is wrong.🤖 Generated with Claude Code
https://claude.ai/code/session_018UFD2FvZXDBaMmaXJSSQQ5