fix: remove Option from model listing return types, propagate errors#7074
Merged
codefromthecrypt merged 1 commit intomainfrom Feb 9, 2026
Merged
fix: remove Option from model listing return types, propagate errors#7074codefromthecrypt merged 1 commit intomainfrom
codefromthecrypt merged 1 commit intomainfrom
Conversation
Remove the Option wrapper from fetch_supported_models and fetch_recommended_models. An empty vec already means "no models" so the Option added complexity with no value. Dynamic providers now propagate errors instead of swallowing them into Ok(None). This ensures misconfigured providers surface errors to the desktop and CLI rather than silently returning no models. Signed-off-by: Adrian Cole <adrian@tetrate.io>
10 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
This PR simplifies provider model-listing APIs by removing Option wrappers (empty Vec now consistently means “no models”) and changes multiple dynamic providers to propagate model-listing errors instead of silently returning no results, so misconfiguration is surfaced to the CLI/desktop/server.
Changes:
- Update
Providertrait model-listing methods to returnResult<Vec<String>, ProviderError>and adjust call sites accordingly. - Update multiple providers (e.g., OpenRouter, Tetrate, Databricks, LiteLLM) to return errors for request/parse/API failures instead of
Ok(None). - Update server/CLI/tests and supporting utilities to use the new semantics (empty list vs error).
Reviewed changes
Copilot reviewed 27 out of 27 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| crates/goose/src/providers/base.rs | Changes trait defaults and recommended-model filtering to use Vec<String> (empty means none). |
| crates/goose/src/providers/openrouter.rs | Propagates request/parse/API errors; returns Vec<String> directly. |
| crates/goose/src/providers/tetrate.rs | Propagates JSON/shape/API errors; removes “warn + None” fallback. |
| crates/goose/src/providers/databricks.rs | Propagates fetch/parse/status errors; returns Vec<String>. |
| crates/goose/src/providers/litellm.rs | Propagates fetch errors instead of warning + None. |
| crates/goose/src/providers/openai_compatible.rs | Returns Vec<String> and errors on unexpected response shape. |
| crates/goose/src/providers/openai.rs | Returns Vec<String> (no Option). |
| crates/goose/src/providers/anthropic.rs | Returns Vec<String> and errors on missing data array. |
| crates/goose/src/providers/google.rs | Returns Vec<String> and errors on missing models array. |
| crates/goose/src/providers/githubcopilot.rs | Returns Vec<String> and errors on missing data array. |
| crates/goose/src/providers/ollama.rs | Returns Vec<String> (no Option). |
| crates/goose/src/providers/venice.rs | Returns Vec<String> (no Option). |
| crates/goose/src/providers/gcpvertexai.rs | Returns filtered Vec<String> (no Option). |
| crates/goose/src/providers/lead_worker.rs | Combines lead/worker model lists under new non-Option contract. |
| crates/goose/src/providers/snowflake.rs | Adds fetch_supported_models returning known models. |
| crates/goose/src/providers/bedrock.rs | Adds fetch_supported_models returning known models. |
| crates/goose/src/providers/codex.rs | Returns known models as Vec<String> (no Option). |
| crates/goose/src/providers/chatgpt_codex.rs | Returns known models as Vec<String> (no Option). |
| crates/goose/src/providers/claude_code.rs | Adds fetch_supported_models returning known models. |
| crates/goose/src/providers/gemini_cli.rs | Adds fetch_supported_models returning known models. |
| crates/goose/src/providers/cursor_agent.rs | Adds fetch_supported_models returning known models. |
| crates/goose/src/providers/auto_detect.rs | Updates detection logic to treat empty list as “no match”. |
| crates/goose/src/providers/canonical/build_canonical_models.rs | Adapts canonical model build/check tool to new return type. |
| crates/goose/src/agents/reply_parts.rs | Adapts enhanced error messaging to new model-listing semantics. |
| crates/goose-server/src/routes/config_management.rs | Removes declarative-provider static model short-circuit; returns models directly on Ok(Vec). |
| crates/goose-cli/src/commands/configure.rs | Uses “non-empty list => select” else free-text under new API. |
| crates/goose/tests/providers.rs | Updates model listing test to assume Vec<String> return. |
Comments suppressed due to low confidence (1)
crates/goose-server/src/routes/config_management.rs:387
- Removing the declarative-provider fast path changes this endpoint from returning the static
config.modelslist to returning a 400 when the provider isn’t configured, which can break UI flows that rely on model names being available before credentials/network access; consider restoring a fallback forProviderType::Declarative/Customwhenload_providersucceeds (at least forrequires_auth == falseor when a static models list is present).
pub async fn get_provider_models(
Path(name): Path<String>,
) -> Result<Json<Vec<String>>, ErrorResponse> {
let all = get_providers().await.into_iter().collect::<Vec<_>>();
let Some((metadata, provider_type)) = all.into_iter().find(|(m, _)| m.name == name) else {
return Err(ErrorResponse::bad_request(format!(
"Unknown provider: {}",
name
)));
};
if !check_provider_configured(&metadata, provider_type) {
return Err(ErrorResponse::bad_request(format!(
"Provider '{}' is not configured",
name
)));
}
michaelneale
approved these changes
Feb 9, 2026
Collaborator
michaelneale
left a comment
There was a problem hiding this comment.
this makes a lot of sense to me - I don't know exactly what flow on effects are and not hand tested, but this has always frustrated me - just need to put one in most of the time.
tlongwell-block
added a commit
that referenced
this pull request
Feb 9, 2026
* origin/main: (55 commits) test(mcp): add image tool test and consolidate MCP test fixtures (#7019) fix: remove Option from model listing return types, propagate errors (#7074) fix: lazy provider creation for goose acp (#7026) (#7066) Smoke tests: split compaction test and use debug build (#6984) fix(deps): trim bat to resolve RUSTSEC-2024-0320 (#7061) feat: expose AGENT_SESSION_ID env var to extension child processes (#7072) fix: add XML tool call parsing fallback for Qwen3-coder via Ollama (#6882) Remove clippy too_many_lines lint and decompose long functions (#7064) refactor: move disable_session_naming into AgentConfig (#7062) Add global config switch to disable automatic session naming (#7052) docs: add blog post - 8 Things You Didn't Know About Code Mode (#7059) fix: ensure animated elements are visible when prefers-reduced-motion is enabled (#7047) Show recommended model on failture (#7040) feat(ui): add session content search via API (#7050) docs: fix img url (#7053) Desktop UI for deleting custom providers (#7042) Add blog post: How I Used RPI to Build an OpenClaw Alternative (#7051) Remove build-dependencies section from Cargo.toml (#6946) add /rp-why skill blog post (#6997) fix: fix snake_case function names in code_execution instructions (#7035) ... # Conflicts: # scripts/test_subrecipes.sh
jh-block
added a commit
that referenced
this pull request
Feb 9, 2026
* origin/main: (54 commits) chore: strip posthog for sessions/models/daily only (#7079) tidy: clean up old benchmark and add gym (#7081) fix: use command.process_group(0) for CLI providers, not just MCP (#7083) added build notify (#6891) test(mcp): add image tool test and consolidate MCP test fixtures (#7019) fix: remove Option from model listing return types, propagate errors (#7074) fix: lazy provider creation for goose acp (#7026) (#7066) Smoke tests: split compaction test and use debug build (#6984) fix(deps): trim bat to resolve RUSTSEC-2024-0320 (#7061) feat: expose AGENT_SESSION_ID env var to extension child processes (#7072) fix: add XML tool call parsing fallback for Qwen3-coder via Ollama (#6882) Remove clippy too_many_lines lint and decompose long functions (#7064) refactor: move disable_session_naming into AgentConfig (#7062) Add global config switch to disable automatic session naming (#7052) docs: add blog post - 8 Things You Didn't Know About Code Mode (#7059) fix: ensure animated elements are visible when prefers-reduced-motion is enabled (#7047) Show recommended model on failture (#7040) feat(ui): add session content search via API (#7050) docs: fix img url (#7053) Desktop UI for deleting custom providers (#7042) ...
9 tasks
3 tasks
lifeizhou-ap
added a commit
that referenced
this pull request
Feb 11, 2026
* main: (85 commits) Fix 'Edit In Place' and 'Fork Session' features (#6970) Fix: Only send command content to command injection classifier (excluding part of tool call dict) (#7082) Docs: require auth optional for custom providers (#7098) fix: improve text-muted contrast for better readability (#7095) Always sync bundled extensions (#7057) feat: Add tom (Top Of Mind) platform extension (#7073) chore(docs): update GOOSE_SESSION_ID -> AGENT_SESSION_ID (#6669) fix(ci): switch from cargo-audit to cargo-deny for advisory scanning (#7032) chore(deps): bump @isaacs/brace-expansion from 5.0.0 to 5.0.1 in /evals/open-model-gym/suite (#7085) chore(deps): bump @modelcontextprotocol/sdk from 1.25.3 to 1.26.0 in /evals/open-model-gym/mcp-harness (#7086) fix: switch to windows msvc (#7080) fix: allow unlisted models for CLI providers (#7090) Use goose port (#7089) chore: strip posthog for sessions/models/daily only (#7079) tidy: clean up old benchmark and add gym (#7081) fix: use command.process_group(0) for CLI providers, not just MCP (#7083) added build notify (#6891) test(mcp): add image tool test and consolidate MCP test fixtures (#7019) fix: remove Option from model listing return types, propagate errors (#7074) fix: lazy provider creation for goose acp (#7026) (#7066) ...
Tyler-Hardin
pushed a commit
to Tyler-Hardin/goose
that referenced
this pull request
Feb 11, 2026
…lock#7074) Signed-off-by: Adrian Cole <adrian@tetrate.io>
Tyler-Hardin
pushed a commit
to Tyler-Hardin/goose
that referenced
this pull request
Feb 11, 2026
…lock#7074) Signed-off-by: Adrian Cole <adrian@tetrate.io>
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.
Summary
Remove
Optionfromfetch_supported_modelsandfetch_recommended_modelsreturn types. An empty vec already means "no models" — theOptionwrapper just forced every caller to handleNonedifferently.Additionally, dynamic providers now propagate errors instead of swallowing them into
Ok(None). This ensures misconfigured providers (e.g. bad credentials, unreachable host) surface errors to the desktop and CLI rather than silently returning no models.Type of Change
AI Assistance
Testing
providers test with ollama:
Details
Related Issues
Obviates #7065