Skip to content

accepts output_text user blocks in complexity extraction - #5600

Open
kohlivrinda wants to merge 1 commit into
devfrom
07-28-accepts_output_text_user_blocks_in_complexity_extraction
Open

accepts output_text user blocks in complexity extraction#5600
kohlivrinda wants to merge 1 commit into
devfrom
07-28-accepts_output_text_user_blocks_in_complexity_extraction

Conversation

@kohlivrinda

@kohlivrinda kohlivrinda commented Jul 28, 2026

Copy link
Copy Markdown
Member

Summary

The Anthropic→Responses conversion path tags user text blocks as output_text (rather than input_text) when routing through bedrock/-prefixed models via the keepToolsGrouped path. Previously, isResponsesInputTextBlock only accepted empty or input_text typed blocks, causing complexity extraction to silently skip these blocks and fall through to the default routing rule — effectively disabling complexity-based routing for Claude Code traffic using a bedrock/ alias.

Changes

  • isResponsesInputTextBlock now also accepts output_text-typed blocks so that user text arriving via the Anthropic→Responses conversion is correctly treated as plain text during complexity extraction.
  • A regression test covering this scenario was added: a Responses request with a user message block typed as output_text must still yield a valid LastUserText and SystemText from buildComplexityInput.

Type of change

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

Affected areas

  • Core (Go)
  • Transports (HTTP)
  • Providers/Integrations
  • Plugins
  • UI (React)
  • Docs

How to test

go test ./plugins/governance/...

The new test TestBuildComplexityInput_ResponsesOutputTextTypedUserBlocks should pass, confirming that output_text-typed user blocks are correctly extracted as LastUserText during complexity classification.

Breaking changes

  • Yes
  • No

Related issues

Security considerations

None. This change only affects how content block types are interpreted during complexity routing classification.

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

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Responses complexity extraction now treats output_text content blocks as text, with a unit test covering user and system text extraction.

Changes

Responses text block classification

Layer / File(s) Summary
Accept output_text blocks
plugins/governance/complexityextract.go, plugins/governance/complexityextract_test.go
The classifier accepts output_text blocks, and the test verifies extraction of user and system text from a Responses request.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: akshaydeo

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The code changes address complexity extraction, not the linked Files API support requirement in #123. Implement Files API support or link the PR to the correct issue that matches the complexity extraction change.
Out of Scope Changes check ⚠️ Warning The PR changes are unrelated to the linked Files API support objective and appear out of scope for issue #123. Remove the unrelated complexity extraction changes or update the linked issue to match the actual scope of the PR.
✅ Passed checks (3 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title clearly and concisely describes the main change: accepting output_text user blocks during complexity extraction.
Description check ✅ Passed The description follows the template well with summary, changes, type, affected areas, testing, breaking changes, and security notes.
✨ 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 07-28-accepts_output_text_user_blocks_in_complexity_extraction

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

kohlivrinda commented Jul 28, 2026

Copy link
Copy Markdown
Member Author

@kohlivrinda
kohlivrinda marked this pull request as ready for review July 28, 2026 06:16
@coderabbitai
coderabbitai Bot requested a review from akshaydeo July 28, 2026 06:17
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