Skip to content

openai -> anthropic -> openai thinking fixes#2184

Merged
akshaydeo merged 3 commits into
mainfrom
03-20-openai_-_anthropic_-_openai_thinking_fixes
Mar 20, 2026
Merged

openai -> anthropic -> openai thinking fixes#2184
akshaydeo merged 3 commits into
mainfrom
03-20-openai_-_anthropic_-_openai_thinking_fixes

Conversation

@akshaydeo
Copy link
Copy Markdown
Contributor

@akshaydeo akshaydeo commented Mar 20, 2026

Summary

Implements multi-block content reconstruction for Anthropic and Bedrock providers to preserve the original structure of thinking and text blocks across multi-turn conversations. When responses contain multiple content blocks (thinking + text), they are combined into a single string with boundary metadata to enable accurate reconstruction in subsequent requests.

Changes

  • Added contentBlockMeta struct to track block types and lengths for reconstruction
  • Enhanced response conversion to combine thinking and text blocks into a single string with \n\n separators
  • Added boundary metadata storage in BifrostReasoningDetailsTypeContentBlocks reasoning details
  • Implemented reconstruction logic in request conversion that splits combined strings back into original blocks
  • Added fallback handling when content is modified (boundaries don't match)
  • Cleared thinking text from reasoning details after combining to avoid duplication
  • Added comprehensive test coverage for multi-block scenarios and edge cases

Type of change

  • Feature
  • Bug fix
  • Refactor
  • Documentation
  • Chore/CI

Affected areas

  • Core (Go)
  • Transports (HTTP)
  • Providers/Integrations
  • Plugins
  • UI (Next.js)
  • Docs

How to test

Validate the multi-block content handling with the new test cases:

# Core/Transports
go version
go test ./core/providers/anthropic/...
go test ./core/providers/bedrock/...
go test ./core/schemas/...

Test scenarios include:

  • Multiple text blocks with thinking content
  • Single text block without thinking (existing behavior preserved)
  • Boundary reconstruction from combined strings
  • Fallback behavior when content is modified

Screenshots/Recordings

N/A - Backend functionality only

Breaking changes

  • Yes
  • No

This change maintains backward compatibility while adding new functionality for multi-block content handling.

Related issues

N/A

Security considerations

The boundary metadata is stored as JSON in reasoning details and validated during reconstruction. No sensitive data is exposed, and the fallback mechanism handles tampered content gracefully.

Checklist

  • I read docs/contributing/README.md and followed the guidelines
  • I added/updated tests where appropriate
  • I updated documentation where needed
  • I verified builds succeed (Go and UI)
  • I verified the CI pipeline passes locally if applicable

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 20, 2026

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Support for tracking and reconstructing multi-part assistant content and reasoning boundaries across providers.
  • Bug Fixes

    • More robust handling and collapsing of thinking/reasoning and text segments when assembling responses.
    • Improved fallback when boundary metadata mismatches combined content.
  • Tests

    • Added unit and integration tests covering multi-part content, reasoning signatures, reconstruction, and fallback cases.
  • Chores

    • Expanded provider test configuration mappings for wider model coverage.

Walkthrough

Adds encoding/decoding of per-segment content-block boundaries between Bifrost reasoning details and provider content; updates Anthropic and Bedrock conversions to emit and consume those boundaries to collapse or reconstruct multi-part assistant content where applicable.

Changes

Cohort / File(s) Summary
Schema
core/schemas/chatcompletions.go
Added BifrostReasoningDetailsTypeContentBlocks ("bifrost.content_blocks") to carry per-segment boundary metadata.
Anthropic provider
core/providers/anthropic/chat.go
Introduced local contentBlockMeta and strings import. ToAnthropicChatRequest parses content_blocks metadata to reconstruct thinking+text blocks from a combined ContentStr (validates UTF‑8 byte lengths and \n\n separators; falls back on mismatch). ToBifrostChatResponse now collapses when all content blocks are text: concatenates thinking texts + text blocks with \n\n, emits a content_blocks reasoning entry with JSON boundary metadata when multiple segments exist, clears per-reasoning Text fields, and sets contentBlocks = nil.
Bedrock provider
core/providers/bedrock/chat.go
ToBifrostChatResponse updated to collapse whenever all contentBlocks are text: either set contentStr (single-text/no-reasoning) or join thinking + text segments with \n\n, marshal per-segment contentBlockMeta (type + UTF‑8 length) into a content_blocks reasoning entry (sorted), clear reasoning Text entries, nil contentBlocks, and only set assistant Reasoning when text exists.
Anthropic tests
core/providers/anthropic/chat_test.go
Added unit tests: collapse multi-blocks with thinking -> single ContentStr + boundary metadata; single-text collapse; reconstruct from boundary metadata; boundary-mismatch fallback; unchanged reasoning_details flow.
Python integration tests
tests/integrations/python/tests/test_openai.py
Added test_37a_chat_reasoning_content_is_string asserting chat response content is a non-empty string; test conditionally skips when provider/model reports reasoning unsupported.
Tests config
tests/integrations/python/config.json
Expanded Azure deployments mapping with additional deployment→model entries (several new keys added).

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant Anthropic
    participant Bifrost
    participant ReasoningMeta

    Client->>Anthropic: Send assistant content blocks (thinking + text blocks)
    Anthropic->>Bifrost: ToBifrostChatResponse (contentBlocks + reasoningDetails)
    Bifrost->>Bifrost: Detect all contentBlocks are Text
    Bifrost->>ReasoningMeta: Marshal per-segment contentBlockMeta (type, length)
    Bifrost->>Bifrost: Concatenate thinking/texts into contentStr (joined by "\n\n")
    Bifrost->>Client: Return collapsed contentStr and ReasoningDetails(TypeContentBlocks)
Loading
sequenceDiagram
    participant Client
    participant Bifrost
    participant Anthropic
    participant ReasoningMeta

    Client->>Bifrost: Send combined ContentStr + ReasoningDetails(TypeContentBlocks)
    Bifrost->>ReasoningMeta: Extract and unmarshal contentBlockMeta list
    Bifrost->>Anthropic: ToAnthropicChatRequest with signatures and blockMeta
    Anthropic->>Anthropic: Slice ContentStr using recorded lengths and separators
    alt lengths match
        Anthropic->>Client: Reconstructed sequence: thinking blocks + text blocks
    else mismatch
        Anthropic->>Client: Emit thinking signature-only + single text block with full ContentStr
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰
I stitch the blocks with hops and cheerful art,
lengths tell the story, boundaries do their part.
Thinking then text—I join or split with care,
metadata whispers where each piece should bear.
—The Bifrost Rabbit

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'openai -> anthropic -> openai thinking fixes' directly relates to the main change: implementing multi-block content reconstruction for thinking and text blocks across provider conversions.
Description check ✅ Passed The description comprehensively covers the PR purpose, changes, type, affected areas, testing approach, breaking changes, security, and checklist items as per template requirements.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 03-20-openai_-_anthropic_-_openai_thinking_fixes

Comment @coderabbitai help to get the list of available commands and usage tips.

@akshaydeo akshaydeo mentioned this pull request Mar 20, 2026
18 tasks
Copy link
Copy Markdown
Contributor Author

akshaydeo commented Mar 20, 2026

@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@akshaydeo akshaydeo marked this pull request as ready for review March 20, 2026 12:53
@akshaydeo akshaydeo force-pushed the 03-20-openai_-_anthropic_-_openai_thinking_fixes branch from d278115 to 3553832 Compare March 20, 2026 12:57
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@core/providers/anthropic/chat.go`:
- Around line 591-597: The loop over reasoningDetails in ToAnthropicChatRequest
currently only appends to blockMeta when rd.Text != nil, which loses
signature-only thinking blocks and misaligns later signatures; update the loop
that builds parts and blockMeta so that for every rd with Type ==
schemas.BifrostReasoningDetailsTypeText you always append a metadata entry (even
when rd.Text is nil) — use an explicit nullability marker or record an empty
string with length 0 in contentBlockMeta (or add a flag like HasText:false) so
the later reconstruction code can preserve and map signatures correctly; ensure
ToAnthropicChatRequest and any rebuild logic consume that metadata field to
avoid skipping or shifting blocks.
- Around line 365-398: The current reconstruction trusts expectedLen ==
len(combined) but doesn't validate individual block lengths or separators,
allowing negative/overflow bm.L or missing "\n\n" to cause a panic or corrupt
blocks; change the guard to validate each blockMeta entry before slicing by
ensuring every bm.L is positive, that pos+bm.L does not exceed len(combined) for
each block, and that for every inter-block boundary the two-byte separator
equals "\n\n" (or accept no separator for single blocks); if any check fails,
skip the reconstruction and keep the fallback content instead of slicing; update
the logic around expectedLen, blockMeta, combined, pos, and bm.L and ensure
sigIdx handling for AnthropicContentBlock Type Thinking remains bounded.
- Around line 342-345: In ToAnthropicChatRequest, replace the use of
encoding/json with sonic for hot-path JSON work: where rd.Type ==
schemas.BifrostReasoningDetailsTypeContentBlocks currently calls
json.Unmarshal([]byte(*rd.Text), &blockMeta), switch that to
sonic.Unmarshal([]byte(*rd.Text), &blockMeta); likewise replace the json.Marshal
call later in the same function (used to serialize the reasoning/details payload
around the previously-mentioned line ~612) with sonic.Marshal. Import and use
the sonic package and keep the same target variables (blockMeta and the existing
payload variable) so behavior is identical but uses sonic for performance.

In `@core/providers/bedrock/chat.go`:
- Around line 196-227: The current two-pass logic (appending all
reasoningDetails first then all contentBlocks) reorders segments; instead
preserve provider order by building the flattened parts and blockMeta in the
same single-pass that iterates the original sequence of segments (or by
persisting an ordered segment slice when you first parse the Bedrock response)
so the appended contentBlocks metadata matches the actual content sequence.
Replace the separate loops that build parts/blockMeta with a single ordered
iteration that, for each original item, appends the text to parts and a
contentBlockMeta (T: "thinking" or "text", L: len(...)) to blockMeta so
contentStr and the schemas.ChatReasoningDetails
(BifrostReasoningDetailsTypeContentBlocks) metadata remain lossless and in
provider order.
- Line 5: Replace the use of encoding/json's json.Marshal in the response
conversion path with sonic.Marshal: remove "encoding/json" from imports, add the
sonic package import (github.com/bytedance/sonic), and change the json.Marshal
call at the response conversion (around line 221) to sonic.Marshal; ensure the
surrounding error handling and variable names (the same as used in the function
that converts Bedrock responses) remain unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8cec0733-a97f-47e3-a0d4-b6cb7a6b7b0d

📥 Commits

Reviewing files that changed from the base of the PR and between d278115 and 3553832.

📒 Files selected for processing (5)
  • core/providers/anthropic/chat.go
  • core/providers/anthropic/chat_test.go
  • core/providers/bedrock/chat.go
  • core/schemas/chatcompletions.go
  • tests/integrations/python/tests/test_openai.py
✅ Files skipped from review due to trivial changes (1)
  • core/providers/anthropic/chat_test.go

Comment thread core/providers/anthropic/chat.go Outdated
Comment thread core/providers/anthropic/chat.go
Comment thread core/providers/anthropic/chat.go
Comment thread core/providers/bedrock/chat.go Outdated
Comment thread core/providers/bedrock/chat.go
@akshaydeo akshaydeo force-pushed the 03-20-openai_-_anthropic_-_openai_thinking_fixes branch from 3553832 to f6e7f96 Compare March 20, 2026 13:30
@akshaydeo akshaydeo force-pushed the 03-20-anthropic_header_selection_across_providers branch from df9a5e1 to 2e01dbc Compare March 20, 2026 13:30
@akshaydeo akshaydeo force-pushed the 03-20-openai_-_anthropic_-_openai_thinking_fixes branch from f6e7f96 to bb28dfb Compare March 20, 2026 14:00
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (2)
core/providers/bedrock/chat.go (1)

196-214: ⚠️ Potential issue | 🟠 Major

Preserve the original Bedrock block order when flattening.

parts and blockMeta are rebuilt as “all thinking, then all text”, even though response.Output.Message.Content was parsed in provider order above. If Bedrock ever returns interleaved reasoning/text blocks, this metadata will encode the reordered sequence, and core/providers/anthropic/chat.go at Lines 361-405 will faithfully reconstruct that wrong order instead of falling back.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@core/providers/bedrock/chat.go` around lines 196 - 214, The code currently
appends all reasoningDetails then all contentBlocks, reordering blocks; instead
iterate the original Bedrock block sequence (response.Output.Message.Content or
the variable holding parsed blocks) and for each block append to parts and
blockMeta in that exact order, mapping reasoning blocks to
contentBlockMeta{T:"thinking", L:...} and text blocks to
contentBlockMeta{T:"text", L:...}; use the existing contentBlocks,
reasoningDetails and contentBlockMeta types and the
schemas.BifrostReasoningDetailsTypeText check to decide which source/text to use
so the flattened parts and blockMeta preserve the original provider order.
core/providers/anthropic/chat.go (1)

361-405: ⚠️ Potential issue | 🔴 Critical

Treat invalid bifrost.content_blocks metadata as a full fallback.

expectedLen == len(combined) is not a safe guard. A crafted payload can still use negative/oversized lengths or bad separators and panic at Line 379, and the fallback branch leaves the pre-appended thinking blocks in content, so stale signatures/thinking are sent back alongside the modified text. Validate each entry (bm.T, bm.L, separator) before slicing, and clear content before any fallback to the single text block.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@core/providers/anthropic/chat.go` around lines 361 - 405, The code currently
assumes blockMeta entries are sane and slices combined blindly, which can panic
and also leaves pre-appended thinking blocks in content on fallback; update the
reconstruction in the handler that reads msg.Content.ContentStr/combined to
fully validate each bm before slicing: ensure bm.L is a positive integer, bm.T
is one of the expected values (e.g., "thinking" or text), check that pos+bm.L <=
len(combined) for each block and that separators ("\n\n") exist between blocks
at the expected positions, and only append reconstructed AnthropicContentBlock
entries (AnthropicContentBlockTypeThinking/AnthropicContentBlockTypeText) after
all checks pass; clear content (content = content[:0]) before attempting
reconstruction and also clear it immediately before taking the single-text
fallback so no stale thinking/signature blocks remain; handle signature indexing
safely (only consume signatures when bm.T == "thinking" and guard sigIdx <
len(signatures)), and if any validation fails, skip reconstruction and use the
cleared-content single AnthropicContentBlock fallback from
msg.Content.ContentStr.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@tests/integrations/python/tests/test_openai.py`:
- Around line 2145-2148: The except block in the test currently only skips when
the error message contains "does not support" or "not available"; broaden this
check to also detect "not supported" (and any similar common phrasing used for
chat reasoning rejection) so the test will skip the same providers as
test_38_responses_reasoning; update the conditional that examines error_str
(from except Exception as e) to include "not supported" (case-insensitive)
alongside the existing checks and keep the pytest.skip call for consistency.

---

Duplicate comments:
In `@core/providers/anthropic/chat.go`:
- Around line 361-405: The code currently assumes blockMeta entries are sane and
slices combined blindly, which can panic and also leaves pre-appended thinking
blocks in content on fallback; update the reconstruction in the handler that
reads msg.Content.ContentStr/combined to fully validate each bm before slicing:
ensure bm.L is a positive integer, bm.T is one of the expected values (e.g.,
"thinking" or text), check that pos+bm.L <= len(combined) for each block and
that separators ("\n\n") exist between blocks at the expected positions, and
only append reconstructed AnthropicContentBlock entries
(AnthropicContentBlockTypeThinking/AnthropicContentBlockTypeText) after all
checks pass; clear content (content = content[:0]) before attempting
reconstruction and also clear it immediately before taking the single-text
fallback so no stale thinking/signature blocks remain; handle signature indexing
safely (only consume signatures when bm.T == "thinking" and guard sigIdx <
len(signatures)), and if any validation fails, skip reconstruction and use the
cleared-content single AnthropicContentBlock fallback from
msg.Content.ContentStr.

In `@core/providers/bedrock/chat.go`:
- Around line 196-214: The code currently appends all reasoningDetails then all
contentBlocks, reordering blocks; instead iterate the original Bedrock block
sequence (response.Output.Message.Content or the variable holding parsed blocks)
and for each block append to parts and blockMeta in that exact order, mapping
reasoning blocks to contentBlockMeta{T:"thinking", L:...} and text blocks to
contentBlockMeta{T:"text", L:...}; use the existing contentBlocks,
reasoningDetails and contentBlockMeta types and the
schemas.BifrostReasoningDetailsTypeText check to decide which source/text to use
so the flattened parts and blockMeta preserve the original provider order.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 90ce7a9a-47f0-441f-8ebf-f3d0b5c71268

📥 Commits

Reviewing files that changed from the base of the PR and between 3553832 and f6e7f96.

📒 Files selected for processing (5)
  • core/providers/anthropic/chat.go
  • core/providers/anthropic/chat_test.go
  • core/providers/bedrock/chat.go
  • core/schemas/chatcompletions.go
  • tests/integrations/python/tests/test_openai.py
✅ Files skipped from review due to trivial changes (1)
  • core/providers/anthropic/chat_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • core/schemas/chatcompletions.go

Comment thread tests/integrations/python/tests/test_openai.py
@akshaydeo akshaydeo force-pushed the 03-20-openai_-_anthropic_-_openai_thinking_fixes branch from bb28dfb to c9f2418 Compare March 20, 2026 14:06
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@core/providers/bedrock/chat.go`:
- Around line 219-227: The code currently appends a synthetic
bifrost.content_blocks entry (via blockMeta ->
schemas.BifrostReasoningDetailsTypeContentBlocks) which makes reasoningDetails
non-empty and later causes assistantMessage.Reasoning to be set to an empty
string; keep the metadata append (the blockMeta -> reasoningDetails logic) but
change the assignment to assistantMessage.Reasoning to only occur when
reasoningText != "" (i.e., only populate assistantMessage.Reasoning if
reasoningText is non-empty), ensuring the check happens after building
reasoningText and before assigning to assistantMessage.Reasoning in the function
that processes reasoningDetails/assistantMessage.
- Around line 16-17: Update the struct field comment for L to accurately reflect
that it stores byte length: change the comment for the L field (the struct
containing fields T and L) from "// length in characters" to "// length in UTF-8
bytes" in both locations where that struct is defined; ensure you update the
comments in the definitions referenced (the struct with fields T string
`json:"t"` and L int `json:"l"`) so they match the rest of the implementation
that uses len() and byte offsets.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4a320e0c-981d-4a44-af00-0a1990b156e3

📥 Commits

Reviewing files that changed from the base of the PR and between f6e7f96 and c9f2418.

📒 Files selected for processing (5)
  • core/providers/anthropic/chat.go
  • core/providers/anthropic/chat_test.go
  • core/providers/bedrock/chat.go
  • core/schemas/chatcompletions.go
  • tests/integrations/python/tests/test_openai.py
✅ Files skipped from review due to trivial changes (2)
  • core/providers/anthropic/chat_test.go
  • core/providers/anthropic/chat.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • core/schemas/chatcompletions.go

Comment thread core/providers/bedrock/chat.go Outdated
Comment thread core/providers/bedrock/chat.go
@akshaydeo akshaydeo force-pushed the 03-20-openai_-_anthropic_-_openai_thinking_fixes branch from c9f2418 to 136f38b Compare March 20, 2026 16:20
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
tests/integrations/python/tests/test_openai.py (1)

2116-2120: Avoid gating this cross-provider test on only the OpenAI key.

@skip_if_no_api_key("openai") can skip Line 2120’s provider-parametrized test even when other providers are configured and testable. Prefer provider-specific skip logic inside the test body.

Proposed adjustment
-@skip_if_no_api_key("openai")
 `@pytest.mark.parametrize`(
     "provider,model,vk_enabled", get_cross_provider_params_with_vk_for_scenario("thinking")
 )
 def test_37a_chat_reasoning_content_is_string(self, test_config, provider, model, vk_enabled):
     """Test Case 37a: Chat completion with reasoning returns content as string, not array"""
+    try:
+        get_api_key(provider)
+    except ValueError:
+        pytest.skip(f"No API key available for {provider}")
+
     client = get_provider_openai_client(provider, vk_enabled=vk_enabled)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/integrations/python/tests/test_openai.py` around lines 2116 - 2120, The
test decorator `@skip_if_no_api_key`("openai") on
test_37a_chat_reasoning_content_is_string incorrectly gates a cross-provider
parametrized test; remove that decorator and perform provider-specific skipping
inside the test body instead (use the existing helper by calling
skip_if_no_api_key(provider) or pytest.skip when the given provider lacks
credentials). Update the test that uses
get_cross_provider_params_with_vk_for_scenario("thinking") to check the current
provider at the top of test_37a_chat_reasoning_content_is_string and bail only
for the missing-provider case.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@tests/integrations/python/tests/test_openai.py`:
- Around line 2116-2120: The test decorator `@skip_if_no_api_key`("openai") on
test_37a_chat_reasoning_content_is_string incorrectly gates a cross-provider
parametrized test; remove that decorator and perform provider-specific skipping
inside the test body instead (use the existing helper by calling
skip_if_no_api_key(provider) or pytest.skip when the given provider lacks
credentials). Update the test that uses
get_cross_provider_params_with_vk_for_scenario("thinking") to check the current
provider at the top of test_37a_chat_reasoning_content_is_string and bail only
for the missing-provider case.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 99d51c1b-1df6-4f75-85b4-75889db1900d

📥 Commits

Reviewing files that changed from the base of the PR and between c9f2418 and 136f38b.

📒 Files selected for processing (6)
  • core/providers/anthropic/chat.go
  • core/providers/anthropic/chat_test.go
  • core/providers/bedrock/chat.go
  • core/schemas/chatcompletions.go
  • tests/integrations/python/config.json
  • tests/integrations/python/tests/test_openai.py
✅ Files skipped from review due to trivial changes (3)
  • core/schemas/chatcompletions.go
  • core/providers/anthropic/chat.go
  • core/providers/anthropic/chat_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • core/providers/bedrock/chat.go

Copy link
Copy Markdown
Contributor Author

akshaydeo commented Mar 20, 2026

Merge activity

  • Mar 20, 4:42 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Mar 20, 4:46 PM UTC: @akshaydeo merged this pull request with Graphite.

@akshaydeo akshaydeo changed the base branch from 03-20-anthropic_header_selection_across_providers to graphite-base/2184 March 20, 2026 16:44
@akshaydeo akshaydeo changed the base branch from graphite-base/2184 to main March 20, 2026 16:44
@akshaydeo akshaydeo merged commit 6c0d7cf into main Mar 20, 2026
2 of 5 checks passed
@akshaydeo akshaydeo deleted the 03-20-openai_-_anthropic_-_openai_thinking_fixes branch March 20, 2026 16:46
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