Skip to content

Fix #707 structured content persistence and harden streaming error handling#718

Open
afurm wants to merge 1 commit intocrmne:mainfrom
afurm:af/fix-707-content-streaming
Open

Fix #707 structured content persistence and harden streaming error handling#718
afurm wants to merge 1 commit intocrmne:mainfrom
afurm:af/fix-707-content-streaming

Conversation

@afurm
Copy link
Copy Markdown
Contributor

@afurm afurm commented Apr 2, 2026

What this does

Fixes #707 by preserving structured string-keyed content across the ActiveRecord persistence boundary instead of reloading it as RubyLLM::Content::Raw.

This PR also hardens streaming error handling so the test matrix stays green:

  • adds a useful to_s / to_json representation for Content::Raw
  • handles missing Faraday v2 env objects in generic and Bedrock streaming error paths
  • avoids VertexAI auth initialization during stubbed streaming error specs
  • updates the gemspec spec to respect FARADAY_VERSION
  • adds regression coverage for the persistence and streaming error cases

Fixes #707.

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Performance improvement

Scope check

  • I read the Contributing Guide
  • This aligns with RubyLLM's focus on LLM communication
  • This isn't application-specific logic that belongs in user code
  • This benefits most users, not just my specific use case

Required for new features

  • I opened an issue before writing code and received maintainer approval
  • Linked issue: #___

PRs for new features or enhancements without a prior approved issue will be closed.

Quality check

  • I ran overcommit --install and all hooks pass
  • I tested my changes thoroughly
  • For provider changes: Re-recorded VCR cassettes with bundle exec rake vcr:record[provider_name]
  • All tests pass: bundle exec rspec
  • I updated documentation if needed
  • I didn't modify auto-generated files manually (models.json, aliases.json)

Validation run locally:

  • bundle exec rubocop
  • Rails appraisal matrix for rails-7.1, rails-7.2, rails-8.0, rails-8.1
  • The same appraisal matrix again with FARADAY_VERSION=1.10.3
  • Local gitleaks scan against .gitleaks.toml

AI-generated code

  • I used AI tools to help write this code
  • I have reviewed and understand all generated code (required if above is checked)

API changes

  • Breaking change
  • New public methods/classes
  • Changed method signatures
  • No API changes

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] Inconsistent message.content type across persistence boundary

1 participant