Skip to content

fix: handle reasoning content blocks in OpenAI-compat streaming parser#8078

Merged
wpfleger96 merged 1 commit intomainfrom
wpfleger/fix-databricks-reasoning-streaming
Mar 23, 2026
Merged

fix: handle reasoning content blocks in OpenAI-compat streaming parser#8078
wpfleger96 merged 1 commit intomainfrom
wpfleger/fix-databricks-reasoning-streaming

Conversation

@wpfleger96
Copy link
Collaborator

@wpfleger96 wpfleger96 commented Mar 23, 2026

Summary

Adaptive thinking (#7944) sends thinking.type = "adaptive" to Databricks for Claude 4.6 models, but the OpenAI-compat streaming parser can't deserialize the resulting reasoning chunks. This causes all streaming responses to fail for Claude Opus 4.6 and Sonnet 4.6 via Databricks.

Root Cause

Databricks returns content blocks like {"type":"reasoning","summary":[...]} which lack a text field. ContentPart in openai.rs requires text: String, so serde deserialization fails with data did not match any variant of untagged enum DeltaContent.

Fix

  • Make ContentPart.text optional (StringOption<String> with #[serde(default)])
  • Update extract_content_and_signature to use filter_map + as_deref() for the now-optional text

Reasoning content parts are already filtered out by the existing filter(|p| p.r#type == "text"), so they don't affect text extraction. Reasoning is captured separately via Delta.reasoning_content / Delta.reasoning_details.

Fixes #8077

Adaptive thinking (#7944) sends `thinking.type = "adaptive"` to
Databricks for Claude 4.6 models, but the OpenAI-compat streaming
parser in openai.rs can't deserialize the resulting reasoning chunks.
Databricks returns `{"type":"reasoning","summary":[...]}` content
blocks which lack the `text` field that `ContentPart` requires.

Make `ContentPart.text` optional so reasoning blocks deserialize
without failing. The existing `filter(|p| p.r#type == "text")` in
`extract_content_and_signature` already skips non-text parts, so
reasoning content is naturally ignored at the extraction layer
(reasoning is captured separately via `Delta.reasoning_content`).

Fixes #8077
Copy link

@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: 3a3c91940d

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@wpfleger96 wpfleger96 enabled auto-merge March 23, 2026 21:35
@wpfleger96 wpfleger96 added this pull request to the merge queue Mar 23, 2026
Merged via the queue into main with commit ce160b1 Mar 23, 2026
21 of 22 checks passed
@wpfleger96 wpfleger96 deleted the wpfleger/fix-databricks-reasoning-streaming branch March 23, 2026 21:48
wpfleger96 added a commit that referenced this pull request Mar 23, 2026
* origin/main:
  fix: handle reasoning content blocks in OpenAI-compat streaming parser (#8078)
  chore(acp): build native packages on latest mac (#8075)
  Display delegate sub agents logs in UI (#7519)
  Update tar version to avoid CVE-2026-33056 (#8073)
  refactor: consolidate duplicated dependencies into workspace (#8041)
  tui: set up for publishing via github actions (#8020)
  feat: feature-gate local inference dependencies (#7976)
  feat: ability to manage sub recipes in desktop ui (#6360)
lifeizhou-ap added a commit that referenced this pull request Mar 24, 2026
* main: (37 commits)
  fix: handle reasoning content blocks in OpenAI-compat streaming parser (#8078)
  chore(acp): build native packages on latest mac (#8075)
  Display delegate sub agents logs in UI (#7519)
  Update tar version to avoid CVE-2026-33056 (#8073)
  refactor: consolidate duplicated dependencies into workspace (#8041)
  tui: set up for publishing via github actions (#8020)
  feat: feature-gate local inference dependencies (#7976)
  feat: ability to manage sub recipes in desktop ui (#6360)
  Tweak the release process: no more merge to main (#7994)
  fix: gemini models via databricks (#8042)
  feat(apps): Pass toolInfo to MCP Apps via hostContext (#7506)
  fix: remove configured marker when deleting oauth provider configuration (#7887)
  docs: add vmware-aiops MCP extension documentation (#8055)
  Show setup instructions for ACP providers in settings modal (#8065)
  deps: replace sigstore-verification with sigstore-verify to kill vulns (#8064)
  feat(acp): add session/set_config and stabilize list, delete and close (#7984)
  docs: Correct `gosoe` typo to `goose` (#8062)
  fix: use default provider and model when provider in session no longer exists (#8035)
  feat: add GOOSE_SHELL env var to configure preferred shell (#7909)
  fix(desktop): fullscreen header bar + always-visible close controls (#8033)
  ...
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.

bug: Databricks streaming parser fails on adaptive thinking response chunks

2 participants