Skip to content

Preserve thinking content for providers that require it#8857

Open
jh-block wants to merge 5 commits intomainfrom
jhugo/investigate-issue-7363
Open

Preserve thinking content for providers that require it#8857
jh-block wants to merge 5 commits intomainfrom
jhugo/investigate-issue-7363

Conversation

@jh-block
Copy link
Copy Markdown
Collaborator

@jh-block jh-block commented Apr 27, 2026

Summary

  • Support clear_thinking: false in OpenAI-compatible providers
  • Fix possible duplicate reasoning content in streaming OpenAI-compatible code path
  • Add a declarative preserves_thinking flag for Anthropic-compatible providers
  • Add a built-in Z.AI declarative provider (Anthropic-compatible) that enables preserved thinking

Testing

  • Added unit tests for declarative provider deserialization and Anthropic formatting behavior
  • Added regression tests for OpenAI streaming reasoning around tool calls

Fixes #7363

@jh-block jh-block changed the title Add declarative Anthropic thinking preservation support Preserve thinking content for providers that require it Apr 27, 2026
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: a02a417871

ℹ️ 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
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: 81da1fb0e5

ℹ️ 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/formats/openai.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: fd13ad1937

ℹ️ 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
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: 95a5facfa1

ℹ️ 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".

model_doc_link: None,
setup_steps: vec![],
fast_model: None,
preserves_thinking: false,
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 Allow custom providers to opt into preserved thinking

Fresh evidence after the earlier custom_deepseek concern: this commit marks built-in JSONs as preserves_thinking: true, but newly created custom providers are now hardcoded to preserves_thinking: false here, and the create/update request types still expose no way to set it. Since format_messages_with_options in providers/formats/openai.rs now sends reasoning_content only when that flag is enabled, custom OpenAI-compatible providers that depend on reasoning replay can silently lose tool-call continuation context unless users manually edit provider JSON.

Useful? React with 👍 / 👎.

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.

GLM-4.7/GLM-5 (Z.AI) loses reasoning state between turns causing infinite loops

1 participant