Skip to content

fix(provider): deep merge providerOptions in applyCaching - #10323

Merged
rekram1-node merged 1 commit into
anomalyco:devfrom
zerone0x:fix/issue-10241-applyCaching-deep-merge
Jan 24, 2026
Merged

rekram1-node merged 1 commit into
anomalyco:devfrom
zerone0x:fix/issue-10241-applyCaching-deep-merge

Conversation

@zerone0x

Copy link
Copy Markdown
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 <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

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

No duplicate PRs found

@rekram1-node

Copy link
Copy Markdown
Collaborator

/review

@github-actions

Copy link
Copy Markdown
Contributor

lgtm

@rekram1-node
rekram1-node merged commit 087d7da into anomalyco:dev Jan 24, 2026
5 checks passed
xenonwellz pushed a commit to xenonwellz/opencode that referenced this pull request Jan 28, 2026
Colin4k1024 pushed a commit to Colin4k1024/opencode that referenced this pull request Feb 10, 2026
Rwanbt pushed a commit to Rwanbt/unifia that referenced this pull request May 5, 2026
AIALRA-0 pushed a commit to AIALRA-0/opencode-turn-engine that referenced this pull request Jun 10, 2026
Rwanbt pushed a commit to Rwanbt/unifia that referenced this pull request Jun 14, 2026
MarsQiu007 referenced this pull request in MarsQiu007/openNovel Jul 31, 2026
meSingh pushed a commit to meSingh/opencode that referenced this pull request Sep 6, 2026
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