Skip to content

Conversation

@zerone0x
Copy link
Contributor

Summary

Fixes #10241

Previously, applyCaching used shallow spreading ({...a, ...b}) to merge providerOptions, which would completely overwrite nested keys like openaiCompatible. This caused options set by normalizeMessages (e.g., reasoning_content for interleaved models) to be lost when applyCaching ran.

Changes

  • Import mergeDeep from remeda
  • Replace shallow spread with mergeDeep() for both message-level and content-level providerOptions

Now using remeda's mergeDeep to properly preserve existing nested properties while adding cache control options.

Test Plan

  • Existing provider transform tests pass (75 tests)
  • TypeScript type checking passes

🤖 Generated with Claude Code

Previously, applyCaching used shallow spreading to merge providerOptions,
which would completely overwrite nested keys like 'openaiCompatible'.
This caused options set by normalizeMessages (e.g., reasoning_content
for interleaved models) to be lost when applyCaching ran.

Now using remeda's mergeDeep to properly preserve existing nested
properties while adding cache control options.

Fixes anomalyco#10241

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

@rekram1-node
Copy link
Collaborator

/review

@github-actions
Copy link
Contributor

lgtm

@rekram1-node rekram1-node merged commit 087d7da into anomalyco:dev Jan 24, 2026
5 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.

[BUG] applyCaching overrides previous provider options

2 participants