Commit 4bf976e
committed
fix: skip reasoning parts from different models to prevent Anthropic signature errors
When switching models mid-conversation, Anthropic reasoning (thinking) blocks
carry a cryptographic signature bound to the model that generated them. Replaying
those parts to a different model causes a 400 error: 'thinking.signature: Field required'.
- message-v2.ts: skip reasoning parts entirely when the historical message came
from a different model (differentModel flag already computed upstream)
- transform.ts: defence-in-depth guard that strips unsigned reasoning parts
before they reach the Anthropic/Bedrock SDK, preventing the 400 even if
message-v2 reconstruction is bypassed1 parent c99a0a2 commit 4bf976e
2 files changed
Lines changed: 25 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
84 | 103 | | |
85 | 104 | | |
86 | 105 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
786 | 786 | | |
787 | 787 | | |
788 | 788 | | |
789 | | - | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
790 | 794 | | |
791 | 795 | | |
792 | 796 | | |
793 | | - | |
| 797 | + | |
794 | 798 | | |
795 | 799 | | |
796 | 800 | | |
| |||
0 commit comments