Preserve thinking content for providers that require it - #8857
Conversation
There was a problem hiding this comment.
💡 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".
There was a problem hiding this comment.
💡 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".
There was a problem hiding this comment.
💡 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".
There was a problem hiding this comment.
💡 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".
DOsinga
left a comment
There was a problem hiding this comment.
LGTM. Removed the two trivial tests for format_options_for_provider (they just asserted the implementation is what it is).
Note: the original commits are missing DCO sign-off (Signed-off-by trailer). Please rebase with git rebase --signoff or amend the commits to add sign-off before merge.
|
Hey @jh-block — this PR has merge conflicts with main. Could you rebase to resolve them? Once clean we can get it moving again. |
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>
Signed-off-by: jh-block <jhugo@block.xyz>
e2ff13e to
0c36593
Compare
Signed-off-by: jh-block <jhugo@block.xyz>
Signed-off-by: jh-block <jhugo@block.xyz>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 09230b9766
ℹ️ 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".
Signed-off-by: jh-block <jhugo@block.xyz>
Signed-off-by: jh-block <jhugo@block.xyz>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1732a6670b
ℹ️ 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".
Signed-off-by: jh-block <jhugo@block.xyz>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9d2f3d557d
ℹ️ 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".
Signed-off-by: jh-block <jhugo@block.xyz>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3926d4d540
ℹ️ 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".
Signed-off-by: jh-block <jhugo@block.xyz>
Signed-off-by: jh-block <jhugo@block.xyz>
`apply_thinking_config` adds `clear_thinking: false` to the thinking object whenever `preserve_thinking_context` is set. That field is part of the manual `type: "enabled"` thinking shape used by OpenAI-compatible reasoning providers (e.g. Z.AI/GLM, added in aaif-goose#8857 to fix aaif-goose#7363), where `false` preserves prior reasoning across turns. It is not part of the adaptive thinking interface. An adaptive request carries only `{"type": "adaptive"}` alongside `output_config.effort`. For adaptive-mode models (Opus 4.6/4.7/4.8, Sonnet 4.6/5, Fable 5) the preserve-context block still stamps `clear_thinking` onto the adaptive object, producing e.g.: "thinking": { "type": "adaptive", "clear_thinking": false } The public Anthropic API tolerates the unknown key, but endpoints that validate the adaptive shape strictly reject it with a 400 (`thinking.adaptive.clear_thinking: Extra inputs are not permitted`), breaking every request for those models once thinking is on. aaif-goose#9746 widened the exposure by routing 4.7/4.8 down the adaptive path. Only emit `clear_thinking` when the resolved thinking shape is not adaptive, so GLM/enabled-shape preservation is unchanged while adaptive requests stay spec-compliant. Adds a regression test asserting an adaptive model with preserved thinking context omits `clear_thinking`.
Summary
clear_thinking: falsein OpenAI-compatible providerspreserves_thinkingflag for Anthropic-compatible providersTesting
Fixes #7363