Skip to content

Add unified thinking effort control across all providers#9242

Open
jh-block wants to merge 33 commits into
mainfrom
jhugo/unified-thinking-effort
Open

Add unified thinking effort control across all providers#9242
jh-block wants to merge 33 commits into
mainfrom
jhugo/unified-thinking-effort

Conversation

@jh-block
Copy link
Copy Markdown
Collaborator

@jh-block jh-block commented May 15, 2026

Replaces fragmented provider-specific thinking controls with a single unified Thinking Effort setting across supported providers.

Supersedes #7628 with the following changes:

  • Preserved legacy model suffix migration while keeping predefined model limits intact.
  • Applied unified effort to ChatGPT Codex's existing reasoning payload.
  • Honored explicit off for Codex-backed providers by omitting reasoning configuration.
  • Removed the duplicate ChatGPT Codex reasoning prompt from CLI configuration.

Also updated some providers to support reasoning where they did not (or did not fully) before:

  • OpenRouter (if the canonical metadata says the model supports reasoning)
  • Databricks (follows the serving-endpoint chain to find the underlying model and checks if it supports reasoning)

@jh-block jh-block closed this May 15, 2026
@jh-block jh-block reopened this May 15, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Documentation preview deployed: https://pr-9242.goose-pr-previews-poc.pages.dev

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e82c782f40

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/goose/src/providers/formats/openai.rs
Comment thread crates/goose/src/providers/chatgpt_codex.rs Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 19144daad0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/goose/src/providers/formats/openai.rs Outdated
Comment thread crates/goose/src/providers/formats/databricks.rs Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a2ec5b9344

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/goose/src/model.rs
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 58da4d7d21

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/goose/src/model.rs Outdated
Comment thread ui/desktop/src/components/settings/models/subcomponents/SwitchModelModal.tsx Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a051baa586

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/goose/src/model.rs
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 52c2ff265a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/goose/src/providers/utils.rs
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: aa8ac91b82

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/goose/src/providers/formats/openai_responses.rs Outdated
jh-block and others added 18 commits May 15, 2026 13:02
Adds a single ThinkingEffort enum (off/low/medium/high/max) to ModelConfig
that works across all providers, replacing the fragmented per-provider
thinking controls.

Backend:
- Add ThinkingEffort enum to model.rs with FromStr/Display, read from
  request_params['thinking_effort'] or GOOSE_THINKING_EFFORT env var
- OpenAI format: maps effort to reasoning_effort (low/medium/high)
- Anthropic format: maps effort to thinking_type and thinking_effort
- Databricks format: maps to reasoning_effort for OpenAI models and
  budget_tokens for Claude models
- Google format: maps to thinking_level (low/high) for Gemini 3
- All providers fall back to legacy config when unified effort is unset

UI:
- Replace model-specific controls (Gemini thinking level, Claude
  thinking type/effort/budget) with a single 'Thinking Effort' dropdown
- Show dropdown for any model that supports thinking (Claude, OpenAI
  reasoning models, Gemini 3)
- Persist setting via GOOSE_THINKING_EFFORT config key
Remove all legacy configuration paths:
- CLAUDE_THINKING_TYPE, CLAUDE_THINKING_EFFORT, CLAUDE_THINKING_BUDGET
- CLAUDE_THINKING_ENABLED
- GEMINI3_THINKING_LEVEL
- Model name suffix effort encoding (e.g., o3-mini-high)

All providers now use only the unified GOOSE_THINKING_EFFORT config
(via request_params or env var). The CLI configure command now shows
a single thinking effort prompt for any model that supports thinking.

Also simplifies the CLI configure flow from model-specific multi-step
thinking config to a single dropdown.
When a ModelConfig is created with a reasoning model name that has an
effort suffix (e.g., 'o3-mini-high'), normalize_effort_suffix() now
strips the suffix and sets thinking_effort in request_params. This
ensures existing saved configurations with suffixed model names
continue to work transparently.

Only applies when no explicit thinking_effort is already set in
request_params (explicit config always wins).
…st, clarify type checks

- Remove redundant local ThinkingEffort enum in anthropic.rs; use
  crate::model::ThinkingEffort directly since it has Display/FromStr
- Simplify test_create_request_enabled_thinking_with_budget using
  cfg_with_effort and assert budget > 0
- Replace !!name checks with typeof === 'string' in SwitchModelModal

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: jh-block <jhugo@block.xyz>
Signed-off-by: jh-block <jhugo@block.xyz>
Signed-off-by: jh-block <jhugo@block.xyz>
Signed-off-by: jh-block <jhugo@block.xyz>
jh-block added 5 commits May 15, 2026 13:07
Signed-off-by: jh-block <jhugo@block.xyz>
Signed-off-by: jh-block <jhugo@block.xyz>
Signed-off-by: jh-block <jhugo@block.xyz>
Signed-off-by: jh-block <jhugo@block.xyz>
Signed-off-by: jh-block <jhugo@block.xyz>
@jh-block jh-block force-pushed the jhugo/unified-thinking-effort branch from c800e5c to db5e545 Compare May 15, 2026 11:10
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: db5e54527a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/goose/src/providers/formats/anthropic.rs Outdated
jh-block added 2 commits May 15, 2026 13:42
Signed-off-by: jh-block <jhugo@block.xyz>
Signed-off-by: jh-block <jhugo@block.xyz>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 00fddd28f7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/goose/src/providers/formats/openrouter.rs Outdated
Comment thread crates/goose/src/providers/codex.rs
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ac8d84177d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/goose/src/providers/codex.rs Outdated
@jh-block jh-block force-pushed the jhugo/unified-thinking-effort branch 2 times, most recently from f2e2910 to 713ae75 Compare May 15, 2026 12:46
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 713ae756ec

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/goose/src/providers/formats/openrouter.rs Outdated
Comment thread crates/goose/src/model.rs
Signed-off-by: jh-block <jhugo@block.xyz>
@jh-block jh-block force-pushed the jhugo/unified-thinking-effort branch from 713ae75 to c0b4bce Compare May 15, 2026 13:11
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c0b4bce830

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/goose/src/providers/databricks.rs Outdated
Comment thread crates/goose/src/providers/databricks.rs
jh-block added 2 commits May 15, 2026 15:22
Signed-off-by: jh-block <jhugo@block.xyz>
Signed-off-by: jh-block <jhugo@block.xyz>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ab1783305f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread ui/desktop/src/components/settings/models/subcomponents/SwitchModelModal.tsx Outdated
Signed-off-by: jh-block <jhugo@block.xyz>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ef49673db6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/goose/src/model.rs Outdated
Signed-off-by: jh-block <jhugo@block.xyz>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6aae898ce0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread ui/desktop/src/components/settings/models/subcomponents/SwitchModelModal.tsx Outdated
Comment thread crates/goose/src/providers/formats/anthropic.rs
Signed-off-by: jh-block <jhugo@block.xyz>
@kyledef
Copy link
Copy Markdown
Contributor

kyledef commented May 15, 2026

Hey @jh-block 👋 — I was independently investigating how thinking/reasoning parameters flow across provider types in Goose and was about to start work on exactly this gap. Really glad to see this PR land first!

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b494213ec8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/goose/src/model.rs
Comment thread crates/goose/src/model.rs Outdated
Signed-off-by: jh-block <jhugo@block.xyz>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c8f0cacb4b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +768 to +772
let claude_thinking_providers = ["anthropic", "databricks"];
let supports_thinking = model.to_lowercase().starts_with("gemini-3")
|| (model.to_lowercase().contains("claude")
&& claude_thinking_providers.contains(&provider_name.as_str()))
|| goose::model::ModelConfig::new(&model)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Offer unified thinking prompt for OpenRouter Claude models

The new CLI gating excludes Claude models unless the provider is anthropic or databricks, so goose configure skips the unified GOOSE_THINKING_EFFORT prompt for OpenRouter Claude selections even though this commit adds OpenRouter reasoning support via apply_reasoning_config when a model is reasoning-capable. In practice, configuring openrouter with a reasoning Claude model (for example claude-sonnet-4*) leaves users unable to set thinking effort through the CLI path, making the new feature unavailable from the primary setup flow.

Useful? React with 👍 / 👎.

@kyledef
Copy link
Copy Markdown
Contributor

kyledef commented May 15, 2026

Great work on this — the ThinkingEffort enum and unified GOOSE_THINKING_EFFORT knob are exactly the right abstraction layer.

One gap worth flagging: local providers aren't wired up yet.

  • Ollama (formats/ollama.rs) supports "think": true in /api/chat for models like qwq and deepseek-r1, but the new ThinkingEffort enum isn't connected to it.
  • Local/llama.cpp (local_inference.rs) already has its own enable_thinking: bool in ModelSettings, but it's a separate boolean that doesn't plug into ThinkingEffort. The mapping would be straightforward: Offfalse, anything else → true.

Both of these are listed as first-class providers on the goose docs providers page, so community users running local models would benefit from the same unified knob.

The infrastructure is now in place — model_config.thinking_effort() is the right read path — so these could either be added here or as small follow-on PRs that build cleanly on this one. Happy to contribute the Ollama and local wiring if that's helpful.

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.

2 participants