Files
oh-my-pi/packages
can1357 cf4da4d786 Merge #3437 + reconcile with #3439: unified cross-API reasoning preservation
#3437 (preserve cross-api reasoning replay) and #3439 (preserve 3p thinking blocks across cross-API switches) both rewrite the thinking-block path of transform-messages.ts and the encoder in openai-completions.ts to fix issues #3433/#3434, and overlap structurally. Reconciled into one resolved-compat design:

- transform-messages.ts threads the request-time resolved compat (from #3437) into the predicate, replacing #3439's base+whenThinking union traversal. resolveOpenAICompatPolicy already swaps in whenThinking for thinking-on requests, so the predicate and encoder stay in lockstep (closes both Codex 'use resolved compat' reviews and keeps the #1071/#1484 OpenCode paths correct).

- The predicate keeps #3439's broad coverage: preserve a native, signature-stripped thinking block when the resolved openai-completions target is reasoning-capable, not requiresThinkingAsText, and either requiresReasoningContentForToolCalls or thinkingFormat==='zai'. Other cross-API targets text-demote.

- openai-completions.ts keeps #3439's Z.AI-format encoder branch and #3437's compat threading, but drops #3439's text-fold fallback and isSameModelHistory: under threading they are unreachable (any preserved cross-model block is consumed by the requiresReasoningContentForToolCalls or zai branch; thinking-off targets text-demote in transform). Markup-healed same-model thinking still falls through unemitted, as before.

Regression tests from both PRs retained. Fixes #3433, #3434.
2026-06-25 06:31:22 +02:00
..
2026-06-25 05:17:47 +02:00
2026-06-25 05:17:47 +02:00
2026-06-23 08:22:21 +02:00
2026-06-25 05:17:47 +02:00
2026-06-25 05:17:47 +02:00
2026-06-25 05:17:47 +02:00
2026-06-25 05:17:47 +02:00
2026-06-25 05:17:47 +02:00
2026-06-25 05:17:47 +02:00
2026-06-25 05:17:47 +02:00