Skip to content

Conversation

@sirwolfgang
Copy link
Contributor

@sirwolfgang sirwolfgang commented Nov 10, 2025

Summary

This PR adds comprehensive testing for different versions of API provider gems and fixes compatibility issues with Anthropic gem version 1.14.0.

Changes

🧪 Test Infrastructure

  • New CI Job: Added test-api-gems job to GitHub Actions workflow to test against multiple versions of API provider gems
  • Matrix Testing: Tests run against:
    • Anthropic 1.12.x and 1.14.x
    • OpenAI 0.34.x and 0.35.x
  • Created gemfiles for each API version combination in the gemfiles/ directory

🐛 Bug Fixes

  • Anthropic 1.14.0 Compatibility: Fixed streaming message processing to handle internal _json_buf field that appears in tool use content blocks
  • JSON Parsing: Added fallback handling for cases where tool input is returned as a JSON string instead of a parsed hash

🗑️ Code Cleanup

  • Removed lib/active_agent/providers/open_router/request.rb (505 lines) - this appears to be unused or stray code

Technical Details

Anthropic 1.14.0 Changes

The Anthropic gem version 1.14.0 introduced internal changes to how streaming tool calls are handled. This PR patches the streaming response processor to:

  1. Strip out the internal _json_buf field from tool use content blocks when processing message_stop events
  2. Handle cases where :input is returned as a JSON string rather than a parsed hash
# Before processing finishes, clean up internal fields
api_message[:content]&.each do |content_block|
  content_block.delete(:_json_buf) if content_block[:type] == "tool_use"
end

# Handle string input case
if api_function_call[:input].is_a?(String)
  api_function_call[:input] = JSON.parse(api_function_call[:input], symbolize_names: true)
end

Testing

CI now automatically tests against multiple API gem versions to catch compatibility issues early. All existing tests continue to pass with the new changes.

Breaking Changes

None - these changes maintain backward compatibility while adding support for newer gem versions.

@sirwolfgang sirwolfgang changed the title Remove stay file Add API gem version testing and fix Anthropic 1.14.0 compatibility Nov 10, 2025
@sirwolfgang sirwolfgang marked this pull request as ready for review November 10, 2025 17:42
Copilot AI review requested due to automatic review settings November 10, 2025 17:42
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances the test infrastructure by adding multi-version testing for API provider gems and fixes compatibility issues with Anthropic gem version 1.14.0, which introduced changes to how streaming tool calls are handled.

  • Added CI matrix testing for multiple versions of Anthropic (1.12.x, 1.14.x) and OpenAI (0.34.x, 0.35.x) gems
  • Fixed streaming message processing to handle internal _json_buf field and string-based tool inputs in Anthropic 1.14.0
  • Removed unused OpenRouter types file

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
lib/active_agent/providers/anthropic_provider.rb Adds compatibility patches for Anthropic 1.14.0 to strip internal fields and handle JSON string inputs
lib/active_agent/generation_provider/open_router/types.rb Removes entire unused file (505 lines)
gemfiles/anthropic_1.12.gemfile Adds gemfile for testing with Anthropic 1.12.x
gemfiles/anthropic_1.14.gemfile Adds gemfile for testing with Anthropic 1.14.x
gemfiles/openai_0.34.gemfile Adds gemfile for testing with OpenAI 0.34.x
gemfiles/openai_0.35.gemfile Adds gemfile for testing with OpenAI 0.35.x
.github/workflows/ci.yml Adds new test-api-gems job with matrix testing across API provider versions

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@TonsOfFun TonsOfFun merged commit 388636d into activeagents:main Nov 11, 2025
9 checks passed
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