This repository was archived by the owner on May 15, 2026. It is now read-only.
Commit f8a2873
committed
Prevent xAI replay from exposing persisted Anthropic reasoning
The xAI Responses path reuses convertToResponsesApiInput() when replaying
persisted conversation history. Anthropic thinking blocks were being
flattened into ordinary assistant-visible output_text entries, which
changes conversation semantics and leaks hidden reasoning into later
prompt context.
This keeps the fix intentionally narrow: persisted Anthropic thinking
blocks are now skipped for Responses replay, and a regression test
covers the behavior.
Constraint: Keep the change scoped to the replay transform without changing provider selection or task persistence
Rejected: Preserve thinking by converting it to [Thinking] output_text | turns hidden reasoning into visible assistant content
Confidence: medium
Scope-risk: narrow
Reversibility: clean
Directive: If a provider-specific hidden reasoning replay format is added later, prefer that over flattening Anthropic thinking into visible text
Tested: pnpm --dir src exec vitest run api/transform/__tests__/responses-api-input.spec.ts api/providers/__tests__/xai.spec.ts
Not-tested: Full end-to-end provider-switch replay with live xAI credentials1 parent cb83656 commit f8a2873
2 files changed
Lines changed: 27 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
280 | 280 | | |
281 | 281 | | |
282 | 282 | | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
283 | 305 | | |
284 | 306 | | |
285 | 307 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
64 | 61 | | |
65 | 62 | | |
66 | 63 | | |
| |||
0 commit comments